Skip to content

Instantly share code, notes, and snippets.

@zoogie
Created February 7, 2018 21:14
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 zoogie/ea350cea381ee51213d0f27f2778d5fc to your computer and use it in GitHub Desktop.
Save zoogie/ea350cea381ee51213d0f27f2778d5fc to your computer and use it in GitHub Desktop.
import struct,random
f=open("movable.sed","rb")
buf=f.read()
f.close()
o=0x110
lfcs=struct.unpack("<I",buf[o+0:o+4])[0]
msed2=struct.unpack("<I",buf[o+4:o+8])[0]
msed3=struct.unpack("<I",buf[o+12:o+16])[0]&0x7FFFFFFF
print(hex(lfcs),hex(msed2),hex(msed3))
est=lfcs//5-msed3
isnew=0
if(msed2):
isnew=1
print(hex(est))
print(est)
lfcs>>=12
f=open("msed_data_%08X.bin" % random.randint(0,0xFFFFFFFF),"wb")
f.write(struct.pack("<I",lfcs))
f.write(struct.pack("<i",est))
f.write(struct.pack("<I",isnew))
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment