forked from Fun4Android/DroidKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoolkit.py
410 lines (378 loc) · 19.2 KB
/
toolkit.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
from tkinter import *
class AuthoriseADB:
def __init__(self, master):
frame = Frame(master)
frame.pack()
self.slogan = Button(frame,
text="Authorise ADB", bg="orange", fg="black",
command=self.write_slogan)
self.slogan.pack(side=LEFT)
def write_slogan(self):
import os
os.system("adb.exe devices")
class CustomRecovery:
def __init__(self, master):
frame = Frame(master)
frame.pack()
self.slogan = Button(frame,
text="Flash Custom Recovery", bg="pink", fg="black",
command=self.write_slogan)
self.slogan.pack(side=LEFT)
def write_slogan(self):
print("Please type the number that matches the version of twrp you want")
print("1 - TWRP 2.8.7 Testing Edition")
print("2 - TWRP 2.8.7 R2")
print("3 - TWRP 2.8.7 R3")
print("4 - TWRP 2.8.7 R4")
print("5 - TWRP 2.8.7 R5")
print("6 - TWRP 2.8.7 R7")
print("7 - TWRP 3.4.5 R1")
ask = input()
if ask == ("1"):
import os
bootloaderwaittwrp = input("please press enter when your device is in bootloader mode")
os.system("fastboot flash recovery TWRP2.8.7TESTING.img")
print("Flash Done :-)")
os.system("fastboot reboot")
elif ask == ("2"):
import os
bootloaderwaittwrp = input("please press enter when your device is in bootloader mode")
os.system("fastboot flash recovery TWRP2.8.7R2.img")
print ("Flash Done :-)")
os.system("fastboot reboot")
elif ask == ("3"):
import os
bootloaderwaittwrp = input("please press enter when your device is in bootloader mode")
os.system("fastboot flash recovery TWRP2.8.7R3.img")
print ("Flash Done :-)")
os.system("fastboot reboot")
elif ask == ("4"):
import os
bootloaderwaittwrp = input("please press enter when your device is in bootloader mode")
os.system("fastboot flash recovery TWRP2.8.7R4.img")
print ("Flash Done :-)")
os.system("fastboot reboot")
elif ask == ("5"):
import os
bootloaderwaittwrp = input("please press enter when your device is in bootloader mode")
os.system("fastboot flash recovery TWRP2.8.7R5.img")
print ("Flash Done :-)")
os.system("fastboot reboot")
elif ask == ("6"):
import os
bootloaderwaittwrp = input("please press enter when your device is in bootloader mode")
os.system("fastboot flash recovery TWRP2.8.7R7.img")
print ("Flash Done :-)")
os.system("fastboot reboot")
elif ask == ("7"):
import os
bootloaderwaittwrp = input("please press enter when your device is in bootloader mode")
os.system("fastboot flash recovery TWRP3.4.5R1.img")
print ("Flash Done :-)")
os.system("fastboot reboot")
class LollipopDowngrade:
def __init__(self, master):
frame = Frame(master)
frame.pack()
self.slogan = Button(frame,
text="Downgrade To Lollipop ", bg="light green", fg="black",
command=self.write_slogan)
self.slogan.pack(side=LEFT)
def write_slogan(self):
import os
print("please move all of the Lollipop firmware files into the moto toolkit directory (the same folder containing toolkit.py)")
print("")
ask2 = input("Please make sure usb debugging is turned on in developer settings, then type 'done' into this prompt")
if ask2 == ("done"):
import os
os.system("adb.exe reboot-bootloader")
bootloaderwait2 = input("Has your device successfully loaded bootloader mode ? please type 'yes' if it has successfully loaded")
if bootloaderwait2 == ("yes"):
confirmflash = input("Press enter to confirm you would like to downgrade your device to android marshmallow ;)")
if confirmflash == (""):
import os
os.system("@echo off")
print("Partition table has been SKIPPED")
print("Bootloader has been SKIPPED")
os.system("fastboot.exe flash logo logo.bin")
print("boot logo has been flashed")
os.system("fastboot.exe flash boot boot.img")
print("boot.img has been flashed")
os.system("fastboot.exe flash recovery recovery.img")
print("Stock marshmallow recovery has now been flashed")
os.system("fastboot.exe flash system system.img_sparsechunk.0")
print("System part 1 has been flashed")
os.system("fastboot.exe flash system system.img_sparsechunk.1")
print("System part 2 has been flashed")
os.system("fastboot.exe flash system system.img_sparsechunk.2")
print("System part 3 has been flashed")
os.system("fastboot.exe flash system system.img_sparsechunk.3")
print("System part 4 has been flashed")
os.system("fastboot.exe flash system system.img_sparsechunk.4")
print("System part 5 has been flashed")
os.system("fastboot.exe flash system system.img_sparsechunk.5")
print("System part 6 has been flashed")
os.system("fastboot.exe flash system system.img_sparsechunk.6")
print("System part 7 has been flashed")
print("system partitions successfully flashed")
os.system("fastboot.exe flash modem NON-HLOS.bin")
print("Flashed Mobile Data Connection Chip Data")
os.system("fastboot.exe erase modemst1")
os.system("fastboot.exe erase modemst2")
print("Old data erased")
os.system("fastboot.exe flash fsg fsg.mbn")
print("Flashed FSG")
os.system("fastboot.exe erase cache")
print("cache erased")
os.system("fastboot.exe erase userdata")
print("userdata partition formatted")
os.system("fastboot.exe reboot")
print("flash finished")
print("Enjoy Lollipop again!")
class LollipopInstall:
def __init__(self, master):
frame = Frame(master)
frame.pack()
self.slogan = Button(frame,
text="Reinstall Lollipop To My Device", bg="red", fg="black",
command=self.write_slogan)
self.slogan.pack(side=LEFT)
def write_slogan(self):
import os
print("DO NOT USE THIS IF YOUR DEVICE HAS PREVIOUSLY BEEN RUNNING STOCK MARSHMALLOW")
print("Please use the lollipop downgrade tool instead, so you dont brick your device ")
print("")
print("")
print("please move all of the firmware files into the moto toolkit directory (the same folder containing toolkit.py)")
print("")
ask2 = input("Please make sure usb debugging is turned on in developer settings, then type 'done' into this prompt")
if ask2 == ("done"):
import os
os.system("adb.exe reboot-bootloader")
bootloaderwait2 = input("Has your device successfully loaded bootloader mode ? please type 'yes' if it has successfully loaded")
if bootloaderwait2 == ("yes"):
confirmflash = input("Press enter to confirm you would like to reinstall Android Lollipop ;)")
if confirmflash == (""):
import os
os.system("@echo off")
os.system("fastboot.exe flash partition gpt.bin")
print("Partition table has been flashed")
os.system("fastboot.exe flash bootloader bootloader.img")
print("Bootloader has been flashed")
os.system("fastboot.exe flash logo logo.bin")
print("boot logo has been flashed")
os.system("fastboot.exe flash boot boot.img")
print("boot.img has been flashed")
os.system("fastboot.exe flash recovery recovery.img")
print("Stock marshmallow recovery has now been flashed")
os.system("fastboot.exe flash system system.img_sparsechunk.0")
print("System part 1 has been flashed")
os.system("fastboot.exe flash system system.img_sparsechunk.1")
print("System part 2 has been flashed")
os.system("fastboot.exe flash system system.img_sparsechunk.2")
print("System part 3 has been flashed")
os.system("fastboot.exe flash system system.img_sparsechunk.3")
print("System part 4 has been flashed")
os.system("fastboot.exe flash system system.img_sparsechunk.4")
print("System part 5 has been flashed")
os.system("fastboot.exe flash system system.img_sparsechunk.5")
print("System part 6 has been flashed")
os.system("fastboot.exe flash system system.img_sparsechunk.6")
print("System part 7 has been flashed")
print("system partitions successfully flashed")
os.system("fastboot.exe flash modem NON-HLOS.bin")
print("Flashed Mobile Data Connection Chip Data")
os.system("fastboot.exe erase modemst1")
os.system("fastboot.exe erase modemst2")
print("Old data erased")
os.system("fastboot.exe flash fsg fsg.mbn")
print("Flashed FSG")
os.system("fastboot.exe erase cache")
print("cache erased")
os.system("fastboot.exe erase userdata")
print("userdata partition formatted")
os.system("fastboot.exe reboot")
print("flash finished")
print("enjoy Lollipop!")
class MarshmallowInstall:
def __init__(self, master):
frame = Frame(master)
frame.pack()
self.slogan = Button(frame,
text="Flash Android Marshmallow To My Device", bg="light blue", fg="black",
command=self.write_slogan)
self.slogan.pack(side=LEFT)
def write_slogan(self):
import os
print("please move all of the firmware files into the moto toolkit directory (the same folder containing toolkit.py)")
print("")
ask2 = input("Please make sure usb debugging is turned on in developer settings, then type 'done' into this prompt")
if ask2 == ("done"):
import os
os.system("adb.exe reboot-bootloader")
bootloaderwait2 = input("Has your device successfully loaded bootloader mode ? please type 'yes' if it has successfully loaded")
if bootloaderwait2 == ("yes"):
confirmflash = input("Press enter to confirm you would like to upgrade/reinstall android marshmallow ;)")
if confirmflash == (""):
import os
os.system("@echo off")
os.system("fastboot.exe flash partition gpt.bin")
print("Partition table has been flashed")
os.system("fastboot.exe flash bootloader bootloader.img")
print("Bootloader has been flashed")
os.system("fastboot.exe flash logo logo.bin")
print("boot logo has been flashed")
os.system("fastboot.exe flash boot boot.img")
print("boot.img has been flashed")
os.system("fastboot.exe flash recovery recovery.img")
print("Stock marshmallow recovery has now been flashed")
os.system("fastboot.exe flash system system.img_sparsechunk.0")
print("System part 1 has been flashed")
os.system("fastboot.exe flash system system.img_sparsechunk.1")
print("System part 2 has been flashed")
os.system("fastboot.exe flash system system.img_sparsechunk.2")
print("System part 3 has been flashed")
os.system("fastboot.exe flash system system.img_sparsechunk.3")
print("System part 4 has been flashed")
os.system("fastboot.exe flash system system.img_sparsechunk.4")
print("System part 5 has been flashed")
os.system("fastboot.exe flash system system.img_sparsechunk.5")
print("System part 6 has been flashed")
os.system("fastboot.exe flash system system.img_sparsechunk.6")
print("System part 7 has been flashed")
print("system partitions successfully flashed")
os.system("fastboot.exe flash modem NON-HLOS.bin")
print("Flashed Mobile Data Connection Chip Data")
os.system("fastboot.exe erase modemst1")
os.system("fastboot.exe erase modemst2")
print("Old data erased")
os.system("fastboot.exe flash fsg fsg.mbn")
print("Flashed FSG")
os.system("fastboot.exe erase cache")
print("cache erased")
os.system("fastboot.exe erase userdata")
print("userdata partition formatted")
os.system("fastboot.exe reboot")
print("flash finished")
print("enjoy Marshmallow!")
class Userdata_erase:
def __init__(self, master):
frame = Frame(master)
frame.pack()
self.slogan = Button(frame,
text="Erase Android userdata", bg="light green", fg="black",
command=self.write_slogan)
self.slogan.pack(side=LEFT)
def write_slogan(self):
import os
confirm3 = input("Please turn on usb debugging in developer settings, then type 'done' here")
if confirm3 == ("done"):
os.system("adb.exe reboot-bootloader")
bootloaderwait5 = input("is your device in bootloader mode? ")
if bootloaderwait5 == ("yes"):
os.system("fastboot.exe erase userdata")
os.system("fastbot.exe reboot")
print("device userdata wipe done")
class Driver:
def __init__(self, master):
frame = Frame(master)
frame.pack()
self.slogan = Button(frame,
text="Install Motorola USB Driver", bg="pink", fg="black",
command=self.write_slogan)
self.slogan.pack(side=LEFT)
def write_slogan(self):
import os
os.system("Driver.exe")
class wireless_app_sideload:
def __init__(self, master):
frame = Frame(master)
frame.pack()
self.slogan = Button(frame,
text="Wireless APK Sideload No Root (BETA)", bg="pink", fg="black",
command=self.write_slogan)
self.slogan.pack(side=LEFT)
def write_slogan(self):
print("Welcome to the wireless apk sideloading tool")
print("This tool will require a bit of setting up, due to the fact it does not require root")
import os
adbwait = input("Please turn on usb debugging in your device settings. Please type 'done'.")
if adbwait == ("done"):
print("please connect your device to your pc via usb and unlock your device for the set up process")
print("then accept the adb connect request , and select always allow from this computer")
print("then press enter when done")
wait_enter = input("")
import os
os.system("adb.exe devices")
ask123 = input(" press enter to continue \n \n")
os.system("adb.exe tcpip 5555")
ip = input("what is the ip adddress of your phone? please type :5555 at the end of the ip address! ")
print("")
print("")
print("")
print ("adb.exe connect",ip)
print("")
print("")
print("")
com1 = input("Please remove the usb of your device and type the above command in this window now ")
os.system(com1)
os.system("pause")
print("If the above line reads connected to",ip," then you are configured correctly !")
print("Please put the apk you would like to sideload in the directory that you dowloaded Moto Toolkit in")
print("make sure the directory you place the app in contains toolkit.py(this program!)")
print("now rename the apk to app")
print("so the full filename reads app.apk (including the file extension")
renamewait = input ("press enter when done !")
os.system("adb.exe install app.apk")
print("app sideloading now !")
class RootDevice:
def __init__(self, master):
frame = Frame(master)
frame.pack()
#packs frame so viewable within app.
self.slogan = Button(frame,
text="Root Your Device(MM)", bg="orange", fg="black",
command=self.write_slogan)
#defines the design aspects of the button.
self.slogan.pack(side=LEFT)
def write_slogan(self):
import os
adbask = input("Has adb been authorised ?")
if adbask == ("yes"):
adbask = input ("")
os.system("")
os.system("adb.exe push mm-root.zip /sdcard/")
print("Please launch TWRP, and flash mm-root.zip , which should now be found on your phones memory")
class RootDeviceLP:
def __init__(self, master):
frame = Frame(master)
frame.pack()
#packs frame so viewable within app.
self.slogan = Button(frame,
text="Root Your Device(MM)", bg="orange", fg="black",
command=self.write_slogan)
#defines the design aspects of the button.
self.slogan.pack(side=LEFT)
def write_slogan(self):
import os
adbask = input("Has adb been authorised ?")
if adbask == ("yes"):
adbask = input ("")
os.system("")
os.system("adb.exe push lp-root.zip /sdcard/")
os.system("adb.exe reboot-bootlaoder")
print("Please launch TWRP, and flash lp-root.zip , which should now be found on your phones memory")
root = Tk()
root.title("Moto Toolkit Universal Edition")
root.geometry("500x500+200+200")
app = AuthoriseADB(root)
app = CustomRecovery(root)
app = LollipopDowngrade(root)
app = LollipopInstall(root)
app = MarshmallowInstall(root)
app = Userdata_erase(root)
app = Driver(root)
app = wireless_app_sideload(root)
app = RootDevice(root)
app = RootDeviceLP(root)
root.mainloop()