Quantcast
Channel: 记事本
Viewing all articles
Browse latest Browse all 122

random

$
0
0

代码如下

#include <stdio.h>intmain(){unsignedintrandom;random=rand();// random value!unsignedintkey=0;scanf("%d",&key);if((key^random)==0xdeadbeef){printf("Good!\n");system("/bin/cat flag");return0;}printf("Wrong, maybe you should try 2^32 cases.\n");return0;}

rand()并没有真的随机化,manpage里说

If no seed value is provided, the rand() function is automatically seeded with a value of 1.

是用gdb得到这个所谓的随机值,是0x6b8b4567,所以我们输入0x6b8b4567^0xdeadbeef=3039230856就行。


Viewing all articles
Browse latest Browse all 122

Trending Articles