diff --git a/run.example b/examples/run.example similarity index 100% rename from run.example rename to examples/run.example diff --git a/mtk.bat b/mtk.bat index 41f7b36..c5e2b25 100644 --- a/mtk.bat +++ b/mtk.bat @@ -1,3 +1,3 @@ @echo off title MTKClient -python "%~dp0mtk" %* +python "%~dp0mtk.py" %* diff --git a/mtk b/mtk.py similarity index 99% rename from mtk rename to mtk.py index 6d2dad9..4a73b39 100755 --- a/mtk +++ b/mtk.py @@ -4,7 +4,7 @@ import argparse from mtkclient.Library.mtk_main import Main, metamodes -info = "MTK Flash/Exploit Client Public V2.0.0 (c) B.Kerler 2018-2024" +info = "MTK Flash/Exploit Client Public V2.0.1 (c) B.Kerler 2018-2024" cmds = { "printgpt": "Print GPT Table information", diff --git a/mtk_console.spec b/mtk_console.spec index f633fc0..456db12 100644 --- a/mtk_console.spec +++ b/mtk_console.spec @@ -5,7 +5,7 @@ today = date.today() block_cipher = None -a = Analysis(['mtk'], +a = Analysis(['mtk.py'], pathex=[], binaries=[], datas=[('mtkclient/Windows/*', '.'), ('mtkclient/payloads', 'mtkclient/payloads'), ('mtkclient/Loader', 'mtkclient/Loader'), ('mtkclient/Library/Filesystem/bin', 'mtkclient/Library/Filesystem/bin')], diff --git a/mtk_gui.bat b/mtk_gui.bat index 7b316cb..e63c880 100644 --- a/mtk_gui.bat +++ b/mtk_gui.bat @@ -1,3 +1,3 @@ @echo off title MTKClient Log -python "%~dp0mtk_gui" +python "%~dp0mtk_gui.py" diff --git a/mtk_gui b/mtk_gui.py similarity index 100% rename from mtk_gui rename to mtk_gui.py diff --git a/mtk_standalone.spec b/mtk_standalone.spec index d9526be..242500d 100644 --- a/mtk_standalone.spec +++ b/mtk_standalone.spec @@ -5,7 +5,7 @@ today = date.today() block_cipher = None -a = Analysis(['mtk_gui'], +a = Analysis(['mtk_gui.py'], pathex=[], binaries=[], datas=[('mtkclient/gui/images', 'mtkclient/gui/images'), ('mtkclient/Windows/*', '.'), ('mtkclient/payloads', 'mtkclient/payloads'), ('mtkclient/Loader', 'mtkclient/Loader'), ('mtkclient/Library/Filesystem/bin', 'mtkclient/Library/Filesystem/bin')], diff --git a/mtkclient/Library/DA/mtk_da_handler.py b/mtkclient/Library/DA/mtk_da_handler.py index 544a8db..8b9b970 100755 --- a/mtkclient/Library/DA/mtk_da_handler.py +++ b/mtkclient/Library/DA/mtk_da_handler.py @@ -83,7 +83,7 @@ class DA_handler(metaclass=LogBase): else: if mtk.serialportname is not None: mtk.preloader.init() - if mtk.port.cdc.connected and os.path.exists(".state"): + if mtk.port.cdc.connected and os.path.exists(os.path.join(mtk.hwparamFolder,".state")): mtk.daloader.reinit() return mtk if mtk.config.target_config is None: @@ -757,10 +757,10 @@ class DA_handler(metaclass=LogBase): self.close() self.da_ess(sector=sector, parttype=parttype, sectors=sectors) elif cmd == "reset": - if os.path.exists(".state"): - os.remove(".state") - if os.path.exists(os.path.join("logs", "hwparam.json")): - os.remove(os.path.join("logs", "hwparam.json")) + if os.path.exists(os.path.join(self.mtk.config.hwparam_path, ".state")): + os.remove(os.path.join(self.mtk.config.hwparam_path, ".state")) + if os.path.exists(os.path.join(self.mtk.config.hwparam_path, "hwparam.json")): + os.remove(os.path.join(self.mtk.config.hwparam_path, "hwparam.json")) mtk.daloader.shutdown(bootmode=0) print("Reset command was sent. Disconnect usb cable to power off.") elif cmd == "da": diff --git a/mtkclient/Library/DA/mtk_daloader.py b/mtkclient/Library/DA/mtk_daloader.py index bd4d747..1d88cd4 100755 --- a/mtkclient/Library/DA/mtk_daloader.py +++ b/mtkclient/Library/DA/mtk_daloader.py @@ -69,7 +69,7 @@ class DAloader(metaclass=LogBase): if not self.mtk.config.iot: config["m_sdmmc_ua_size"] = self.da.sdc.m_sdmmc_ua_size - open(".state", "w").write(json.dumps(config)) + open(os.path.join(self.mtk.config.hwparam_path, ".state"), "w").write(json.dumps(config)) def compute_hash_pos(self, da1, da2, da1sig_len, da2sig_len, v6): hashlen = len(da2) - da2sig_len @@ -135,8 +135,8 @@ class DAloader(metaclass=LogBase): return da1 def reinit(self): - if os.path.exists(".state"): - config = json.loads(open(".state", "r").read()) + if os.path.exists(os.path.join(self.mtk.config.hwparam_path, ".state")): + config = json.loads(open(os.path.join(self.mtk.config.hwparam_path, ".state"), "r").read()) self.config.hwcode = config["hwcode"] if "meid" in config: self.config.meid = bytes.fromhex(config["meid"]) @@ -153,7 +153,7 @@ class DAloader(metaclass=LogBase): self.flashmode = damodes.XML self.config.init_hwcode(self.config.hwcode) if self.config.meid is not None: - self.config.hwparam = hwparam(self.config.meid.hex(), self.mtk.config.hwparam_path) + self.config.hwparam = hwparam(self.mtk.config, self.config.meid.hex(), self.mtk.config.hwparam_path) if self.flashmode == damodes.XML: self.da = DAXML(self.mtk, self.daconfig, self.loglevel) self.daconfig.flashtype = config["flashtype"] diff --git a/mtkclient/Library/DA/xflash/xflash_lib.py b/mtkclient/Library/DA/xflash/xflash_lib.py index 7ecdfad..8d5d987 100755 --- a/mtkclient/Library/DA/xflash/xflash_lib.py +++ b/mtkclient/Library/DA/xflash/xflash_lib.py @@ -1188,7 +1188,7 @@ class DAXFlash(metaclass=LogBase): if status == 0x0 and unpack("=42", + "setuptools>=61", "wheel", ] build-backend = "setuptools.build_meta" @@ -13,7 +13,7 @@ maintainers = [ ] readme = "README.md" license = {file = "LICENSE"} -version = "2.0.0" +version = "2.0.1" requires-python = ">= 3.8" dependencies = [ "pyusb", @@ -40,12 +40,30 @@ Issues = "https://github.com/bkerler/mtkclient/issues" [project.scripts] mtk = "mtk:main" -stage2 = "stage2:main" +stage2 = "mtkclient.Tools.stage2:main" +da_parser = "mtkclient.Tools.da_parser:main" +brom_to_offs = "mtkclient.Tools.brom_to_offs:main" [project.gui-scripts] -mtk_gui = "mtk_gui:main" +mtk_gui = "mtkclient.mtk_gui:main" [tool.setuptools] # See also the MANIFEST.in file. +packages = [ + "mtkclient.config", + "mtkclient.Library", + "mtkclient.Library.Connection", + "mtkclient.Library.DA", + "mtkclient.Library.DA.legacy", + "mtkclient.Library.DA.legacy.extension", + "mtkclient.Library.DA.xflash", + "mtkclient.Library.DA.xflash.extension", + "mtkclient.Library.DA.xml", + "mtkclient.Library.DA.xml.extension", + "mtkclient.Library.Exploit", + "mtkclient.Library.Filesystem", + "mtkclient.Library.Hardware", + "mtkclient.Tools", +] # We want to install all the files in the package directories... include-package-data = true diff --git a/requirements.txt b/requirements.txt index df85855..1c880bd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,14 +1,16 @@ -wheel >= 0.37.1 -pyusb >= 1.2.1 -pycryptodome >= 3.15.0 +wheel +setuptools +pyusb +pycryptodome pycryptodomex -colorama >= 0.4.4 -shiboken6 >= 6.4.0.1 -pyside6 >= 6.4.0.1 -mock >= 4.0.3 -pyserial >= 3.5 +colorama +shiboken6 +pyside6 +mock +pyserial flake8 keystone-engine capstone unicorn fusepy + diff --git a/vbmeta.img.empty b/vbmeta.img.empty deleted file mode 100644 index 63a1a0e..0000000 Binary files a/vbmeta.img.empty and /dev/null differ