【发布时间】:2013-03-01 20:49:17
【问题描述】:
这个 C 程序是如何工作的?
main(_){_^448&&main(-~_);putchar(--_%64?32|-~7[__TIME__-_/8%8][">'txiZ^(~z?"-48]>>";;;====~$::199"[_*2&8|_/64]/(_&2?1:8)%8&1:10);}
它按原样编译(在gcc 4.6.3 上测试)。它在编译时打印时间。在我的系统上:
!! !!!!!! !! !!!!!! !! !!!!!!
!! !! !! !! !! !! !! !!
!! !! !! !! !! !! !! !!
!! !!!!!! !! !! !! !! !! !!!!!!
!! !! !! !! !! !! !!
!! !! !! !! !! !! !!
!! !!!!!! !! !! !! !!!!!!
来源:sykes2 - A clock in one line,sykes2 author hints
一些提示:默认情况下没有编译警告。使用-Wall 编译,发出以下警告:
sykes2.c:1:1: warning: return type defaults to ‘int’ [-Wreturn-type]
sykes2.c: In function ‘main’:
sykes2.c:1:14: warning: value computed is not used [-Wunused-value]
sykes2.c:1:1: warning: implicit declaration of function ‘putchar’ [-Wimplicit-function-declaration]
sykes2.c:1:1: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses]
sykes2.c:1:1: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses]
sykes2.c:1:1: warning: control reaches end of non-void function [-Wreturn-type]
【问题讨论】:
-
调试:将
printf("%d", _);添加到main的开头打印:pastebin.com/HHhXAYdJ -
整数,每个无类型变量默认为
int -
你读过提示吗? ioccc.org/2006/sykes2/hint.text
-
如果你这样运行它会崩溃:
./a.out $(seq 0 447)
标签: c obfuscation deobfuscation