Skip to content

Commit

Permalink
Restructure and minor bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bkerler committed Jun 29, 2024
1 parent a39e0f0 commit f13dbd0
Show file tree
Hide file tree
Showing 23 changed files with 10 additions and 7 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 4 additions & 1 deletion mtkclient/Tools/da_parser.py → Tools/da_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from struct import unpack
import inspect
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parent_dir = os.path.dirname(os.path.dirname(current_dir))
parent_dir =os.path.dirname(current_dir)
sys.path.insert(0, parent_dir)
from mtkclient.config.payloads import PathConfig
from mtkclient.Library.utils import read_object
Expand Down Expand Up @@ -92,6 +92,9 @@ def main():
with open(loader, "rb") as rf:
rf.seek(mbuf)
data = rf.read(m_len)
test=data.find(b"\x08\x00\xa8\x52\xff\x02\x08\xeb")
if test != -1:
print("Device is patched against carbonara :(")
hashidx = data.find(int.to_bytes(0xC0070004, 4, 'little'))
if hashidx != -1:
print("Hash check found.")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def send_usb_response(regs):


def main():
pfilename = os.path.join("..", "Loader", "Preloader", "preloader_k71v1_64_bsp.bin")
pfilename = os.path.join("../mtkclient", "Loader", "Preloader", "preloader_k71v1_64_bsp.bin")
payload = open(pfilename, "rb").read()

mu = Uc(UC_ARCH_ARM, UC_MODE_THUMB)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

def main():
loaders = []
for root, dirs, files in os.walk(".", topdown=False):
for root, dirs, files in os.walk("", topdown=False):
for file in files:
loaders.append(os.path.join(root, file))

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added Tools/payload.bin
Binary file not shown.
Binary file added Tools/payload.bin.idb
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions mtkclient/Library/DA/mtk_daloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def writestate(self):
config["socid"] = hexlify(self.config.socid).decode('utf-8')
config["flashtype"] = self.daconfig.flashtype
config["flashsize"] = self.daconfig.flashsize
if (not self.mtk.config.chipconfig.damode == DAmodes.XFLASH and not
self.mtk.config.chipconfig.damode == DAmodes.XML):
if (not self.mtk.config.chipconfig.damode == DAmodes.XFLASH and
not self.mtk.config.chipconfig.damode == DAmodes.XML):
config["m_emmc_ua_size"] = self.da.emmc.m_emmc_ua_size
config["m_emmc_boot1_size"] = self.da.emmc.m_emmc_boot1_size
config["m_emmc_boot2_size"] = self.da.emmc.m_emmc_boot2_size
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ Issues = "https://github.com/bkerler/mtkclient/issues"
[project.scripts]
mtk = "mtk:main"
stage2 = "stage2:main"
da_parser = "mtkclient.Tools.da_parser:main"
brom_to_offs = "mtkclient.Tools.brom_to_offs:main"
da_parser = "Tools.da_parser:main"
brom_to_offs = "Tools.brom_to_offs:main"

[project.gui-scripts]
mtk_gui = "mtkclient.mtk_gui:main"
Expand Down

0 comments on commit f13dbd0

Please sign in to comment.