mirror of
https://github.com/bkerler/mtkclient.git
synced 2024-11-14 19:25:05 -05:00
Improve preloader dumper
This commit is contained in:
parent
bef2d8efd0
commit
055190bcf3
3 changed files with 5 additions and 6 deletions
|
@ -288,12 +288,11 @@ class Kamakiri(metaclass=LogBase):
|
|||
self.error(f"Error on opening {filename} for writing: {str(e)}")
|
||||
return False
|
||||
|
||||
def dump_preloader(self, length=0x80000):
|
||||
def dump_preloader(self):
|
||||
try:
|
||||
filename = ""
|
||||
self.mtk.port.usbwrite(pack(">I",length))
|
||||
ack = unpack("<I", self.mtk.port.usbread(4))[0]
|
||||
if ack == 0xC0C0C0C0:
|
||||
length = unpack("<I", self.mtk.port.usbread(4))[0]
|
||||
if length > 0:
|
||||
data = self.mtk.port.usbread(length)
|
||||
idx = data.find(b"MTK_BLOADER_INFO")
|
||||
if idx != -1:
|
||||
|
|
|
@ -252,7 +252,7 @@ class PLTools(metaclass=LogBase):
|
|||
if btype == "kamakiri":
|
||||
self.info("Kamakiri / DA Run")
|
||||
if self.runpayload(filename=pfilename, ptype="kamakiri", ack=0xC1C2C3C4, offset=0):
|
||||
data,filename=self.kama.dump_preloader(0x80000)
|
||||
data,filename=self.kama.dump_preloader()
|
||||
return data, filename
|
||||
else:
|
||||
self.error("Error on sending payload: " + pfilename)
|
||||
|
@ -260,7 +260,7 @@ class PLTools(metaclass=LogBase):
|
|||
elif btype == "kamakiri2" or btype is None:
|
||||
self.info("Kamakiri2")
|
||||
if self.runpayload(filename=pfilename, ptype="kamakiri2", ack=0xC1C2C3C4, offset=0):
|
||||
data,filename=self.kama.dump_preloader(0x80000)
|
||||
data,filename=self.kama.dump_preloader()
|
||||
return data, filename
|
||||
else:
|
||||
self.error("Error on sending payload: " + pfilename)
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue