Skip to content

Instantly share code, notes, and snippets.

@CreateRemoteThread
Created November 5, 2017 12:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CreateRemoteThread/c104d9ede3c988a4b8f64efe6a801b1e to your computer and use it in GitHub Desktop.
Save CreateRemoteThread/c104d9ede3c988a4b8f64efe6a801b1e to your computer and use it in GitHub Desktop.
#!/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