Start work on parsing firmware payload.
This commit is contained in:
parent
9d9dc3671b
commit
dd682c6da1
@ -264,9 +264,14 @@ class RgnRecordR(RgnRecord):
|
|||||||
txt += " (OK)"
|
txt += " (OK)"
|
||||||
else:
|
else:
|
||||||
txt += " (" + RED + "MISMATCH!" + RESET + ")"
|
txt += " (" + RED + "MISMATCH!" + RESET + ")"
|
||||||
if self.id_payload() == "RGN":
|
payload_type = self.id_payload()
|
||||||
|
if payload_type == "RGN":
|
||||||
txt += "\n " + YELLOW + "PAYLOAD IS ANOTHER RGN STRUCTURE:" + RESET
|
txt += "\n " + YELLOW + "PAYLOAD IS ANOTHER RGN STRUCTURE:" + RESET
|
||||||
rgn = Rgn()
|
rgn = Rgn()
|
||||||
rgn.load_from_bytes(self.payload[10:])
|
rgn.load_from_bytes(self.payload[10:])
|
||||||
txt += "\n " + "\n ".join(str(rgn).split("\n"))
|
txt += "\n " + "\n ".join(str(rgn).split("\n"))
|
||||||
|
elif payload_type == "BIN":
|
||||||
|
binfw = RgnBin()
|
||||||
|
binfw.load_from_bytes(self.payload[10:])
|
||||||
|
txt += "\n " + "\n ".join(str(binfw).split("\n"))
|
||||||
return txt
|
return txt
|
||||||
|
@ -25,4 +25,11 @@ class RgnBin:
|
|||||||
if self.filename is None:
|
if self.filename is None:
|
||||||
return False
|
return False
|
||||||
with open(self.filename, "rb") as f:
|
with open(self.filename, "rb") as f:
|
||||||
|
rawdata = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
|
self.load_from_bytes(rawdata)
|
||||||
|
|
||||||
|
def load_from_bytes(self, payload: bytes):
|
||||||
|
print(repr(payload[0:10]))
|
||||||
|
jmp = unpack("<L", payload[0:4])[0]
|
||||||
|
print("{:08x}".format(jmp))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user