From 055190bcf3af7060a85ccf96caf4f5f613e2157c Mon Sep 17 00:00:00 2001 From: Bjoern Kerler Date: Tue, 31 Aug 2021 17:54:06 +0200 Subject: [PATCH] Improve preloader dumper --- mtkclient/Library/kamakiri.py | 7 +++---- mtkclient/Library/pltools.py | 4 ++-- .../payloads/generic_preloader_dump_payload.bin | Bin 632 -> 612 bytes 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/mtkclient/Library/kamakiri.py b/mtkclient/Library/kamakiri.py index 4874833..9dd25bd 100755 --- a/mtkclient/Library/kamakiri.py +++ b/mtkclient/Library/kamakiri.py @@ -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(" 0: data = self.mtk.port.usbread(length) idx = data.find(b"MTK_BLOADER_INFO") if idx != -1: diff --git a/mtkclient/Library/pltools.py b/mtkclient/Library/pltools.py index 171d396..dcbb3a0 100755 --- a/mtkclient/Library/pltools.py +++ b/mtkclient/Library/pltools.py @@ -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) diff --git a/mtkclient/payloads/generic_preloader_dump_payload.bin b/mtkclient/payloads/generic_preloader_dump_payload.bin index 215d55db0219413f411a2901ed7917fb792d5f75..138cb20466974845a32720ea22e46eeb7b48ed5b 100755 GIT binary patch delta 374 zcmWm6PbfrD6bA5f?z@9zF=i~7$e&w`4Q~`#SZL-s?Mt0($Ncue&YvLJWW-D42eEp%b=fLd&M5Z3PrqdLfSZ~CZf zoOVun%|n~tZ8kZGN+k2MO=jL)O+|!1L7a^^FzrBd){1OCA~YwHcH^0Jo6xr1cp#DE zPo^999m;dR%3GhAbVU4oQrY@Z251LBa(Q)q(?I}2N~7|E0N={3;wlTuqSA>#AmkMA F=?|NWfq4J` delta 417 zcmXwxK}Zx)9EX2z=INRwY>pn1#N|QW6cruiJK5Wk&^+JI#lI02JE>m^YJx9n*t_YlC>RdY z55EqcCCKyL+%3msZbUD*5#l~S-vha(pV;ra@9JG*8uGRFlw+_?VGEx(>f)tBNAI@5 zs13QSX5J-6>D4iHX`ta(ZETizO;{?{Hm2eUCQUOfi9u6umQK$F{o+g>OY^xY?D#9J*3nx~o`&6RMT?EM2k3zE73