coolstar / electra

Electra iOS 11.0 - 11.1.2 jailbreak toolkit based on async_awake
GNU General Public License v3.0
656 stars 163 forks source link

How to build a daemon on Electra? #222

Open liuxuan30 opened 6 years ago

liuxuan30 commented 6 years ago

Hello there,

Just want to rewrite a tweak/daemon on Electra. It used to work on traditional JBs like iOS 9 or 10 with cydia and substrate.

Just want to know how to port the daemon to Electra? My daemon is just a bin and added into LaunchDaemons with

<dict>
    <key>Label</key>
    <string>com.myworker.server</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/bin/MyWorker</string>
    </array>
    <key>UserName</key>
    <string>root</string>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
</dict>

and entitlement:

<plist version="1.0">
<dict>
    <key>com.apple.private.mobileinstall.allowedSPI</key>
    <array>
        <string>Install</string>
        <string>Browse</string>
        <string>Uninstall</string>
        <string>InstallForLaunchServices</string>
        <string>UninstallForLaunchServices</string>
    </array>
    <key>com.apple.springboard.launchapplications</key>
    <true/>
</dict>
</plist>

Is this still true on Electra? I know I probably should add platform-application ent. Anything else? Especially any tricks or traps I should watch out? And can I just still use theos to build?

Thanks for the answers!

fuguangxin commented 6 years ago

I also have this question, have you solved it? I always get this prompt. Sandbox: hook..execve() killing DaemonDemo[pid=363, uid=0]: outside of container && !i_can_has_debugger

liuxuan30 commented 6 years ago

not yet. but have you given enough entitlements? like platform?

fuguangxin commented 6 years ago

I tried the same entitlements like sshd, but still did not succeed.

cjsworld commented 6 years ago

with <key>platform-application</key> <true/> in entitlements, and make sure binary is owned by root, and has permission, like this is postinst:

chown root:wheel /Library/LaunchDaemons/com.xxx.testd.plist
chmod 644 /Library/LaunchDaemons/com.xxx.testd.plist
chown root:wheel /usr/bin/testd
chmod 755 /usr/bin/testd
fuguangxin commented 6 years ago

@cjsworld Thank you for solving my problem

liuxuan30 commented 6 years ago

did you make the daemon work? @cjsworld

Jackliuchonghuan commented 6 years ago

@liuxuan30 你好我是同样的问题,也是在9和10上面 daemon 能正常的工作,11上面不能正常工作。单独写一个deamon 加上权限是可以跑起来的。请问下你现在是上面情况 能正常运行起来了么?