Jailbroken iOS: How to execute shell commands from app extensions?

118 views Asked by At

I've been developing a network monitoring app for jailbroken iPhones with Theos. I'm using an app extension (Packet Tunnel Provider) for this. Furthermore, I am using NSTask to execute shell commands in the main app (containing the app extension), this works well. However, when I try to do execute the same code from within the app extension, I get this error: Couldn't posix_spawn: error 1, indicating that the Packet Tunnel process does not have the rights/permissions to execute it, unlike the containing app.

I'm using Theos to build and sign my app, and when I check the executables with ldid -e path/to/executables, I see that both have the following entitlements:

<?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>com.apple.developer.networking.networkextension</key>
    <array>
        <string>packet-tunnel-provider</string>
    </array>
    <key>com.apple.security.iokit-user-client-class</key>
    <array>
        <string>IOUserClient</string>
    </array>
    <key>platform-application</key>
    <true/>
    <key>com.apple.private.skip-library-validation</key>
    <true/>
    <key>com.apple.private.security.no-container</key>
    <true/>
    <key>get-task-allow</key>
    <true/>
</dict>
</plist>

Does anyone have an idea or can point me to some resources about development with Theos and app extensions?

Any help is greatly appreciated!

0

There are 0 answers