Skip to content

Instantly share code, notes, and snippets.

@dantmnf

dantmnf/chnips.list

Last active Apr 21, 2016
Embed
What would you like to do?
Global proxy using badvpn-tun2socks
1.0.1.0/24
1.0.2.0/23
1.0.8.0/21
1.0.32.0/19
1.1.0.0/24
1.1.2.0/23
1.1.4.0/22
1.1.8.0/21
1.1.16.0/20
1.1.32.0/19
1.2.0.0/23
1.2.2.0/24
1.2.4.0/22
1.2.8.0/21
1.2.16.0/20
1.2.32.0/19
1.2.64.0/18
1.3.0.0/16
1.4.1.0/24
1.4.2.0/23
1.4.4.0/22
1.4.8.0/21
1.4.16.0/20
1.4.32.0/19
1.4.64.0/18
1.8.0.0/16
1.10.0.0/21
1.10.8.0/23
1.10.11.0/24
1.10.12.0/22
1.10.16.0/20
1.10.32.0/19
1.10.64.0/18
1.12.0.0/14
1.24.0.0/13
1.45.0.0/16
1.48.0.0/14
1.56.0.0/13
1.68.0.0/14
1.80.0.0/12
1.116.0.0/14
1.180.0.0/14
1.184.0.0/15
1.188.0.0/14
1.192.0.0/13
1.202.0.0/15
1.204.0.0/14
14.0.0.0/21
14.0.12.0/22
14.1.0.0/22
14.16.0.0/12
14.102.128.0/22
14.102.156.0/22
14.103.0.0/16
14.104.0.0/13
14.112.0.0/12
14.130.0.0/15
14.134.0.0/15
14.144.0.0/12
14.192.60.0/22
14.192.76.0/22
14.196.0.0/15
14.204.0.0/15
14.208.0.0/12
27.8.0.0/13
27.16.0.0/12
27.34.232.0/21
27.36.0.0/14
27.40.0.0/13
27.50.40.0/21
27.50.128.0/17
27.54.72.0/21
27.54.152.0/21
27.54.192.0/18
27.98.208.0/20
27.98.224.0/19
27.99.128.0/17
27.103.0.0/16
27.106.128.0/18
27.106.204.0/22
27.109.32.0/19
27.112.0.0/18
27.112.80.0/20
27.113.128.0/18
27.115.0.0/17
27.116.44.0/22
27.121.72.0/21
27.121.120.0/21
27.128.0.0/15
27.131.220.0/22
27.144.0.0/16
27.148.0.0/14
27.152.0.0/13
27.184.0.0/13
27.192.0.0/11
27.224.0.0/14
36.0.0.0/22
36.0.8.0/21
36.0.16.0/20
36.0.32.0/19
36.0.64.0/18
36.0.128.0/17
36.1.0.0/16
36.4.0.0/14
36.16.0.0/12
36.32.0.0/14
36.36.0.0/16
36.37.0.0/19
36.37.36.0/23
36.37.39.0/24
36.37.40.0/21
36.37.48.0/20
36.40.0.0/13
36.48.0.0/15
36.51.0.0/16
36.56.0.0/13
36.96.0.0/11
36.128.0.0/10
36.192.0.0/11
36.248.0.0/14
36.254.0.0/16
39.0.0.0/24
39.0.2.0/23
39.0.4.0/22
39.0.8.0/21
39.0.16.0/20
39.0.32.0/19
39.0.64.0/18
39.0.128.0/17
39.64.0.0/11
39.96.0.0/13
39.104.0.0/14
39.108.0.0/16
39.128.0.0/10
42.0.0.0/22
42.0.8.0/21
42.0.16.0/21
42.0.24.0/22
42.0.32.0/19
42.0.128.0/17
42.1.0.0/19
42.1.32.0/20
42.1.48.0/21
42.1.56.0/22
42.1.128.0/17
42.4.0.0/14
42.48.0.0/13
42.56.0.0/14
42.62.0.0/17
42.62.128.0/19
42.62.160.0/20
42.62.180.0/22
42.62.184.0/21
42.63.0.0/16
42.80.0.0/15
42.83.64.0/20
42.83.80.0/22
42.83.88.0/21
42.83.96.0/19
42.83.128.0/17
42.84.0.0/14
42.88.0.0/13
42.96.64.0/19
42.96.96.0/21
42.96.108.0/22
42.96.112.0/20
42.96.128.0/17
42.97.0.0/16
42.99.0.0/18
42.99.64.0/19
42.99.96.0/20
42.99.112.0/22
42.99.120.0/21
42.100.0.0/14
42.120.0.0/15
42.122.0.0/16
42.123.0.0/19
42.123.36.0/22
42.123.40.0/21
42.123.48.0/20
42.123.64.0/18
42.123.128.0/17
42.128.0.0/12
42.156.0.0/19
42.156.36.0/22
42.156.40.0/21
42.156.48.0/20
42.156.64.0/18
42.156.128.0/17
42.157.0.0/16
42.158.0.0/15
42.160.0.0/12
42.176.0.0/13
42.184.0.0/15
42.186.0.0/16
42.187.0.0/18
42.187.64.0/19
42.187.96.0/20
42.187.112.0/21
42.187.120.0/22
42.187.128.0/17
42.192.0.0/13
42.201.0.0/17
42.202.0.0/15
42.204.0.0/14
42.208.0.0/12
42.224.0.0/12
42.240.0.0/16
42.242.0.0/15
42.244.0.0/14
42.248.0.0/13
43.224.12.0/22
43.224.24.0/22
43.224.44.0/22
43.224.52.0/22
43.224.56.0/22
43.224.64.0/21
43.224.72.0/22
43.224.80.0/22
43.224.100.0/22
43.224.140.0/22
43.224.144.0/22
43.224.160.0/22
43.224.176.0/22
43.224.184.0/22
43.224.200.0/21
43.224.208.0/21
43.224.216.0/22
43.224.224.0/22
43.224.240.0/22
43.225.76.0/22
43.225.84.0/22
43.225.120.0/21
43.225.140.0/22
43.225.172.0/22
43.225.180.0/22
43.225.184.0/22
43.225.208.0/22
43.225.216.0/21
43.225.224.0/20
43.225.240.0/21
43.225.252.0/22
43.226.32.0/19
43.226.64.0/19
43.226.96.0/20
43.226.112.0/21
43.226.120.0/22
43.226.128.0/18
43.226.192.0/20
43.226.208.0/21
43.226.236.0/22
43.226.240.0/20
43.227.0.0/21
43.227.8.0/22
43.227.28.0/22
43.227.32.0/19
43.227.64.0/19
43.227.96.0/21
43.227.104.0/22
43.227.136.0/21
43.227.144.0/22
43.227.152.0/21
43.227.160.0/20
43.227.176.0/21
43.227.188.0/22
43.227.192.0/19
43.227.232.0/22
43.227.248.0/21
43.228.0.0/18
43.228.64.0/21
43.228.76.0/22
43.228.100.0/22
43.228.116.0/22
43.228.120.0/22
43.228.132.0/22
43.228.136.0/22
43.228.148.0/22
43.228.152.0/22
43.228.180.0/22
43.228.188.0/22
43.228.204.0/22
43.228.240.0/22
43.229.16.0/22
43.229.40.0/22
43.229.48.0/22
43.229.56.0/22
43.229.96.0/22
43.229.108.0/22
43.229.120.0/22
43.229.136.0/21
43.229.144.0/22
43.229.168.0/21
43.229.176.0/20
43.229.192.0/21
43.229.216.0/21
43.229.232.0/21
43.230.20.0/22
43.230.32.0/22
43.230.68.0/22
43.230.72.0/22
43.230.84.0/22
43.230.124.0/22
43.230.136.0/22
43.230.168.0/22
43.230.220.0/22
43.230.224.0/19
43.231.32.0/20
43.231.80.0/20
43.231.96.0/20
43.231.136.0/21
43.231.144.0/20
43.231.160.0/20
43.231.176.0/21
43.236.0.0/15
43.238.0.0/16
43.239.0.0/19
43.239.32.0/20
43.239.48.0/22
43.240.0.0/22
43.240.48.0/22
43.240.56.0/21
43.240.68.0/22
43.240.72.0/21
43.240.84.0/22
43.240.124.0/22
43.240.128.0/21
43.240.136.0/22
43.240.156.0/22
43.240.160.0/19
43.240.192.0/19
43.240.236.0/22
43.240.240.0/20
43.241.0.0/20
43.241.16.0/21
43.241.48.0/22
43.241.76.0/22
43.241.80.0/20
43.241.112.0/22
43.241.168.0/21
43.241.176.0/21
43.241.184.0/22
43.241.196.0/22
43.241.208.0/20
43.241.224.0/20
43.241.240.0/22
43.241.248.0/21
43.242.8.0/21
43.242.16.0/20
43.242.44.0/22
43.242.48.0/20
43.242.64.0/22
43.242.72.0/21
43.242.80.0/20
43.242.96.0/22
43.242.144.0/20
43.242.160.0/21
43.242.168.0/22
43.242.180.0/22
43.242.188.0/22
43.242.192.0/21
43.242.204.0/22
43.242.216.0/21
43.242.252.0/22
43.243.4.0/22
43.243.8.0/21
43.243.16.0/22
43.243.24.0/22
43.243.88.0/22
43.243.128.0/22
43.243.136.0/22
43.243.144.0/21
43.243.156.0/22
43.243.168.0/22
43.243.180.0/22
43.243.188.0/22
43.243.228.0/22
43.243.232.0/22
43.243.244.0/22
43.246.0.0/18
43.246.64.0/19
43.246.96.0/22
43.247.4.0/22
43.247.8.0/22
43.247.44.0/22
43.247.48.0/22
43.247.68.0/22
43.247.76.0/22
43.247.84.0/22
43.247.88.0/21
43.247.96.0/21
43.247.108.0/22
43.247.112.0/22
43.247.148.0/22
43.247.152.0/22
43.247.176.0/20
43.247.196.0/22
43.247.200.0/21
43.247.208.0/20
43.247.224.0/19
43.248.0.0/21
43.248.20.0/22
43.248.28.0/22
43.248.48.0/22
43.248.56.0/22
43.248.76.0/22
43.248.80.0/20
43.248.96.0/19
43.248.128.0/20
43.248.144.0/21
43.248.176.0/20
43.248.192.0/20
43.248.208.0/22
43.248.228.0/22
43.248.232.0/22
43.248.244.0/22
43.249.0.0/21
43.249.8.0/22
43.249.24.0/22
43.249.120.0/22
43.249.132.0/22
43.249.136.0/22
43.249.144.0/20
43.249.160.0/21
43.249.168.0/22
43.249.192.0/22
43.249.236.0/22
43.250.4.0/22
43.250.12.0/22
43.250.16.0/21
43.250.28.0/22
43.250.32.0/21
43.250.72.0/22
43.250.96.0/20
43.250.112.0/21
43.250.128.0/22
43.250.144.0/21
43.250.160.0/22
43.250.168.0/21
43.250.176.0/22
43.250.200.0/22
43.250.212.0/22
43.250.216.0/21
43.250.236.0/22
43.250.244.0/22
43.251.4.0/22
43.251.8.0/21
43.251.16.0/23
43.251.36.0/22
43.251.116.0/22
43.251.192.0/22
43.251.232.0/21
43.251.244.0/22
43.252.40.0/22
43.252.48.0/22
43.252.56.0/22
43.252.224.0/22
43.254.0.0/21
43.254.8.0/22
43.254.24.0/22
43.254.36.0/22
43.254.44.0/22
43.254.52.0/22
43.254.64.0/22
43.254.72.0/22
43.254.84.0/22
43.254.88.0/21
43.254.100.0/22
43.254.104.0/22
43.254.112.0/21
43.254.128.0/22
43.254.136.0/21
43.254.144.0/20
43.254.168.0/21
43.254.180.0/22
43.254.184.0/21
43.254.192.0/21
43.254.200.0/22
43.254.208.0/22
43.254.220.0/22
43.254.224.0/20
43.254.240.0/22
43.254.248.0/21
43.255.0.0/21
43.255.8.0/22
43.255.16.0/22
43.255.48.0/22
43.255.60.0/22
43.255.64.0/20
43.255.84.0/22
43.255.96.0/22
43.255.108.0/22
43.255.144.0/22
43.255.168.0/22
43.255.176.0/22
43.255.184.0/22
43.255.192.0/22
43.255.200.0/21
43.255.208.0/21
43.255.224.0/21
43.255.232.0/22
43.255.244.0/22
45.64.112.0/23
45.112.132.0/22
45.112.188.0/22
45.112.208.0/20
45.112.228.0/22
45.112.232.0/21
45.113.12.0/22
45.113.16.0/20
45.113.40.0/22
45.113.52.0/22
45.113.56.0/22
45.113.72.0/22
45.113.108.0/22
45.113.144.0/21
45.113.168.0/22
45.113.176.0/22
45.113.184.0/22
45.113.200.0/21
45.113.208.0/20
45.113.228.0/22
45.113.240.0/22
45.113.252.0/22
45.114.0.0/22
45.114.12.0/22
45.114.32.0/22
45.114.40.0/22
45.114.52.0/22
45.114.96.0/22
45.114.104.0/22
45.114.136.0/22
45.114.196.0/22
45.114.200.0/22
45.114.228.0/22
45.114.236.0/22
45.114.252.0/22
45.115.44.0/22
45.115.100.0/22
45.115.120.0/22
45.115.132.0/22
45.115.144.0/22
45.115.156.0/22
45.115.164.0/22
45.115.200.0/22
45.115.212.0/22
45.115.216.0/22
45.115.228.0/22
45.115.236.0/22
45.115.244.0/22
45.115.248.0/22
45.116.12.0/22
45.116.16.0/21
45.116.24.0/22
45.116.32.0/21
45.116.52.0/22
45.116.60.0/22
45.116.64.0/22
45.116.96.0/21
45.116.140.0/22
45.116.152.0/22
45.116.208.0/22
45.117.8.0/22
45.117.20.0/22
45.117.40.0/22
45.117.68.0/22
45.117.124.0/22
45.117.252.0/22
45.119.52.0/22
45.119.60.0/22
45.119.64.0/21
45.119.72.0/22
45.119.104.0/22
45.119.116.0/22
45.119.160.0/22
45.119.232.0/22
45.120.100.0/22
45.120.140.0/22
45.120.156.0/22
45.120.164.0/22
45.120.220.0/22
45.120.240.0/22
45.121.20.0/22
45.121.52.0/22
45.121.64.0/21
45.121.72.0/22
45.121.92.0/22
45.121.96.0/22
45.121.104.0/22
47.92.0.0/14
47.96.0.0/11
49.4.0.0/14
49.51.0.0/16
49.52.0.0/14
49.64.0.0/11
49.112.0.0/13
49.120.0.0/14
49.128.0.0/24
49.128.2.0/23
49.140.0.0/15
49.152.0.0/14
49.208.0.0/14
49.220.0.0/14
49.232.0.0/14
49.239.0.0/18
49.239.192.0/18
49.246.224.0/19
54.222.0.0/15
58.14.0.0/15
58.16.0.0/13
58.24.0.0/15
58.30.0.0/15
58.32.0.0/11
58.65.232.0/21
58.66.0.0/15
58.68.128.0/17
58.82.0.0/17
58.83.0.0/16
58.87.64.0/18
58.99.128.0/17
58.100.0.0/15
58.116.0.0/14
58.128.0.0/13
58.144.0.0/16
58.154.0.0/15
58.192.0.0/11
58.240.0.0/12
59.32.0.0/11
59.64.0.0/12
59.80.0.0/14
59.107.0.0/16
59.108.0.0/14
59.151.0.0/17
59.155.0.0/16
59.172.0.0/14
59.191.0.0/17
59.191.240.0/20
59.192.0.0/10
60.0.0.0/11
60.55.0.0/16
60.63.0.0/16
60.160.0.0/11
60.194.0.0/15
60.200.0.0/13
60.208.0.0/12
60.232.0.0/15
60.23
#!/bin/bash
#### General setings ####
SOCKS_SERVER=127.0.0.1:1080
EXCEPTION_LIST=(10.0.0.0/8 100.64.0.0/10 127.0.0.0/8 169.254.0.0/16 172.16.0.0/12
192.0.0.0/29 192.0.2.0/24 192.88.99.0/24 192.168.0.0/16 198.18.0.0/15
198.51.100.0/24 203.0.113.0/24 224.0.0.0/4 240.0.0.0/4 255.255.255.255/32)
#### tun2socks settings ####
TUNDEV=tun0
NETIF_IPADDR=10.124.50.2
NETIF_NETMASK=255.255.255.255
############################
gateway=$(ip route show 0/0 | grep via | head -n 1 | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+')
echo "starting tun2socks..."
badvpn-tun2socks --loglevel notice --tundev "${TUNDEV}" --netif-ipaddr "${NETIF_IPADDR}" --netif-netmask "${NETIF_NETMASK}" --socks-server-addr "${SOCKS_SERVER}" &
tun2socks_pid=$!
sleep 1
echo "setting global proxy..."
ip link set "${TUNDEV}" up
ip addr add dev "${TUNDEV}" "${NETIF_IPADDR}/${NETIF_NETMASK}"
for i in $EXCEPTION_LIST
do
ip route add "$i" via $gateway
done
awk "{print(\"route add \" \$1 \" via ${gateway}\")}" chnips.list | ip -batch -
ip route add default via "${NETIF_IPADDR}" dev "${TUNDEV}"
trap STOP INT
STOP() {
echo "exiting..."
#kill -INT $tun2socks_pid
# restore routes
#ip route del default via "${NETIF_IPADDR}"
awk "{print(\"route del \" \$1 \" via ${gateway}\")}" chnips.list | ip -batch -
for i in $EXCEPTION_LIST
do
ip route del "$i" via $gateway
done
exit
}
while :
do
read -n 1 key
if [[ $key == q ]]
then
kill -INT $tun2socks_pid
STOP
fi
done
wait $tun2socks_pid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment