mirror of
https://github.com/bkerler/mtkclient.git
synced 2024-11-30 19:26:56 -05:00
Optimize code for hashimoto.py
This commit is contained in:
parent
9366288b61
commit
378e731c06
1 changed files with 3 additions and 12 deletions
|
@ -53,10 +53,7 @@ class Hashimoto(Exploitation, metaclass=LogBase):
|
|||
if addr is None:
|
||||
addr = self.chipconfig.da_payload_addr
|
||||
if self.payload(payload, addr):
|
||||
if dontack:
|
||||
return ack
|
||||
result = self.usbread(4)
|
||||
if result == pack(">I", ack):
|
||||
if dontack or self.usbread(4) == pack(">I", ack):
|
||||
return ack
|
||||
return None
|
||||
|
||||
|
@ -71,10 +68,7 @@ class Hashimoto(Exploitation, metaclass=LogBase):
|
|||
if filename is None:
|
||||
data = bytearray()
|
||||
for addr in range(0x200000, 0x240000, 16):
|
||||
if not self.chipconfig.blacklist:
|
||||
data.extend(self.hwcrypto.cqdma.mem_read(addr, 16, True))
|
||||
else:
|
||||
data.extend(self.hwcrypto.cqdma.mem_read(addr, 16, False))
|
||||
data.extend(self.hwcrypto.cqdma.mem_read(addr, 16, not self.chipconfig.blacklist))
|
||||
return data, filename
|
||||
else:
|
||||
print_progress(0, 100, prefix='Progress:', suffix='Complete', bar_length=50)
|
||||
|
@ -86,10 +80,7 @@ class Hashimoto(Exploitation, metaclass=LogBase):
|
|||
print_progress(prog, 100, prefix='Progress:', suffix='Complete, addr %08X' % addr,
|
||||
bar_length=50)
|
||||
old = round(prog, 1)
|
||||
if not self.chipconfig.blacklist:
|
||||
wf.write(self.hwcrypto.cqdma.mem_read(addr, 16, True))
|
||||
else:
|
||||
wf.write(self.hwcrypto.cqdma.mem_read(addr, 16, False))
|
||||
wf.write(self.hwcrypto.cqdma.mem_read(addr, 16, not self.chipconfig.blacklist))
|
||||
print_progress(100, 100, prefix='Progress:', suffix='Complete', bar_length=50)
|
||||
return True
|
||||
|
||||
|
|
Loading…
Reference in a new issue