forked from abdoxfox/HTTP-CUSTOM-HEADERS-VPN
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathproxification
25 lines (23 loc) · 933 Bytes
/
proxification
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
reds=$(iptables -w -t nat -L -n|grep REDSOCKS|awk -F " " '{print $1}')
[[ -z $reds ]] || { iptables -w -t nat -F REDSOCKS;iptables -w -t nat -X REDSOCKS; }
iptables -t nat -N REDSOCKS
iptables -t nat -A REDSOCKS -d 0.0.0.0/8 -j ACCEPT
iptables -t nat -A REDSOCKS -d 10.0.0.0/8 -j ACCEPT
iptables -t nat -A REDSOCKS -d 127.0.0.0/8 -j ACCEPT
iptables -t nat -A REDSOCKS -d 169.254.0.0/16 -j ACCEPT
iptables -t nat -A REDSOCKS -d 172.16.0.0/12 -j ACCEPT
iptables -t nat -A REDSOCKS -d 192.168.0.0/16 -j ACCEPT
iptables -t nat -A REDSOCKS -p tcp -j REDIRECT --to-ports 8124
iptables -t nat -A OUTPUT -p tcp -j REDSOCKS
iptables -t nat -A PREROUTING -p tcp -d 192.168.0.0/16 -j ACCEPT
iptables -t nat -A PREROUTING -p tcp -j REDIRECT --to-ports 8124
# run socksifier
bit=`getconf LONG_BIT`
if [ "$bit" = "64" ];then
chmod +x redsocks
./redsocks64 -c redsocks.conf
else
chmod +x redsocks64
./redsocks -c redsocks.conf
fi