|
|
@@ -1,22 +1,41 @@
|
|
|
-import time
|
|
|
+import subprocess
|
|
|
+from time import sleep
|
|
|
from pymobiledevice3.lockdown import create_using_usbmux
|
|
|
from pymobiledevice3.services.dvt.instruments.process_control import ProcessControl
|
|
|
from pymobiledevice3.services.installation_proxy import InstallationProxyService
|
|
|
from pymobiledevice3.services.dvt.dvt_secure_socket_proxy import DvtSecureSocketProxyService
|
|
|
from pymobiledevice3.services.remote_fetch_symbols import RemoteService
|
|
|
+from pymobiledevice3.remote.remote_service_discovery import RemoteServiceDiscoveryService
|
|
|
import threading
|
|
|
|
|
|
BUNDLE_ID = 'com.laiwang.DingTalk'
|
|
|
|
|
|
-def channel():
|
|
|
+# def channel():
|
|
|
# pymobiledevice3 remote start-tunnel
|
|
|
- while True:
|
|
|
- RemoteService.connect()
|
|
|
+ # while True:
|
|
|
+ # # RemoteService.connect()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
try:
|
|
|
# 启动隧道服务线程
|
|
|
-
|
|
|
+ remoteServvice = RemoteService(RemoteServiceDiscoveryService(('127.0.0.1',7777)),'test')
|
|
|
+ remoteServvice.connect()
|
|
|
+ # 使用命令方式启动管道
|
|
|
+ # try:
|
|
|
+ # # 使用 -S 参数让 sudo 从 stdin 读取密码
|
|
|
+ # result = subprocess.run(
|
|
|
+ # ["sudo", "-S"] + "pymobiledevice3 remote start-tunnel".split(),
|
|
|
+ # input="d123456\n", # 实际应用中应从安全来源获取
|
|
|
+ # text=True,
|
|
|
+ # capture_output=True,
|
|
|
+ # check=True
|
|
|
+ # )
|
|
|
+ # print("命令执行成功!")
|
|
|
+ # print("输出:", result.stdout)
|
|
|
+ # except subprocess.CalledProcessError as e:
|
|
|
+ # print(f"命令执行失败 (退出码: {e.returncode}):")
|
|
|
+ # print("错误输出:", e.stderr)
|
|
|
+ sleep(3)
|
|
|
# 连接手机
|
|
|
lockdown = create_using_usbmux()
|
|
|
print("开发者模式",lockdown.developer_mode_status)
|