aamux-dumper/dump.py
2014-01-05 22:44:56 +01:00

23 lines
537 B
Python

import serial
import sys
if len(sys.argv) < 2:
sys.stderr.write("Usage: {} /dev/ttySERIAL\n".format(sys.argv[0]))
sys.exit(1)
s = serial.Serial(sys.argv[1], 115200)
def dump_block(block):
s.write(chr(block))
d = ""
while True:
d += s.read(1024)
print "[i] Receiving block {}, {} bytes received...".format(block, len(d))
if len(d) == 65536:
return d
for i in range(64):
data = dump_block(i)
f = open("dumps/dump-block-%02i.bin" % i, "w")
f.write(data)
f.close()