Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bkerler committed Feb 25, 2024
1 parent 963a1b5 commit f9fe6ca
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
7 changes: 3 additions & 4 deletions mtkclient/Library/DA/legacy/dalegacy_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,9 +564,9 @@ def upload_da1(self):
else:
self.daconfig.da2 = da2[:hashlen] + da2[hashlen:hashlen + da2sig_len]
else:
self.daconfig.da2 = da2[:-da2sig_len]
self.daconfig.da2 = da2
else:
self.daconfig.da2 = da2[:-da2sig_len]
self.daconfig.da2 = da2
if self.mtk.preloader.send_da(da1address, da1size, da1sig_len, da1):
if self.mtk.preloader.jump_da(da1address):
sync = self.usbread(1)
Expand Down Expand Up @@ -779,7 +779,6 @@ def shutdown(self, async_mode: int = 0, dl_bit: int = 0, bootmode: ShutDownModes

def brom_send(self, dasetup, dadata, stage, packetsize=0x1000):
# offset = dasetup.da_loader.region[stage].m_buf
# dasize = len(dadata)
size = dasetup.da_loader.region[stage].m_len
address = dasetup.da_loader.region[stage].m_start_addr
self.usbwrite(pack(">I", address))
Expand All @@ -792,7 +791,7 @@ def brom_send(self, dasetup, dadata, stage, packetsize=0x1000):
buffer = self.usbread(1)
if buffer != self.Rsp.ACK:
self.error(
f"Error on sending brom stage {stage} addr {hex(pos)}: " + hexlify(buffer).decode('utf-8'))
f"Error on sending brom stage {stage} addr {hex(address+pos)}: " + hexlify(buffer).decode('utf-8'))
self.config.set_gui_status(self.config.tr("Error on sending brom stage"))
break
time.sleep(0.5)
Expand Down
4 changes: 2 additions & 2 deletions mtkclient/Library/DA/legacy/extension/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ def generate_keys(self):
base = 0x122000
else:
base = 0x100000
data = b"".join([pack("<I", val) for val in self.readmem(0x111418EC, 0x20000 // 4)])
print(data.hex())
#data = b"".join([pack("<I", val) for val in self.readmem(0x111418EC, 0x20000 // 4)])
#print(data.hex())
sys.stdout.flush()
if self.config.meid is None:
try:
Expand Down
5 changes: 4 additions & 1 deletion mtkclient/Library/DA/mtk_da_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ def configure_da(self, mtk, preloader):
if preloader is None:
preloader = self.dump_preloader_ram()
else:
self.info("Device is unprotected.")
if mtk.config.target_config["sbc"]:
self.info("Device is protected.")
else:
self.info("Device is unprotected.")
if mtk.config.is_brom and not mtk.config.iot:
self.info("Device is in BROM-Mode. Bypassing security.")
mtk.daloader.patch = False
Expand Down
4 changes: 4 additions & 0 deletions mtkclient/Library/DA/xflash/extension/xflash.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ def patch_da2(self, da2):
huawei = find_binary(da2, b"\x01\x2B\x03\xD1\x01\x23", pos)
if huawei is not None:
da2patched[huawei:huawei + 4] = b"\x00\x00\x00\x00"
# Patch oppo security mt6765
oppo = find_binary(da2, b"\x01\x4B\x18\x78\x70\x47")
if oppo is not None:
da2patched[oppo:oppo + 4] = b"\x4F\xF0\x01\x00"
# Patch oppo security
oppo = 0
pos = 0
Expand Down

0 comments on commit f9fe6ca

Please sign in to comment.