Skip to content

Instantly share code, notes, and snippets.

@lionaneesh
Created September 16, 2017 09:12
Show Gist options
  • Save lionaneesh/d766fc481dca509113276c0d70f489c4 to your computer and use it in GitHub Desktop.
Save lionaneesh/d766fc481dca509113276c0d70f489c4 to your computer and use it in GitHub Desktop.
import gdb
import sys
import os
class MyBreakpoint(gdb.Breakpoint):
def stop (self):
return True
gdb.execute('file ./bank_patched')
MyBreakpoint("*0x555555554c56")
gdb.execute('run < payload_bank')
print(gdb.parse_and_eval('rand_data'))
print('setting seed:', seed)
gdb.execute('set variable rand_data=' + str(seed))
print(gdb.parse_and_eval('rand_data'))
# rand_data overwritten
MyBreakpoint("*0x555555554eeb")
gdb.execute('continue')
print(gdb.parse_and_eval('rand_data'))
h = gdb.execute('x/1s $rbp-0xe0', to_string=True)
gdb.execute("dump binary memory result.bin 0x00040000 0x00071000")
print("Hash", h.split('"')[1])
gdb.execute('quit')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment