Merge pull request #565 from ChrisEric1/master

Fix footer command & Partially revert commit a9e5008
This commit is contained in:
Bjoern Kerler 2024-06-26 17:51:42 +02:00 committed by GitHub
commit f22a53bed2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 9 deletions

6
edl
View file

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2024 under GPLv3 license
# If you use my code, make sure you refer to my name
@ -290,9 +290,9 @@ class main(metaclass=LogBase):
conninfo = self.doconnect(loop)
mode = conninfo["mode"]
if conninfo.get("data"):
version = 2
else:
version = conninfo.get("data").version
else:
version = 2
if mode == "sahara":
cmd = conninfo["cmd"]
if cmd == cmd_t.SAHARA_HELLO_REQ:

View file

@ -487,21 +487,21 @@ class firehose_client(metaclass=LogBase):
pnames = ["userdata2", "metadata", "userdata", "reserved1", "reserved2", "reserved3"]
for pname in pnames:
for partition in guid_gpt.partentries:
if partition.name != pname:
if partition != pname:
continue
self.printer(f"Detected partition: {partition.name}")
self.printer(f"Detected partition: {partition}")
data = self.firehose.cmd_read_buffer(lun,
partition.sector +
(partition.sectors -
guid_gpt.partentries[partition].sector +
(guid_gpt.partentries[partition].sectors -
(0x4000 // self.firehose.cfg.SECTOR_SIZE_IN_BYTES)),
(0x4000 // self.firehose.cfg.SECTOR_SIZE_IN_BYTES), False)
if data == b"":
continue
val = unpack("<I", data[:4])[0]
val = unpack("<I", data.data[:4])[0]
if (val & 0xFFFFFFF0) == 0xD0B5B1C0:
with open(filename, "wb") as write_handle:
write_handle.write(data)
self.printer(f"Dumped footer from {partition.name} as {filename}.")
self.printer(f"Dumped footer from {partition} as {filename}.")
return True
self.error("Error: Couldn't detect footer partition.")
return False