Creating an iPhone Daemon – Part 4

Creating an iPhone Daemon – Part 4

Author : admin     Category :  Chris AlvaresProgramming     25 Mar | 10 Comments

This is part four of the blog series “Creating an iPhone Daemon”, for part three please click this link

This is the coolest part of the series. Up until now, all the code can only be used as a standalone application that can only run if the user clicks the “DLocationDemon.app” button on the springboard. Now it is time to put it all together, with the Daemon Plist file.

You will also need SSH installed for this part (again, the hackint0sh forums) I use Cyberduck as my SSH client (Select SFTP for SSH and type in the IP of your iPhone with root/alpine as username/password respectively).

The first thing we do is compile our DLocationDemon project. Please use the method over at hackint0sh to compile and codesign your project successfully.
Once you have compiled your project, you should get a DLocationDemon.app in the “Products folder” right click on the .app file and click “Reveal in Finder”.


Reveal in Finder


Right click on the .app file and click “Show Package Contents” and make sure you have a DLocationDemon file inside the folder
Show Package Contents

Next, using your favorite SFTP program, dumb the DLocationDemon.app inside the /Applications folder of your iPhone
Cyber Duck SFTP

**NOTE** Make sure this is the /Applications folder and not the /var/root/Applications folder. You can tell the difference because all of the apps you downloaded from the AppStore should be in the /Applications folder.

The next thing we have to do is create the .plist file for the daemon to work.
I have named mine com.chrisalvares. DLocationDemon.plist, this should match the bundle identifier in the info.plist file.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>com.chrisalvares.DLocationDemon.plist</string>
 
        <key>ProgramArguments</key>
        <array>
                <string>/Applications/DLocationDemon.app/DLocationDemon</string>
                <string></string>
                <string></string>
        </array>
 
        <key>OnDemand</key>
        <false/>
 
        <key>StandardErrorPath</key>
        <string>/dev/null</string>
 
        <key>Disabled</key>
        <false/>
</dict>
</plist>

Make sure the label field matches the bundle identifier in your info.plist file.

Now SFTP into your iPhone again and drop this plist file into the “/System/Library/LaunchDaemons” folder. You should see at least one other daemon.plist file there. (I believe this is where the SSH daemon is).

Now restart your iPhone.

This will give you a working daemon installed on your iPhone!

转自:http://chrisalvares.com/blog/38/creating-an-iphone-daemon-part-4/

猜你喜欢

转载自chinaxxren.iteye.com/blog/1669704