Minor fixes

This commit is contained in:
Bjoern Kerler 2024-02-25 12:10:20 +01:00
parent 963a1b52d8
commit f9fe6ca65c
No known key found for this signature in database
GPG key ID: A3E0FAF79F2F4578
4 changed files with 13 additions and 7 deletions

View file

@ -564,9 +564,9 @@ class DALegacy(metaclass=LogBase):
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)
@ -779,7 +779,6 @@ class DALegacy(metaclass=LogBase):
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))
@ -792,7 +791,7 @@ class DALegacy(metaclass=LogBase):
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)

View file

@ -227,8 +227,8 @@ class legacyext(metaclass=LogBase):
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:

View file

@ -105,7 +105,10 @@ class DA_handler(metaclass=LogBase):
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

View file

@ -200,6 +200,10 @@ class xflashext(metaclass=LogBase):
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