How to gain root privileges for iOS app?

懵懂的女人 提交于 2019-11-29 12:42:25

What step 4 is telling you:

Open the original executable file and delete its contents (the contents are now stored in the previously copied and renamed binary).

is simply that you have moved the executable file for your app to a new filename, and you should replace it with a script with the name of the original executable.

Example

  • If you build an app named HelloWorld, Xcode will create a HelloWorld.app directory, with a file named HelloWorld inside it, which is executable.

  • The answer you link to suggests basically renaming the executable to something like MobileHelloWorld.

  • Once you've done that, create a new file in the HelloWorld.app directory called HelloWorld, and edit it with a text editor to give it this content:

#!/bin/bash
dir=$(dirname "$0")
exec "${dir}"/MobileHelloWorld "$@"

That script will then be run when you tap the app's icon, because in the app's Info.plist file, the name of the executable is

    <key>CFBundleExecutable</key>
    <string>HelloWorld</string>

and HelloWorld is now a shell script, which invokes MobileHelloWorld, the renamed binary executable file.

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