xcode5 - How to get Root privileges developing iPhone app using Xcode -
i cannot access /var/mobile/library/sms
etc. in xcode
if iphone jailbroken.
apple sandboxing doesn't allow root access.
a similar answer here gaining root permissions on ios nsfilemanager (jailbreak) .
but newbie. except first 2 steps, don't understand doing. great if can explain answer.
or
is there other way access /private/var/mobile/library....
?
xcode: 5.0.1
device: iphone 5s ios 7.1
osx: 10.9.2
3 . create copy of executable file in app bundle.
when build project in xcode, produce output directory. varies machine, you'll have search filesystem. however, if app named helloworld
, normally, you'd have directory named helloworld.app
. answer referring app bundle. command line (or using mac's finder), go inside helloworld.app
, make copy of helloworld
executable file. normally, name copy mobilehelloworld
.
4 . open original executable file , replace content script:
#!/bin/bash
dir=$(dirname "$0")
exec "${dir}"/copied_executable_name "$@"directly launching root app fails on ios. therefore replace app's main executable script launches root executable.
i guess have described step differently. can delete file. create new script same filename (helloworld
) , edit include lines above, starting #!/bin/bash
. of course, copied_executable_name replaced mobilehelloworld in example.
so, ios launch script directly, instead of executable. however, script launch executable , because of permissions you've given files, running executable have root privileges.
5 . in terminal, navigate app bundle.
you're in "bundle" directory. (helloworld.app
)
6 . chmod 0775 original executable file , chmod 6775 copied executable file.
issue chmod
command helloworld
file has 775 permissions (rwxrwxr-x
). mobilehelloworld
file should have 6775 permissions (rwsrwsr-x
).
7 . copy app bundle /applications device. restart springboard , should go. if app doesn't launch repeat step 5 & 6 on device.
using whatever tool (i use scp
since device jailbroken openssh installed), copy entire helloworld.app
folder ios device. so, have folder named: /applications/helloworld.app/
contains bash script, copied/renamed executable, , other bundle resources (.png files, .xib files, etc.) app contains.
example
if have jailbroken device, install openssh , ssh phone, check out how cydia app accomplishes this. can view /applications/cydia.app/cydia
script file, launches mobilecydia
executable root privileges.
another way
actually, if want access /var/mobile/library
, doesn't require root access. directory owned mobile
user, root isn't necessary. necessary escaping normal ios 3rd-party app sandbox. that, copy helloworld.app
folder , contents /applications/
folder on device. apps installed there, opposed /var/mobile/applications
won't have such tight sandbox restrictions.
so, none of copying of executable, inserting bash script, necessary. steps 3 through 6 can skipped.
hope helps. sorry snarky comment.
Comments
Post a Comment