How to gain root privileges for iOS app?

前端 未结 1 962
离开以前
离开以前 2020-12-20 04:21

I\'m currently building an app for jailbroken device, and I need root privileges for my app so that I can perform some tasks ask root. I found a related question : Gaining r

1条回答
  •  被撕碎了的回忆
    2020-12-20 05:20

    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

        CFBundleExecutable
        HelloWorld
    

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

    0 讨论(0)
提交回复
热议问题