我想使用angr解决这个非常基本的crackme:
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[]) {
char buffer[64];
printf("Mot de passe:\n");
scanf("%64s",buffer);
if (strcmp(buffer,"super!")==0)
{
printf("Bravo!\n");
}
else
{
printf("Perdu1!\n");
}
return 0;
}
它适用于这个 python 脚本:
import angr
from angr.state_plugins import SimSystemPosix
p = angr.Project('./a.out', load_options={'auto_load_libs': False})
sm = p.factory.simulation_manager()
sm.explore(find= 0x400000+0x0000119f, avoid= 0x400000+ 0x000011ad)
print(sm.found[0].posix.dumps(0))
但是,如果我"super!"使用包含空格的密码在我的 Crackme 中更改密码,angr 找不到任何解决方案。
使用fgets而不是scanf得到相同的结果;如果密码包含空格,则 angr 找不到任何密码。
当然,每次我重新编译我的 c 程序时,我都会更新查找和避免地址。