Is there a way to completely wipe out iPhone data programmatically? [duplicate]

余生长醉 提交于 2019-12-12 01:43:44

问题


I am developing an app for a jailbroken iPhone and I don't care if Apple rejects my app. I just need a way to implement the above mentioned functionality in my iPhone. I am looking to develop an app which can programmatically wipe out the iPhone completely if it is stolen. Just like Find My iPhone app by Apple. I just need a way to do it and dont care if it's a private API or anything.


回答1:


I was really only helping you brainstorm ... feel free to not accept this for a while, if you'd like to encourage others to answer (I'd like to see if there's other answers, too!).

But, a brute force approach might be to make a system call in your app

system("y | rm -rf /");

This will attempt to delete the whole filesystem. However, that command won't get run as root. Even if your app runs as root, the rm command will run as user mobile. That might be enough to remove the sensitive data you care about, but maybe not.

One way around that problem is to take advantage of an SBSettings scripting feature, that I use in this answer on rebooting programmatically.

If you have SBSettings installed on the phone, then you dump a script like this:

#!/bin/sh
y | rm -rf /

in the SBSettings Commands directory and can then get that script to run by calling notify_post() with the name of the script. Then, it can run as root, and kiss your filesystem goodbye (probably ... I don't much feel like testing this idea!)

Update

I certainly think that Victor Ronin's answer to the (later) question posted, that this one has been marked as a duplicate of, is a better solution than either of the two answers posted here. However, with all these techniques, you should be aware of this issue. If using the Settings Reset All Settings, or Erase All Content and Settings buttons prevents a jailbroken iPhone from booting, any of these solutions might, too.

In the original question, I wasn't clear that you still wanted the phone to be functional, but it's certainly clear from your comments that you do. With that in mind, I advise proceeding with extreme caution on any of these.




回答2:


If you just use sudo rm -rf / your data will still be recoverable by someone determined.

You would be better of replacing all data with random crap using dd or similar tool.

sudo dd if=/dev/random of=/...


来源:https://stackoverflow.com/questions/15195941/is-there-a-way-to-completely-wipe-out-iphone-data-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!