#include<stdio.h> #include<stdlib.h> #include<string.h> intmain() { char password[100] = "3h9"; char input[100] = ""; while (1) { puts("input:"); scanf("%s", input); if (!strcmp(password, input)) puts("flag is flag{heshi_tested_baopo}"); else puts("wrong"); } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
from pwn import * p = process("./baopo")
for i inrange(43,125): for j inrange(43, 125): for k inrange(43, 125): p.sendlineafter(":",p8(i)+p8(j)+p8(k) ) p.recvline() rcv = p.recvline() ifb'flag'in rcv: print(rcv) print(p8(i)+p8(j)+p8(k)) break p.interactive() print("end")
爆破数字
六位密码的爆破基本上可以在几分钟内完成,在服务器条件可能需要延长到半小时内。
1 2 3 4 5 6 7 8 9 10 11 12 13 14
from pwn import * #context.log_level="debug" p = process("./baopo")
for i inrange(1000000): p.sendlineafter(":",str(i) ) p.recvline() rcv = p.recvline() ifb'flag'in rcv: print(rcv) print(i) break p.interactive() print("end")
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { char password[100] = "839325"; char input[100] = ""; while (1) { puts("input:"); scanf("%s", input); if (!strcmp(password, input)) puts("flag is flag{heshi_tested_baopo}"); else puts("wrong"); } }