-
Notifications
You must be signed in to change notification settings - Fork 0
/
zz_undo.py
39 lines (28 loc) · 939 Bytes
/
zz_undo.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
#!/usr/bin/env python3
# undo proxy
import asyncio
import uiautomator2 as u2
from ppadb.client import Client as AdbClient
import sys
import subprocess
# serial = input("Enter comment device serial port 127.0.0.1: ")
serial = sys.argv[1] # 127.0.0.1:6555
def start_ui(serial):
# atx
d = u2.connect(serial) # print(d.info)
d.uiautomator.start()
# d.app_start("com.github.uiautomator")
# d(resourceId="com.github.uiautomator:id/start_uiautomator").click()
# proxy
# d.shell("settings put global http_proxy localhost:3333")
d.shell("settings put global http_proxy :0")
# subprocess.run(f"adb -s {serial} reverse tcp:3333 tcp:8082", shell=True, check=True)
subprocess.run(f"adb -s {serial} reverse --remove tcp:3333", shell=True, check=True)
def main():
try:
start_ui(serial)
except Exception as error:
print(error)
pass
if __name__ == "__main__":
main()