Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import gdb
- while True:
- try:
- gdb.execute('target remote :5555')
- break
- except:
- pass
- print "connected"
- lines = gdb.execute('info proc mappings', to_string=True).splitlines()
- file_count = 0
- for line in lines:
- arr = line.split()
- if len(arr) > 0:
- start = arr[0]
- end = arr[1]
- if start[0:2] == "0x" and end[0:2] == "0x":
- #find dll magic number
- statement = 'find/w {0},{1},{2}'.format(start,end,'0x00905A4D')
- res = gdb.execute(statement,to_string=True).splitlines()
- if res[0].find("not found") == -1:
- for d in res:
- if d != res[-1]:
- dll_start = d
- #dump mapping with dll inside
- dump = "dump binary memory file_{0} {1} {2}".format(file_count, dll_start, end)
- gdb.execute(dump)
- file_count += 1
Advertisement
Add Comment
Please, Sign In to add comment