Skip to content

Commit

Permalink
Fix dump preloader bug and on unprotected loaders using kamakiri
Browse files Browse the repository at this point in the history
  • Loading branch information
bkerler committed Jan 21, 2024
1 parent a89a014 commit 29341e5
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions mtkclient/Library/DA/mtk_da_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,26 +86,26 @@ def configure_da(self, mtk, preloader):
if mtk.config.target_config is None:
self.info("Please disconnect, start mtkclient and reconnect.")
return None
if mtk.config.target_config["daa"] and mtk.config.is_brom:
if mtk.config.target_config["sbc"] and not mtk.config.is_brom and mtk.config.loader is None:
mtk = mtk.bypass_security()
self.mtk = mtk
if self.mtk.daloader.patch :
self.info("Device was protected. Successfully bypassed security.")
else:
self.info("Device is protected.")
self.info("Device is still protected, trying to boot to brom")
try:
if not mtk.config.loader:
if not mtk.config.is_brom:
self.mtk.preloader.reset_to_brom()
except Exception:
pass
if mtk is not None:
if mtk.config.is_brom and self.mtk.daloader.patch:
self.info("Device is in BROM mode. Trying to dump preloader.")
if preloader is None:
preloader = self.dump_preloader_ram()
else:
self.info("Device is unprotected.")
try:
if not mtk.config.loader:
if not mtk.config.is_brom:
self.mtk.preloader.reset_to_brom()
except Exception:
pass
if mtk.config.is_brom and not mtk.config.iot:
self.info("Device is in BROM-Mode. Bypassing security.")
mtk.daloader.patch = False
Expand All @@ -117,7 +117,7 @@ def configure_da(self, mtk, preloader):
if mtk is not None:
self.mtk = mtk
if preloader is None:
if self.mtk.config.chipconfig.damode != 6 and hassecurity:
if self.mtk.config.chipconfig.damode != 6 and self.mtk.config.is_brom:
self.warning(
"Device is in BROM mode. No preloader given, trying to dump preloader from ram.")
preloader = self.dump_preloader_ram()
Expand Down Expand Up @@ -183,6 +183,7 @@ def da_read(self, partitionname, parttype, filename):
self.mtk.daloader.readflash(addr=0,
length=0x16000,
filename=partfilename, parttype=parttype)
countDump += 1
continue
else:
rpartition = None
Expand Down

0 comments on commit 29341e5

Please sign in to comment.