Skip to content

mikaelbo/ProxySwitcher

Repository files navigation

ProxySwitcher

ProxySwitcher is meant to give an easy way to toggle proxy on / off. Since the proxy settings are on a per-WiFi basis, ProxySwitcher listens to changes to the WiFi network, and makes sure those settings are persisted through switching of active WiFi network.

Easily toggle between using proxy and non-proxy by tapping the added icon on the right side of the StatusBar. The icon is gray when it's set to not use proxy, and black/white when proxy is active.

The icon can be toggled to only show when WiFi is active (default), or to always be shown.

Available from iOS 9.1+

Future wishlist:

  • Saving proxy username and password credentials to the KeyChain (SecKeychainAddInternetPassword?)

  • Multiple proxy configurations

  • Overlay for toggling proxy. Something like this:

Installation

1. Theos

Make sure you have Theos installed (guide found here), with the $THEOS and $THEOS_DEVICE_IP variables configured.

2. Private headers

Theos needs to point to an iOS SDK including private headers (required for using Preferences). The newer versions of the iOS SDK does not include those anymore. A few ways to solve that has been suggested in this thread. I ended up putting a separate iOS SDK including private headers in $THEOS/sdks.

3. fauxsu

The daemon must be owned by root:wheel, and to make sure that happens during the build, you can use a tool called fauxsu. A compiled version can be downloaded from here.

Extract fauxsu and libfauxsu.dylib to $THEOS/bin/. Run the following commands to make sure fauxsu and libfauxsu.dylib has the correct permissions:

sudo chmod +x $THEOS/bin/fauxsu
sudo chmod +x $THEOS/bin/libfauxsu.dylib
sudo chown root:wheel $THEOS/bin/fauxsu
sudo chown root:wheel $THEOS/bin/libfauxsu.dylib

make install to build it locally.

Check ownership by running:

dpkg-deb -c ./packages/com.mbo42.proxyswitcher_X+debug_iphoneos-arm.deb
drwxr-xr-x root/wheel        0 2017-05-23 16:35 ./
drwxr-xr-x root/wheel        0 2017-05-22 17:20 ./Library/
drwxr-xr-x root/wheel        0 2017-05-22 21:08 ./Library/LaunchDaemons/
-rw-r--r-- root/wheel      504 2017-05-22 21:08 ./Library/LaunchDaemons/
com.mbo42.proxyswitcherd.plist
drwxr-xr-x root/wheel        0 2017-05-23 16:35 ./usr/
drwxr-xr-x root/wheel        0 2017-05-23 16:35 ./usr/bin/
-rwxr-xr-x root/wheel   139680 2017-05-23 16:35 ./usr/bin/ProxySwitcherd
...

If the daemon still isn't owned by root:wheel, it might be because System Integrity Protection is turned on. You can check this by running csrutil status in the console.

When everything is set up and working properly, you can run make package install from the root directory to deploy to the device.

Credits

Licence

This project is licensed under the MIT Licence. Feel free to use the code however you see fit in your own projects. However, redistribution of this tweak as is to Cydia is prohibited.