Skip to content

Commit

Permalink
Fix dumpbrom
Browse files Browse the repository at this point in the history
  • Loading branch information
bkerler authored Jul 22, 2024
1 parent 7e590a2 commit 586d86e
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions mtkclient/Library/Exploit/kamakiri2.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,31 @@ def newbrute(self, dump_ptr, dump=False):
return False, dump_ptr + 4

def dump_brom(self, filename, dump_ptr=None, length=0x20000):
try:
with open(filename, 'wb') as wf:
wf.write(self.newbrute(dump_ptr, True))
print_progress(100, 100, prefix='Progress:', suffix='Complete', bar_length=50)
return True
except Exception as e:
self.error(f"Error on opening {filename} for writing: {str(e)}")
return False
if dump_ptr is None:
try:
with open(filename, 'wb') as wf:
print_progress(0, 100, prefix='Progress:', suffix='Complete', bar_length=50)
length = self.mtk.port.usbread(4)
length = int.from_bytes(length, 'big')
rlen = min(length, 0x20000)
for i in range(length // rlen):
data = self.mtk.port.usbread(rlen)
wf.write(data)
print_progress(i, length // rlen, prefix='Progress:', suffix='Complete', bar_length=50)
print_progress(100, 100, prefix='Progress:', suffix='Complete', bar_length=50)
return True
except Exception as e:
self.error(f"Error on opening {filename} for writing: {str(e)}")
return False
else:
try:
with open(filename, 'wb') as wf:
wf.write(self.newbrute(dump_ptr, True))
print_progress(100, 100, prefix='Progress:', suffix='Complete', bar_length=50)
return True
except Exception as e:
self.error(f"Error on opening {filename} for writing: {str(e)}")
return False

def dump_preloader(self, filename=None):
rfilename = None
Expand Down

0 comments on commit 586d86e

Please sign in to comment.