Apple attaches great importance to the security of its products, so it has designed a complex security mechanism for users. This makes programmers who love freedom and advocate openness extremely unhappy, so jailbreaking has become a place where Apple and hackers fight each other repeatedly. In general, jailbreaking allows us to install and share applications at will, but it does reduce the security of the device and provides a convenient door for some malicious applications. Sometimes our application wants to know whether the installed device has been jailbroken. Obviously, Apple officials will not provide a solution, so what should we do? Because cydia will be automatically installed after jailbreaking, we can start from this aspect; we can also use the permission issue to read the list of applications; we can also read environment variables, and machines that are not jailbroken should not be able to read anything. Let's talk about them one by one: 1. Determine common jailbreak files /Applications/Cydia.app /Library/MobileSubstrate/MobileSubstrate.dylib /bin/bash /usr/sbin/sshd /etc/apt This table can be listed as much as possible, and then it can be determined whether it exists. As long as it exists, it can be considered that the machine is jailbroken.
2. Determine the URL scheme of Cydia The URL scheme can be used to call out another application in an application. It is a path to a resource (see "How to Call Out Another Application in iOS" for details). This method is used to determine whether the Cydia application exists.
3. Read the names of all applications in the system This is determined by taking advantage of the fact that non-jailbroken machines do not have this permission.
4. Use the stat method to determine whether cydia exists The idea of this method is to determine the cydia application, but the method uses the stat function and also determines whether there is a dynamic library injected.
5. Read environment variables
Of course, when determining whether a device is jailbroken, you can use multiple methods to ensure accuracy. Here I would also like to say that there are official jailbreaks and non-official jailbreaks, which are not officially guaranteed, so the situation is also complicated and changeable. iOS7 has also improved and upgraded the sandbox mechanism. Some situations may not be suitable for the new version, which still needs to be handled according to the actual situation. In addition, there are some methods such as forking a child thread and looking at the return value, which are not listed here one by one. ***, jailbreaking will increase unsafe factors after all, especially when there are many financial instruments installed, jailbreaking is strongly not recommended. |
<<: Programmer, how serious are you about your work other than writing code?
>>: Write your own Bayesian classifier to classify books
Where can I drink and taste tea in Changsha? 185-...
How much does it cost to be a Chuxiong agent for ...
How much does it cost to join a fast food app in ...
Mobile resources: six advertising formats to meet...
"What if someone needs it?" Blogger Xia...
The main business of the new company, Aifengpai, ...
“If we want to increase the popularity of our liv...
It has become a reality that the vertical Z gener...
To be honest, in today's fierce market enviro...
During the morning and evening rush hours, when y...
This is the 4274th article of Da Yi Xiao Hu Recen...
At different times, the forms of popular accounts...
Recently, the brightness of Mars has been increas...