forked from suhailsherif/IITG-Transparent-Proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script
executable file
·28 lines (28 loc) · 1.02 KB
/
script
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
26
27
28
#!/bin/sh
case $1 in
start)
sudo iptables -t nat -A OUTPUT -p udp --dport 53 -j REDIRECT --to 55
sudo iptables -t nat -A OUTPUT -d 127.0.0.0/8 -j RETURN
sudo iptables -t nat -A OUTPUT -p tcp -d 10.0.0.0/8 -j RETURN
sudo iptables -t nat -A OUTPUT -p tcp -d 172.16.0.0/16 -j RETURN
sudo iptables -t nat -A OUTPUT -p tcp -d 192.168.1.1/16 -j RETURN
sudo iptables -t nat -A OUTPUT -p tcp -d 202.141.80.22/24 -j RETURN
sudo iptables -t nat -A OUTPUT -p tcp -d 202.141.81.22/24 -j RETURN
sudo iptables -t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT --to 8123
sudo iptables -t nat -A OUTPUT -p tcp --dport 443 -j REDIRECT --to 8124
sudo iptables -t nat -A OUTPUT -p tcp --dport 5228 -j REDIRECT --to 8124
echo "nameserver 127.0.0.1" > temp.conf
sudo mv /etc/resolv.conf /etc/resolv.conf.bckup
sudo mv temp.conf /etc/resolv.conf
sudo chown root:root /etc/resolv.conf
sudo chmod 644 /etc/resolv.conf
;;
stop)
if [ -f /etc/resolv.conf.bckup ]
then
sudo mv /etc/resolv.conf.bckup /etc/resolv.conf
fi
sudo sudo iptables -t nat -F OUTPUT
;;
esac
exit