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

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

首先先介绍一下pymobiledevice3,

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

【安装】

git clone git@github.com: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"

相关推荐
北京自在科技36 分钟前
苹果折叠屏iPhone突破折痕难题 或将在2026年发布
ios·iphone·findmy·折叠屏·库克
一粒沙-37 分钟前
iOS 将GIF图分享至微信
前端·ios
Mamong11 小时前
Metal 学习笔记三:渲染管线
ios·swift·metal
yidahis15 小时前
用DeepSeek学源码-SDImageCodersManager 中的工厂模式解析
ios·源码
xinyu39118 小时前
iOS Framework代码中加载图片资源
macos·ios·cocoa
键盘敲没电18 小时前
【iOS】小蓝书学习(四)
学习·ios·cocoa
键盘敲没电1 天前
【iOS】小蓝书学习(二)
学习·ios·cocoa
黄毛火烧雪下2 天前
将 iOS 项目打包并运行到真实的 iPhone 设备
ios·iphone
后端常规开发人员2 天前
iOS手机App爬虫- (1) Mac安装Appium真机运行环境
爬虫·ios·appium
DeMonnnnnn2 天前
Flutter-升级Xcode后构建iOS报错
flutter·ios·xcode