pymobiledevice3使用介绍(安装、常用命令、访问iOS沙盒目录)

项目地址:https://github.com/doronz88/pymobiledevice3

首先先介绍一下pymobiledevice3,

pymobiledevice3是用Python3 实现的,用于处理 iDevices(iPhone 等)。它可以跨平台使用,支持:windows、Linux、macOS。

【安装】

git clone [email protected]:doronz88/pymobiledevice3.git

cd pymobiledevice3

python3 -m pip install -U -e .

【常用命令】

pymobiledevice3提供的命令如下:

1、查看iOS设备的udid:pymobiledevice3 usbmux list

这个命令类似于idb的 idb list-targets和libimobiledevice的 idevice_id -l:

2、查看app的bundle id,通过输入命令:

pymobiledevice3 apps list --udid f89d929e8c45a81c0fe2d2xxxxxxxxxxxxxxxxxxxf

可以查看手机安装app的info.plist中的部分信息,如:

这个命令类似于idb的 list-apps,

idb list-apps --udid f89d929e8c45a81c0fe2d2xxxxxxxxxxxxxxxxf

类似于libimobiledevice的ideviceinstaller -u f89d929e8c45a81c0fe2d2xxxxxxxxxxxxxxxf -l

3、安装应用:

pymobiledevice3 apps install /Users/testmanzhang/Downloads/axxx_app_ios_internal_global_debug_3.x.x.xxxx.ipa

这个命令类似于idb的install,

idb install /Users/testmanzhang/Downloads/axxx_app_ios_internal_global_debug_x.x.x.xxxx.ipa

类似于libimobiledevice的ideviceinstaller,

ideviceinstaller -i /Users/testmanzhang/Downloads/axxx_app_ios_internal_global_debug_x.x.x.xxxx.ipa

4、卸载应用:

pymobiledevice3 apps uninstall com.xxxxxxx.ios

类似于idb的uninstall,idb uninstall com.xxxxxx.ios

类似于libimobiledevice的ideviceinstaller,

ideviceinstaller -U com.xxxxxxx.ios

5、查看系统日志:

pymobiledevice3 syslog collect /Users/testmanzhang/Downloads/11111.logarchive

生成的日志文件到达948M后收集停止,在mac上使用console.app打开查看

这个命令类似于idb log、libimobiledevice的idevicesyslog

6、重启设备命令:pymobiledevice3 diagnostics restart

7、截图命令:pymobiledevice3 developer screenshot /Users/testmanzhang/Downloads/2222.png

8、访问应用的沙盒目录:pymobiledevice3 apps afc com.xxxxxxx.ios,

启动的是xonsh-afc shell,它是在xonsh的基础上增加了afc,即Apple File Conduit。

进入shell后界面如下:

它提供的命令有:

例如,ls,显示的就是iOS对应应用ios.glazero.ios的沙盒目录:

例如,cd进入Documents/Logs目录,可以将目录下的文件拉取到本地:

pull xxxxxx_app_ios_20241014.log /Users/testmanzhang/Downloads

也可以使用cat和grep查看该日志文件

cat xxxxxx_app_ios_20241014.log | grep "addDpUpdateDelegate"

相关推荐
Digitally3 小时前
如何将数据从安卓设备传输到 iPhone | 综合指南
android·ios·iphone
Pitayafruit5 小时前
写给尊贵的 Tare Pro 用户的喂饭级 IOS APP 开发指南
ios·ai编程·trae
openinstall18 小时前
A/B测试如何借力openinstall实现用户价值深挖?
android·ios·html
二流小码农18 小时前
鸿蒙开发:资讯项目实战之项目初始化搭建
android·ios·harmonyos
Hierifer1 天前
跨端实现 DSBridge 源码解析
前端·ios
CocoaKier1 天前
你的开发者账号已经被盯上了,如何区分钓鱼邮件
ios·google·apple
程序员小刘1 天前
鸿蒙跨平台开发:打通安卓、iOS生态
android·ios·harmonyos
大熊猫侯佩1 天前
SwiftUI 5.0(iOS 17.0,macOS 14.0+)新 Inspector 辅助视图之趣味漫谈
macos·ios·swiftui
二流小码农2 天前
鸿蒙开发:资讯项目实战之项目框架设计
android·ios·harmonyos