ios沙箱软件,从Mac命令行访问iOS应用程序目录(沙箱)

本文探讨了如何在没有GUI的情况下,通过命令行从Mac或Linux访问安装在iOS设备上的应用程序的沙盒目录。主要需求包括检查特定bundle ID的应用是否已安装、创建Library/Caches目录、复制和获取JSON文件。由于iFunBox等图形工具不适用,作者尝试了libimobiledevice库及相关工具,如iFuse、idevicesyslog和ideviceinstaller,但遇到了一些挑战,如应用目录名的随机性、iFuse的限制和软件的bug。解决方案涉及使用修改版的iFuse来访问Library目录,并可能通过脚本模拟新安装以选择最近修改的应用目录。然而,这种方法存在一定的局限性和复杂性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

I need to access the sandbox directory for an application installed on an iOS device, using the command line (non-gui) from a Mac or Linux. This is to help with development and testing automation. Dropping a json file into the sandbox lets me set parameters like extra debug messages and smaller refresh intervals.

A tool like iFunBox works perfectly but is graphical only, requiring numerous clicks to do this. Emails to the developers were unanswered. It also does not support AppleScript. I did find another app that provided a Fuse module, but it turned out buggy especially if the app was uninstalled and then reinstalled (in order to reset back to first time user experience). I reported the problems to the developer but there is no fix on the horizon.

The things I need to do are:

Test if an app with a specific bundle id is installed

Create Library/Caches/MYLIBNAME directory if it doesn't exist

Copy a ~100 byte json file from the Mac to that directory

Get a copy of that file

A solution that only works from Linux is acceptable too

Devices are not jailbroken and I would prefer not to need that as a requirement

In some cases I do not have the source code to the app since it is a third party using my library, so compiling different versions of the app isn't practical.

Answer is below in many comments thanks to lxt. Summary is:

Various libraries and programs associated with libimobiledevice can solve the problems

Use patched iFuse to mount an application sandbox

Use idevicesyslog to see the console log

Use ideviceinstaller to install/uninstall apps

The various libraries and programs associated with libimobiledevice are incredibly difficult if not impossible to compile as is on Linux or Mac, and there is no unified distribution of the source or binaries

For Ubuntu try libimobiledevice (may have 3 suffix), ideviceinstaller and libimobiledevice-utils packages

For Mac a search for libimobiledevice-macosx may get you some of the way there

解决方案

This is going to be a little tricky, because as I think you've found out the application name is randomly generated on every install. I don't think there is a way past that, certainly that I know of. This explains the problems you're running into when simulating a new install (...the app directory name changes to a new, random hash, and then you're stuck).

Although my preference would be to access this config file in some other way (perhaps over a network, and have some code that only executes on debug/test builds check for it), if you did want to do this then I'd suggest trying something like writing a script that when you want to simulate a new install chooses the app directory that's most recently modified. But this is very hacky.

If you're not able to insert conditional code that only executes on debug/ test builds then I think the random app naming schema that iOS uses at a file system level is going to be problematic for you whatever approach you take.

Update: Regarding iFuse and libimobiledevice - out of the box it limits you to the documents directory. This is because the authors of iFuse don't entry-level users to be confused, and also because the structure is a little different depending on iOS version. You can comment out the lines in the iFuse source - fuse_opt_add_arg(&args, "-osubdir=Documents"); - to get access to the library directory through the mount. You will obviously need to re-compile iFuse yourself if doing this.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值