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
After the cotton incident, new domestic brands re...
[51CTO.com original article] As an ordinary perso...
How much does a 10,000-game server cost? The rent...
In our impression, fires seem to mean a catastrop...
Over the past decade or so, smartphones have beco...
The national emblem of the Federative Republic of...
recently Topic #They climbed over the eaves and w...
As we enter 2022, the epidemic, which had been do...
Ever since soft-text masters such as Gu Ye, Wang ...
Myth: "Old people often wake up at night and...
The official version of iOS 17 is finally release...
Introduction to the disassembly content: Disassem...
According to statistics, the penetration rate of ...
Facial masks, as one of our daily skin care produ...