#!/system/bin/sh
export PROXYHOST=wap.mycricket.com
export PROXYPORT=8080

#you shouldn't have to edit anything below this line

export PATH="$PATH:/system/bin"
until netcfg|grep -v DOWN|awk '{print $1}'|grep -v wlan|grep -v lo >/dev/null 2>&1 ; do sleep 1 ; done
export INTERFACE=`netcfg|grep -v DOWN|awk '{print $1}'|grep -v wlan|grep -v lo`
export PROXYIP=`ping -c 1 $PROXYHOST|grep PING|cut -d\) -f1|cut -d\( -f2`
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -F
iptables -t nat -F
iptables -X
iptables -t nat -A OUTPUT -o $INTERFACE -p tcp -d 10/8 -j ACCEPT
iptables -t nat -A OUTPUT -o $INTERFACE -p tcp -d 172.16/12 -j ACCEPT
iptables -t nat -A OUTPUT -o $INTERFACE -p tcp -d 192.168/16 -j ACCEPT
iptables -t nat -A OUTPUT -o $INTERFACE -p tcp -j REDIRECT --to-port 1025
u2nl $PROXYIP $PROXYPORT 127.0.0.1 1025 >/dev/null 2>&1 &
sh -c "sleep 5;kill `ps|grep nk.bla.android.autostart|grep -v grep|awk '{print $2}'`" >/dev/null 2>&1 &
exit 0

