攻防世界open-source

题目链接:
https://adworld.xctf.org.cn/task/answer?type=reverse&number=4&grade=0&id=5076&page=1在这里插入图片描述打开附件可得到下面这段代码:在这里插入图片描述分析:
1.必须满足输入四个参数;
2. 第二个参数等于 0xcafe;
3. 第三个参数对5取余不能等于3,或者是对17取余等于8;
4. 第四个参数是:h4cky0u根据以上条件,我们可以得出:
first = 0xcafe
second%17)= 8
strlen(argv[3]) = strlen(“h4cky0u”)
最后输出的参数hash可改写为:
unsigned int hash = 0xcafe * 31337 + 8 * 11 + strlen(“h4cky0u”) - 1615810207;
我们可以将代码改写成:
#include <stdio.h>
#include <string.h>
int main() {
unsigned int hash = 0xcafe * 31337 + 8 * 11 + strlen(“h4cky0u”) - 1615810207;
printf(“Get your key: “);
printf(”%x\n”, hash); return 0;
}
用codeblocks运行得到结果:在这里插入图片描述所以最后的flag是c0ffee

发布了2 篇原创文章 · 获赞 0 · 访问量 120

猜你喜欢

转载自blog.csdn.net/qq_46927150/article/details/105440867