Skip to content

Instantly share code, notes, and snippets.

@Anime4000
Last active November 18, 2015 01:37
Show Gist options
  • Save Anime4000/4269e7d15b776923c947 to your computer and use it in GitHub Desktop.
Save Anime4000/4269e7d15b776923c947 to your computer and use it in GitHub Desktop.
Iodine iOS
#!/bin/bash
# This script used for iodine in iOS
# Required:
# Unix command
# Network Commands
# iodine
# Readme:
# iodine has 2 mode:
# 1. Direct, like normal VPN but using port 53
# 2. Pure DNS Tunnel, using DNS to encapsulate traffic (-r)
#
# Which mean need add 2 different route, for Direct & DNS Tunnel
# adding default DNS & Server IP to current gateway allowing to establish a VPN via iodine tunnel
#
#
if [ "$EUID" -ne 0 ]; then
echo "Please run as root"
exit
fi
if [[ $# -eq 0 ]]; then
echo "No arguments detected, run default (skip raw)"
echo "To run under raw (maybe faster) execute: $0 direct"
sleep 5
fi
PASS= iodine password
HOSTNS= iodine nameserver
HOSTIP= iodine ip address
DNS=$(scutil --dns | grep 'nameserver' | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -n 1)
GW=$(route -n get default | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')
route -n add -net $DNS $GW
route -n add -net $HOSTIP $GW
while true
do
iodine -f -r -P $PASS $DNS $HOSTNS
done
route -n delete -net $DNS $GW
route -n delete -net $HOSTIP $GW
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment