objective-ciphonecydiatweak

Task for pid iOS gui


I'm writing an iosopendev tweak with an graphical user interface to do some task for pid code.

The app itself has an control, postint, prerm file to get root access/privileges.

Postint:

#!/bin/bash

cd "/Applications/test.app/"

# process origin binary
mv test test_
chown root.wheel test_
chmod +s        test_

cont=`cat <<"EOF"
#!/bin/bash
dir=$(dirname "$0")
exec "${dir}"/test_ "$@"
EOF
`
# create new fake binary
echo -e "$cont" > test
chown root.wheel  test
chmod +x          test

#The RESPRING script after Install
declare -a cydia
cydia=($CYDIA)

if [[ $1 == install || $1 == upgrade ]]; then
if [[ ${CYDIA+@} ]]; then
eval "echo 'finish:restart' >&${cydia[0]}"
fi
fi

exit

Prerm:

#!/bin/bash

rm -f "/Applications/test.app/test_"

Are there any ways to sign the app and get task_for_pid access?

Thanks


Solution

  • You sign the app when you make it, not when you install it.

    1. Install ldid to sign your binaries. If you are using macOS with Homebrew, install it with:

      brew install ldid
      

      Check http://iphonedevwiki.net/index.php/Theos/Setup#Setting_Up_Dependencies for other platforms.

    2. Create an entitlement file (ent.plist):

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
      <plist version="1.0">
      <dict>
          <key>get-task-allow</key>
          <true/>
          <key>task_for_pid-allow</key>
          <true/>
      </dict>
      </plist>
      
    3. If using theos, put ent.plist next to the Makefile, then add this line to your Makefile (change test to the name of the target):

      test_CODESIGN_FLAGS = -Sent.plist
      

      If using Xcode, put ent.plist inside ${PROJECT_DIR}, then set the CODE_SIGN_ENTITLEMENTS build setting of your target to ent.plist.

      enter image description here