zoukankan      html  css  js  c++  java
  • Brainfuck与Ook!编程语言解析与解密

    MarkdownPad Document

    Brainfuck与Ook!编程语言解析与解密

    CTF的Crypto中经常会遇到这样的加密

    ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.

    有经验的赛棍一眼就可以看出这是Brainfuck加密,brainfuck又被称为brainf**k或者BF
    brainfuck语言用> < + - . , [ ]八种符号来替换C语言的各种语法和命令,具体规则如下:


    The Brainfuck programming language consists of eight commands, each of which is represented as a single character.

    > Increment the pointer.
    < Decrement the pointer.
    + Increment the byte at the pointer.
    - Decrement the byte at the pointer.
    . Output the byte at the pointer.
    , Input a byte and store it in the byte at the pointer.
    [ Jump forward past the matching ] if the byte at the pointer is zero.
    ] Jump backward to the matching [ unless the byte at the pointer is zero.

    The semantics of the Brainfuck commands can also be succinctly expressed in terms of C, as follows (assuming that p has been previously defined as a char*):

    > becomes ++p;
    < becomes --p;
    + becomes ++*p;
    - becomes --*p;
    . becomes putchar(*p);
    , becomes *p = getchar();
    [ becomes while (*p) {
    ] becomes }

    brainfuck的更多资料

    而另一种类似的Ook!编程语言也偶尔遇到,如下:

    Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
    Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
    Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook.
    Ook! Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
    Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook?
    Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook. Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook.
    Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook. Ook! Ook. Ook. Ook. Ook. Ook.
    Ook. Ook. Ook! Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook.
    Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook.
    Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook.
    Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
    Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook.
    Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
    Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook.
    Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook.
    Ook! Ook. Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook.
    Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook!
    Ook! Ook. Ook. Ook? Ook. Ook? Ook. Ook. Ook! Ook.

    Ook!语言与brainfuck类似,也是用了替换,具体规则如下:


    Syntax Elements

    Ook! has only three distinct syntax elements:
    Ook.
    Ook?
    Ook!
    These are combined into groups of two, and the various pair combinations specify commands. Programs must thus contain an even number of "Ook"s. Line breaks are ignored.

    Commands

    Ook. Ook?
    Move the Memory Pointer to the next array cell.
    Ook? Ook.
    Move the Memory Pointer to the previous array cell.
    Ook. Ook.
    Increment the array cell pointed at by the Memory Pointer.
    Ook! Ook!
    Decrement the array cell pointed at by the Memory Pointer.
    Ook. Ook!
    Read a character from STDIN and put its ASCII value into the cell pointed at by the Memory Pointer.
    Ook! Ook.
    Print the character with ASCII value equal to the value in the cell pointed at by the Memory Pointer.
    Ook! Ook?
    Move to the command following the matching Ook? Ook! if the value in the cell pointed at by the Memory Pointer is zero. Note that Ook! Ook? and Ook? Ook! commands nest like pairs of parentheses, and matching pairs are defined in the same way as for parentheses.
    Ook? Ook!
    Move to the command following the matching Ook! Ook? if the value in the cell pointed at by the Memory Pointer is non-zero.

    Ook!语言的更多资料

    当然对于我们而言,我们没有必要弄清楚Ook!brainfuck的语法,因为网上已经有了很多现成的解密脚本和在线网站,这里提供一个在线的Ook!和brainfuck的在线加密解密网址:
    https://www.splitbrain.org/services/ook
    2017-2-7 11:21;03

  • 相关阅读:
    JS 数组排序
    曾经跳过的坑------replace、替换斜杠反斜杠、时间格式化处理
    List排序、集合排序
    git远程覆盖本地的
    整理日期,整理时间段,将日期集合整理为时间段
    当数据库查询in使用超过1000个的处理方式,in超过1000的问题
    oracle一些语法
    idea中git操作
    idea鼠标放上去查看注释,idea查看注释
    idea更新git远程代码,查看代码改动了哪些
  • 原文地址:https://www.cnblogs.com/WangAoBo/p/6373318.html
Copyright © 2011-2022 走看看