-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.py
123 lines (106 loc) · 3.94 KB
/
main.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
# coding:utf-8
'''
Target: Python AndroidToolBox Main Interactive Module
Author: LZR@BUAA
Date: 08/27/2020
'''
import FastbootFlash
import FileBackUp
import FileTrans
import Screen
import SoftScript
from Methods import *
MobileInfo = {}
def mainmenu():
while True:
os.system("cls")
printmenu()
op1 = input()
while op1 not in ['1','2','3','4','5','6','7','8','9','0']:
print("输入有误,请重新输入")
op1 = input()
op = int(op1)
if op == 1:
printinfo()
elif op == 2:
Screen.Screenmain()
elif op == 3:
FastbootFlash.Flashmain()
elif op == 4:
FileTrans.FileTransmain()
elif op == 5:
FileBackUp.FileBackupmain()
elif op == 6:
SoftScript.Softmain()
elif op == 7:
rebootList()
elif op == 8:
os.startfile(os.getcwd()+"//README.html")
elif op == 9:
printcmd()
sys.exit()
elif op == 0:
print("感谢使用!再见!")
sys.exit()
def printcmd():
os.system("cls")
os.system("runincmd.bat")
# print(" adb和fastbooot 工具")
# print("-----------------------------------------")
# print(" adb和fastboot命令示例")
# print(" adb命令:")
# print(" adb devices :列出adb设备")
# print(" adb reboot :重启设备")
# print(" adb reboot bootloader :重启到fastboot模式")
# print(" adb reboot recovery :重启到recovery模式")
# print(" adb reboot edl :重启到edl模式")
# print("")
# print(" fastboot命令:")
# print(" fastboot devices :列出fastboot设备")
# print(" fastboot reboot :重启设备")
# print(" fastboot reboot-bootloader :重启到fastboot模式")
# print(" fastboot flash <分区名称> <镜像文件名> :刷写分区")
# print(" fastboot oem reboot-<模式名称> :重启到相应模式")
# print(" fastboot oem device-info :查看解锁状态")
# print("-----------------------------------------")
def printHello():
print(cmd("type logo.txt"))
time.sleep(2)
os.system("cls")
print("###############################################")
print(" Android Tool Box")
print(" 安卓极客工具箱")
print(" Ver:1.0")
print(" Author:LZR@BUAA")
print(" 2020.8")
print("###############################################")
print("提醒:使用前请确保安卓手机的\"USB调试\"功能已开启\n仅在MIUI上测试通过 其他各厂商设备不保证全部可用")
# print(cmd("type mainhead.txt"))
def printinfo():
os.system("cls")
print("+----------设备信息----------+")
print("手机型号:"+MobileInfo['model'])
print("制造商:"+MobileInfo['brand'])
print("安卓版本:" + MobileInfo['android']+"(API"+MobileInfo['API']+")")
print("剩余电量:"+MobileInfo['battery'])
input("按Enter返回主菜单\n")
# os.system("cls")
def printmenu():
print("+-----------主菜单-----------+")
print("[1]设备信息\t[2]投屏工具\n[3]刷机工具\t[4]文件快传\n[5]备份还原\t[6]软件工具\n[7]高级重启\t[8]关于项目\n[9]命令模式\t[0]退出程序")
print("请选择-> ", end='')
if __name__ == "__main__":
printHello()
print("\n等待连接手机……")
if BLConnected():
print("当前为Fastboot模式,即将重启到系统……")
rebootUI()
time.sleep(5)
while True:
if USBConnected():
MobileInfo = getInfo()
print("设备: "+MobileInfo['brand'] + " " +
MobileInfo['model'] + " (API" + MobileInfo['API'] + ") 已连接")
break
time.sleep(2)
mainmenu()