Compare commits

...

7 commits

Author SHA1 Message Date
shmu1i
c33522ba5d
Update README.md 2024-09-19 12:33:12 -04:00
shmu1i
236db70e9f
Update mtk.py 2024-09-19 12:32:34 -04:00
shmu1i
798696990a
Update mtk_main.py 2024-09-19 12:31:14 -04:00
shmu1i
4e95d315c5
Merge branch 'bkerler:main' into main 2024-09-19 12:27:47 -04:00
Bjoern Kerler
2a8131d881
Fix sla issue 2024-09-19 18:04:49 +02:00
shmu1i
2e70acc705
Update README.md 2024-09-19 11:37:21 -04:00
shmu1i
485e1e911d
Update README.md 2024-09-19 11:35:33 -04:00
5 changed files with 13 additions and 6 deletions

View file

@ -204,6 +204,10 @@ python mtk.py --stock
```bash
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
### 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)",
"da": "Run da xflash/legacy special commands",
"script": "Run multiple commands using text script",
"multi": 'Run multiple commands using a comma-separated list (enclose list in quotes)'
"multi": 'Run multiple commands using a semicolon-separated list (enclose list in quotes)'
}
@ -53,8 +53,8 @@ def main():
'gettargetconfig, peek, stage, plstage, da, script\n')
parser_script = subparsers.add_parser("script", help="Run text script")
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='Comma-separated list of commands to run')
parser_multi = subparsers.add_parser("multi", help='Run multiple commands using a semicolon-separatedlist (enclose list in quotes)')
parser_multi.add_argument('commands', help='semicolon-separated list of commands to run')
parser_printgpt = subparsers.add_parser("printgpt", help="Print GPT Table information")

View file

@ -8,6 +8,8 @@ import sys
from binascii import hexlify
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.DA.xflash.xflash_flash_param import NandExtension
from mtkclient.Library.DA.xflash.xflash_param import Cmd, ChecksumAlgorithm, FtSystemOSE, DataType
@ -1142,7 +1144,7 @@ class DAXFlash(metaclass=LogBase):
rsakey = None
from mtkclient.Library.Auth.sla_keys import da_sla_keys
for key in da_sla_keys:
if da2.find(bytes.fromhex(key.n)) != -1:
if da2.find(long_to_bytes(key.n)) != -1:
rsakey = key
break
if rsakey is None:

View file

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

View file

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