mirror of
https://github.com/bkerler/mtkclient.git
synced 2024-11-14 19:25:05 -05:00
Compare commits
7 commits
2fc9aa36c3
...
c33522ba5d
Author | SHA1 | Date | |
---|---|---|---|
|
c33522ba5d | ||
|
236db70e9f | ||
|
798696990a | ||
|
4e95d315c5 | ||
|
2a8131d881 | ||
|
2e70acc705 | ||
|
485e1e911d |
5 changed files with 13 additions and 6 deletions
|
@ -204,6 +204,10 @@ 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
6
mtk.py
|
@ -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 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')
|
'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 comma-separated list (enclose list in quotes)')
|
parser_multi = subparsers.add_parser("multi", help='Run multiple commands using a semicolon-separatedlist (enclose list in quotes)')
|
||||||
parser_multi.add_argument('commands', help='Comma-separated list of commands to run')
|
parser_multi.add_argument('commands', help='semicolon-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")
|
||||||
|
|
|
@ -8,6 +8,8 @@ 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
|
||||||
|
@ -1142,7 +1144,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(bytes.fromhex(key.n)) != -1:
|
if da2.find(long_to_bytes(key.n)) != -1:
|
||||||
rsakey = key
|
rsakey = key
|
||||||
break
|
break
|
||||||
if rsakey is None:
|
if rsakey is None:
|
||||||
|
|
|
@ -7,6 +7,7 @@ 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
|
||||||
|
@ -624,7 +625,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(bytes.fromhex(key.n)) != -1:
|
if da2.find(long_to_bytes(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 ....")
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue