open-source

Posted on Oct 13, 2020

打开获得一个C源文件

if (argc != 4) {
    printf("what?\n");
    exit(1);
}

这里说明要有4个参数(包括程序名在内)

unsigned int first = atoi(argv[1]);
if (first != 0xcafe) {
    printf("you are wrong, sorry.\n");
    exit(2);
}

这里说明第二个参数的十六进制形式为cafe,十进制形式是51966。(atoi()是字符转整数的意思,是直接转,即"134213"转到134213)

第二个

unsigned int second = atoi(argv[2]);
if (second % 5 == 3 || second % 17 != 8) {
    printf("ha, you won't get it!\n");
    exit(3);
}

只要找到一个满足的值就可以了,对之后的运算没有影响,我用的是25

第三个

if (strcmp("h4cky0u", argv[3])) {
    printf("so close, dude!\n");
    exit(4);
}

直接就是h4cky0u

所以

就完成了