Your favorite Apple, iPhone, iPad, iOS, Jailbreak, and Cydia site.
07-17-2012, 06:13 AM #1Howto use command line iOS tools from Xcode?
I would like to create an iOS frontend for some of the (jailbreak) command line tools - wget for instance - using Xcode.
Can I run command line apps (or bash scripts) from within my app and grab the output?
An Xcode code example would be appreciated
07-23-2012, 03:14 AM #2
im new to Obj-C and Xcode(c#/java dev),
but anyway back to topic i am a few steps further and managed to run an "echo string" via NSTask/NMTaskWrapper, it works fine in the simulator but when i try to run it on my iPhone4 (5.1.1 JB)device the app crashes on the [task launch] command with an NSInconsistencyException.
Do i have to somehow create a new Project with a CydiaAppTemplate, f.e. project template from Theos to get this running?
08-13-2012, 03:22 AM #3
It might be that NSTask isn't native to the iPhone SDK... How did you manage to import it?
08-15-2012, 03:51 PM #4
well for NSTask, get the NMTaskWrapper, works well if your app is like in my video tutorial.
well in my case, i need root rights for calling some commands...
if someone knows how, please dont hesitate and post a reply :=)
The Following User Says Thank You to Kayhan 17# For This Useful Post:
08-19-2012, 11:10 AM #5
Sorry for leaving you hanging - I was busy getting my own app ready for submission. There's still a lot of things to do but I worked out a few things - including how to run stuff as root (though the solution is far from perfect).
You can set SUID for the app that needs to run as root - though it can potentially be a security disaster.
In my case I chose to let whoever downloads my app do it manually since it shouldn't open up security holes just by installing.
In my case: chmod u+s /usr/bin/nmap
If it's a script in your app that needs root you can SUID it with the post install deb script.
You can read more about my Nmap GUI over on my blog - hope it gets approved soon
Nmap GUI – Nmap for iPhone, iPad and iPad « Evilpigeon.dk
08-20-2012, 05:31 AM #6
If you want to create a postinst script, just place it in your DEBIAN folder and chmod +x it.
NMTaskWrapper does the job ok but it's kind of annoying that you have to wait for the reponse (textview.text = [NMTaskWrapper response] - do you think there's any way the response can be displayed on the fly?
08-29-2012, 10:51 AM #7
ive created a postinst script and set "chown root:wheel" and "chmod 755", my app still runs with the mobile user
Last edited by Kayhan 17#; 08-29-2012 at 11:12 AM.
09-18-2012, 03:57 PM #8
finally got it working...