#!/usr/bin/env python # argv[1] is the optional filename (otherwise picks fwid-start-end.fwmemdump) import sys, time import fw timerstart = time.localtime(time.time()) print "[*]" + time.asctime(timerstart) BLOCKSIZE = 1024*1024*4 devices = fw.scanbus() def format_guid(i): return ':'.join(["".join(x) for x in zip(("%016x" % i)[::2], ("%016x" % i)[1::2])]) start = 0x00000000L end = 0x40000000L # 1GB for device in devices: print "[*] Found device %s" % (format_guid(device.guid)) if(len(sys.argv)==2): fd = open(sys.argv[1], "w") else: fd = open("dump/%016x-%08x-%08x.fwmemdump" % (device.guid, start, end), "w") pos = start while pos < end: print "\r-> reading %08x ..." % (pos), fd.write(device.read(pos, BLOCKSIZE)) print hex(device.lastResultCode*1L), pos += BLOCKSIZE sys.stdout.flush() fd.close() print "\n" timerstop = time.localtime(time.time()) print "[*]" + time.asctime(timerstop)