Compare commits

..

No commits in common. "c33522ba5d47214e7c760cab85c4b2014b6e5ced" and "2fc9aa36c31fbf4b8694a077da57c46726eb51d6" have entirely different histories.

5 changed files with 6 additions and 13 deletions

View file

@ -204,10 +204,6 @@ python mtk.py --stock
```bash ```bash
python mtk.py script run.example python mtk.py script run.example
``` ```
or
```
python mtk.py multi "cmd1;cmd2"
```
See the file "[run.example](https://github.com/bkerler/mtkclient/blob/main/run.example)" on how to structure the script file See the file "[run.example](https://github.com/bkerler/mtkclient/blob/main/run.example)" on how to structure the script file
### Root the phone (Tested with android 9 - 12) ### Root the phone (Tested with android 9 - 12)

6
mtk.py
View file

@ -38,7 +38,7 @@ cmds = {
"plstage": "Run stage2 payload via preloader mode (send_da)", "plstage": "Run stage2 payload via preloader mode (send_da)",
"da": "Run da xflash/legacy special commands", "da": "Run da xflash/legacy special commands",
"script": "Run multiple commands using text script", "script": "Run multiple commands using text script",
"multi": 'Run multiple commands using a semicolon-separated list (enclose list in quotes)' "multi": 'Run multiple commands using a comma-separated list (enclose list in quotes)'
} }
@ -53,8 +53,8 @@ def main():
'gettargetconfig, peek, stage, plstage, da, script\n') 'gettargetconfig, peek, stage, plstage, da, script\n')
parser_script = subparsers.add_parser("script", help="Run text script") parser_script = subparsers.add_parser("script", help="Run text script")
parser_multi = subparsers.add_parser("multi", help='Run multiple commands using a semicolon-separatedlist (enclose list in quotes)') parser_multi = subparsers.add_parser("multi", help='Run multiple commands using a comma-separated list (enclose list in quotes)')
parser_multi.add_argument('commands', help='semicolon-separated list of commands to run') parser_multi.add_argument('commands', help='Comma-separated list of commands to run')
parser_printgpt = subparsers.add_parser("printgpt", help="Print GPT Table information") parser_printgpt = subparsers.add_parser("printgpt", help="Print GPT Table information")

View file

@ -8,8 +8,6 @@ import sys
from binascii import hexlify from binascii import hexlify
from struct import pack, unpack from struct import pack, unpack
from Cryptodome.Util.number import long_to_bytes
from mtkclient.Library.Auth.sla import generate_da_sla_signature from mtkclient.Library.Auth.sla import generate_da_sla_signature
from mtkclient.Library.DA.xflash.xflash_flash_param import NandExtension from mtkclient.Library.DA.xflash.xflash_flash_param import NandExtension
from mtkclient.Library.DA.xflash.xflash_param import Cmd, ChecksumAlgorithm, FtSystemOSE, DataType from mtkclient.Library.DA.xflash.xflash_param import Cmd, ChecksumAlgorithm, FtSystemOSE, DataType
@ -1144,7 +1142,7 @@ class DAXFlash(metaclass=LogBase):
rsakey = None rsakey = None
from mtkclient.Library.Auth.sla_keys import da_sla_keys from mtkclient.Library.Auth.sla_keys import da_sla_keys
for key in da_sla_keys: for key in da_sla_keys:
if da2.find(long_to_bytes(key.n)) != -1: if da2.find(bytes.fromhex(key.n)) != -1:
rsakey = key rsakey = key
break break
if rsakey is None: if rsakey is None:

View file

@ -7,7 +7,6 @@ from struct import pack, unpack
from queue import Queue from queue import Queue
from threading import Thread from threading import Thread
from Cryptodome.Util.number import long_to_bytes
from Cryptodome.Cipher import PKCS1_OAEP from Cryptodome.Cipher import PKCS1_OAEP
from Cryptodome.Hash import SHA256 from Cryptodome.Hash import SHA256
from Cryptodome.PublicKey import RSA from Cryptodome.PublicKey import RSA
@ -625,7 +624,7 @@ class DAXML(metaclass=LogBase):
from mtkclient.Library.Auth.sla_keys import da_sla_keys, SlaKey from mtkclient.Library.Auth.sla_keys import da_sla_keys, SlaKey
for key in da_sla_keys: for key in da_sla_keys:
if isinstance(key, SlaKey): if isinstance(key, SlaKey):
if da2.find(long_to_bytes(key.n)) != -1: if da2.find(bytes.fromhex(key.n)) != -1:
rsakey = key rsakey = key
if rsakey is None: if rsakey is None:
print("No valid sla key found, using dummy auth ....") print("No valid sla key found, using dummy auth ....")

View file

@ -415,7 +415,7 @@ class Main(metaclass=LogBase):
self.close() self.close()
elif cmd == "multi": elif cmd == "multi":
# Split the commands in the multi argument # Split the commands in the multi argument
commands = self.args.commands.split(';') commands = self.args.commands.split(',')
# DA / Flash commands start here # DA / Flash commands start here
try: try:
preloader = self.args.preloader preloader = self.args.preloader