Created
November 5, 2017 12:55
-
-
Save CreateRemoteThread/c104d9ede3c988a4b8f64efe6a801b1e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import struct | |
# use arm-linux-gnueabi-as / ld / objcopy to spit out bin files. | |
print "\n -- m3 programmer -- \n" | |
f = open("a.bin","rb") | |
data = f.read() | |
f.close() | |
l = len(data) | |
i = 0 | |
base_addr = 0x100040f8 | |
while i < l - 1: | |
try: | |
data_slice = data[i:i+4] | |
except: # should be out of data error. | |
data_slice = data[i:l-1] | |
while len(data_slice) != 4: | |
data_slice.append('\x00') | |
data_value = "0x%02x%02x%02x%02x" % tuple(map(ord,data_slice[::-1])) | |
print "m 0x%08x %s" % (base_addr + i,data_value) | |
i += 4 | |
print "\n -- done -- \n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment