标签:jpg object iframe repeat ima com imp margin alt
MarkdownPad Document
1 #include <stdio.h> 2 3 int main(){ 4 unsigned int random; 5 random = rand(); // random value! 6 7 unsigned int key=0; 8 scanf("%d", &key); 9 10 if( (key ^ random) == 0xdeadbeef ){ 11 printf("Good!\n"); 12 system("/bin/cat flag"); 13 return 0; 14 } 15 16 printf("Wrong, maybe you should try 2^32 cases.\n"); 17 return 0; 18 }
查看random()函数时有这样的描述:
即该函数每次产生的随机值均为定值,自己写一个类似的程序可以得到此时产生的随机值为1804289383
根据代码流程,1804289383 ^ 0xdeadbeef即可得到要输入的key值为3039230856,则可得到flag为 Mommy, I thought libc random is unpredictable...
2017-2-7 22:01;32
标签:jpg object iframe repeat ima com imp margin alt
原文地址:http://www.cnblogs.com/WangAoBo/p/6376082.html