3
# This script is useful for taking the output of memdump() and
4
# converting it back into binary output. This can be useful, for
5
# example, when one wants to push that data into other tools like
8
# (C) Copyright 2010 Kevin O'Connor <kevin@koconnor.net>
10
# This file may be distributed under the terms of the GNU GPLv3 license.
18
def parseMem(filehdl):
21
parts = line.split(':')
25
vaddr = unhex(parts[0])
26
parts = parts[1].split()
27
mem.extend([unhex(v) for v in parts])
33
sys.stderr.write("Usage:\n %s <file | ->\n"
38
if len(sys.argv) != 2:
40
filename = sys.argv[1]
44
filehdl = open(filename, 'r')
45
mem = parseMem(filehdl)
47
if (sys.version_info > (3, 0)):
48
sys.stdout.buffer.write(struct.pack("<I", i))
50
sys.stdout.write(struct.pack("<I", i))
52
if __name__ == '__main__':