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

  • 相关阅读:
    如何解决虚拟机频繁分离和附加磁盘导致的识别错误
    创建基于 AFS 的 Docker 容器卷
    使用 docker-machine 管理 Azure 容器虚拟机
    SSH 无法启动的原因分析及解决方法
    Azure 经典模式中虚拟机证书指纹的生成和作用
    远程桌面到 Ubuntu 虚拟机
    Azure Linux 虚拟机常见导致无法远程的操作
    Azure Linux 虚机上配置 RAID 的常见问题及解决方案
    使用 Azure CLI 在 Azure China Cloud 云平台上手动部署一套 Cloud Foundry
    数据库设计(六)第二范式(2NF)?
  • 原文地址:https://www.cnblogs.com/WangAoBo/p/6373318.html
Copyright © 2011-2022 走看看