çpreprocessor伪大会嵌入针对字节code间preTER,如何找到类似的深难懂? [英] C Preprocessor Pseudo-Assembly with embedded byte-code interpreter, how to find similar deep magick?

查看:100
本文介绍了çpreprocessor伪大会嵌入针对字节code间preTER,如何找到类似的深难懂?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道常见的看法是,它是一件坏事,使你的语言看起来像别的东西,因为它掩盖了正在发生的事情,甚至为那些谁硝酸钾的语言很好。但对于阅读,开拓创新,一个人想突破界限,为的想象的不同(LY)

I know the common opinion is that it is a Bad Thing to make your language look like something else, because it obscures what's going on even for those who kno the language well. But for reading, exploring and innovating, one wants to push the boundaries, to think different(ly).

还有的原Bourne Shell中code ;看到这使ç样子ALGOL文件mac.h。

There's the classic example of the original Bourne Shell code; see the file "mac.h" which makes C look like ALGOL.

我试过嵌入机器code的小实验是这样的:

I've tried little experiments with embedded "machine-code" like this:

unsigned char a[36][2]= { 0,  0, 0,  0,
     0,  2,
     0, 22,
    'l', 1,
    '+', 2,
    's', 1,
    '-', 3,
    'z', 13,
    'l', 1,
    '+', 0,
    's', 0,
    'j', 4,
    'l', 0,
    'w', 0,
    'q', 0,
};
unsigned char ip = 0;
unsigned short acc = 0;

#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>

int init() { return true; }

#define load ( (a[ar][0] << 8) + a[ar][1] )
int run() { unsigned char op,ar;
while(1)
    switch(ar= a[ip][1], op= a[ip++][0]) {
    case 'l':acc= load; break;
    case 's':a[ar][1]= acc; a[ar][0] = acc >> 8; break;
    case '+':acc+= load; break;
    case '-':acc-= load; break;
    case '*':acc*= load; break;
    case 0:case 'n':break;
    case 'j':ip = ar; break;
    case 'z':(acc==0)?(ip=ar):0xF00L;break;
    case 'r':scanf("%hd", &acc); break;
    case 'w':printf("%d\n", (int)acc); break;
    case 'q':goto done;
    }
done: return true; }

int main() {return init()&&run()?EXIT_SUCCESS:EXIT_FAILURE;}

和一段时间后,我尝试使用preprocessor组装机器code这些方法结合起来。 我得到了comp.lang.c 一些建议但我不知道该怎么寻找找到更多关于疯狂的这样的东西。有没有人有嵌入到字符串数组或DSL的其他例子?

And some time later I tried combining these approaches using the preprocessor to assemble the machine code. I got some advice on comp.lang.c But I don't know what to search for to find more about crazy stuff like this. Does anyone have other examples of DSLs embedded in strings or arrays?

编辑:的虽然的表面上的混淆,混淆本身并不是这里的目标。我在寻找pre处理器的滥用的和的开发的之间的边缘情况。我希望你们都可以看到关键字多么简单单单任何条款或结合是不可能产生我想要的搜索。

While ostensibly obfuscated, obfuscation per se is not the goal here. I'm looking for the edge cases between pre-processor abuse and exploitation. I hope you all can see how simple keyword searching for any of these terms alone or in combination is unlikely to yield what I want.

推荐答案

尝试国际混淆C $ C $ ç比赛和其他谷歌的链接模糊ç

Try The International Obfuscated C Code Contest and other google links to obfuscated C.

也期待 code高尔夫

这篇关于çpreprocessor伪大会嵌入针对字节code间preTER,如何找到类似的深难懂?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆