安装新的 IPSW 后越狱能否继续存在?
我在 iPad 1 上遇到了一个现象。它运行的是 4.3.2,并且对其进行了越狱。 后来更新到4.3.5,仍在运行。
我编写了一个小测试应用程序,看看是否可以检测到越狱设备。我使用的测试是:
- 使用 [NSFileManager fileExists] 检查 /private/var/lib/apt 是否存在
- 使用 [NSFileManager fileExists] 检查 /Applications/Cydia.app 是否存在
这个想法是:在未越狱的设备上,在这两种情况下,访问都会失败,因为应用程序无法脱离其沙箱。如果任一测试返回“是”,我就假设越狱了。我在几个未损坏的设备上对此进行了测试,但都无法访问。我也在越狱的iPhone 3GS上测试过,两者都可以访问。
我尝试了4.3.5的iPad 1,没有安装Cydia,所以第二次检查显然失败了,但第一次检查通过了! fileExists 对“/private/var/lib/apt”返回 YES!这怎么可能?有人能解释一下吗?
I have a phenomenon here on an iPad 1. It was running 4.3.2 and a jailbreak was applied to it.
Later it has been updated to 4.3.5 which it is still running.
I wrote a little test app to see if I can detect a jailbroken device. The tests I use are:
- Use [NSFileManager fileExists] to check if /private/var/lib/apt exists
- Use [NSFileManager fileExists] to check if /Applications/Cydia.app exists
The idea is: on a device that is not jailbroken, access will fail in both cases as the app cannot reach out of its sandbox. If either test returns YES, I assume a jailbreak. I tested this on a couple of unbroken devices and neither can be accessed. I also tested on a jailbroken iPhone 3GS and both can be accessed.
The I tried the iPad 1 with 4.3.5 and there is no Cydia installed, so the 2nd check obviously failed but the first one passed! fileExists returns YES for "/private/var/lib/apt"! How is that possible? Can anybody explain?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我无法完全解释这一点,但我也遇到过类似的结果。
我曾经在 iOS 3 上有一个越狱的 iPod,并将其更新到 iOS 4,再次越狱后,我在 Cydia 中的设置仍然存在。
安装新固件时,iTunes 仍然显示约 500Mb 的其他数据,因此我假设在更新过程中并非所有内容都被覆盖/删除。
I can't completely explain this but I've come across similar results.
I used to have a jailbroken iPod on iOS 3 and updated it to iOS 4, after jailbreaking again my settings in Cydia were still present.
When installing a new firmware iTunes still shows ~500Mb of other data, so I'm assuming not everything gets overwritten / deleted during the update.
实际上,让我解释一下为什么以及如何工作:
iPhone/任何 iOS 设备都有 2 个独立的分区:
/dev/disk0s1 安装在 /(大约 1GB),根分区:
它包含操作系统(/System、/Applications、/usr、/sbin、/dev、/Library),并且默认安装为只读。
/dev/disk0s2 安装在 /private/var (其余空间),用户分区:
它包含所有用户数据(在 /private/var/mobile/ 中),例如:
应用程序、首选项
如今,所有越狱工具都会将所有应用程序等从根分区移动到 /private/var/stash 以节省根分区上的空间。然后将它们从其原始位置符号链接回。
运行 iOS 更新时,用户分区大部分保持不变,仅恢复根文件系统。仅当您运行完整还原时,所有内容都会被删除。然后,iOS 将动态重新创建 /private/var 文件系统。
但请不要使用此类代码,因为并非所有越狱 iOS 设备的人都是盗版应用,而你将此类代码放入你的应用中只会引诱脚本小子再次破解它。
Actually, let me explain why and how this works:
The iPhone/any iOS device has 2 separate partitions:
/dev/disk0s1 mounted at / (around 1GB), the root partition:
It contains the OS (/System, /Applications, /usr, /sbin, /dev, /Library) and is by default mounted read-only.
/dev/disk0s2 mounted at /private/var (rest of the space), the user partition:
It contains all user data (in /private/var/mobile/) like:
Applications, Preferences
Nowadays, all jailbreak tools move all Applications, etc. from the root partition into /private/var/stash to save space on the Root partition. These are then symlinked back from their original location.
When running an iOS update, the user partition is left mostly untouched, only the root filesystem is restored. Only if you run a full restore, everything is deleted. iOS will then recreate the /private/var filesystem on the fly.
But please refrain from using this kind of code, since not all of the people who have jailbroken their iOS devices are pirating apps, and you putting such code into your app will only tempt script kiddies to crack it again.