This repository was archived by the owner on Oct 28, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.py
More file actions
125 lines (101 loc) · 4.28 KB
/
Copy pathscript.py
File metadata and controls
125 lines (101 loc) · 4.28 KB
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
import tkinter as tk
from tkinter import messagebox, scrolledtext
import subprocess
import os
def check_adb():
try:
result = subprocess.run(["adb", "devices"], capture_output=True, text=True)
if "List of devices" in result.stdout:
return True
else:
return False
except FileNotFoundError:
return False
def check_adb():
try:
result = subprocess.run(["adb", "devices"], capture_output=True, text=True)
if "List of devices" in result.stdout:
return True
else:
return False
except FileNotFoundError:
return False
def reboot_bootloader():
try:
result = subprocess.run(["adb", "reboot", "bootloader"], capture_output=True, text=True)
if "List of devices" in result.stdout:
return True
else:
return False
except FileNotFoundError:
return False
def flashing_3():
try:
result = subprocess.run(["fastboot", "flash", 'vendor_boot'], capture_output=True, text=True)
if "Successful" in result.stdout:
return True
else:
return False
except FileNotFoundError:
return False
def flashing_2():
try:
result = subprocess.run(["fastboot", "flash", "dtbo"], capture_output=True, text=True)
if "Successful" in result.stdout:
return True
else:
return False
except FileNotFoundError:
return False
def flashing_1():
try:
result = subprocess.run(["fastboot", "flash", "boot"], capture_output=True, text=True)
if "Successful" in result.stdout:
return True
else:
return False
except FileNotFoundError:
return False
def check_device():
output = run_adb_command("devices")
text_output.insert(tk.END, f":\n{output}\n")
def reboot_device():
output = run_adb_command("reboot")
text_output.insert(tk.END, "Rebooting...\n")
def take_screenshot():
screenshot_path = "Screenshot.png"
run_adb_command(f"exec-out screencap -p > {screenshot_path}")
text_output.insert(tk.END, f"Скриншот сохранён: {os.path.abspath(screenshot_path)}\n")
def install_apk():
output = run_adb_command(f" {file_path}")
text_output.insert(tk.END, f"Установка APK:\n{output}\n")
root = tk.Tk()
root.title("ADB GUI Tool")
root.geometry("500x400")
if not check_adb():
messagebox.showerror("Ошибка", "ADB не найден! Убедитесь, что он установлен и добавлен в PATH.")
root.destroy()
exit()
text_output = scrolledtext.ScrolledText(root, wrap=tk.WORD, width=60, height=15)
text_output.pack(pady=10)
button_frame = tk.Frame(root)
button_frame.pack(pady=20)
btn_check = tk.Button(button_frame, text="ADB devices", command=check_device)
btn_check.grid(row=0, column=0, padx=5)
btn_check = tk.Button(button_frame, text="Reboot to Bootloader", command=check_device)
btn_check.grid(row=3, column=0, padx=5)
btn_check = tk.Button(button_frame, text="Fastboot devices", command=check_device)
btn_check.grid(row=0, column=0, padx=5)
btn_reboot = tk.Button(button_frame, text="Flash boot", command=reboot_device)
btn_reboot.grid(row=0, column=1, padx=5)
btn_screenshot = tk.Button(button_frame, text="Flash dtbo", command=take_screenshot)
btn_screenshot.grid(row=0, column=2, padx=5)
btn_install = tk.Button(button_frame, text="Flash vendor_boot", command=install_apk)
btn_install.grid(row=0, column=3, padx=5)
btn_install = tk.Button(button_frame, text="Reboot to recovery", command=install_apk)
btn_install.grid(row=0, column=3, padx=5)
btn_install = tk.Button(button_frame, text="Sideload frimware", command=install_apk)
btn_install.grid(row=3, column=3, padx=5)
btn_install = tk.Button(button_frame, text="Reboot", command=install_apk)
btn_install.grid(row=3, column=1, padx=5)
root.mainloop()