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
In 2014, Tim Collins published " 100 ways to...
Push notifications are one of the most important ...
In the new consumption era, pure traffic diversio...
In this article, we will continue to provide you ...
Pinduoduo has developed rapidly since it appeared...
How are Apple App Store’s default search ads made...
Search engine mechanism 1. Search mechanism As a ...
The twenty-six letters of the alphabet have all b...
Traffic is so expensive and conversion is so low!...
There is no doubt that iQiyi has taken the top sp...
As we pay more and more attention to our bodies, ...
This article will teach you how to make an execut...
[[421355]] Two weeks after the last version, WeCh...
Free resources that app promotion novices must kno...
The author of this article, Zhang Jianzhong, has ...