Skip to content

Commit

Permalink
Simpify the script
Browse files Browse the repository at this point in the history
  • Loading branch information
mahdavifar2002 committed Dec 16, 2023
1 parent 1c196f2 commit e7d25d2
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ while [[ $# -gt 0 ]]; do
shift # past argument
shift # past value
;;
-f|--family)
FAMILY="$2"
shift # past argument
shift # past value
;;
-a|--alireza)
ALIREZA="$2"
shift # past argument
Expand Down Expand Up @@ -94,23 +89,12 @@ if [ "$IRAN" == "YES" ]; then
sudo iptables -t nat -A PREROUTING -p tcp --dport 22 -j ACCEPT
# redirect alireza ports --------------------
if [ -v ALIREZA ]; then
sudo iptables -t nat -A PREROUTING -p tcp --dport 12612 -j DNAT --to-destination $ALIREZA
sudo iptables -t nat -A PREROUTING -p tcp --dport 8050 -j DNAT --to-destination $ALIREZA:8080
sudo iptables -t nat -A PREROUTING -p tcp -m multiport --dports 1000:6000 -j DNAT --to-destination $ALIREZA
fi
# redirect proxy ports ----------------------
if [ -v PROXY ]; then
sudo iptables -t nat -A PREROUTING -p tcp -m multiport --dports 80,443 -j DNAT --to-destination $PROXY
sudo iptables -t nat -A PREROUTING -p tcp -m multiport --dports 23 -j DNAT --to-destination $PROXY:22
sudo iptables -t nat -A PREROUTING -p tcp -m multiport --dports 445,777 -j DNAT --to-destination $PROXY:445
sudo iptables -t nat -A PREROUTING -p tcp --dport 8060 -j DNAT --to-destination $PROXY:8080
else
sudo iptables -t nat -A PREROUTING -p tcp -m multiport --dports 80,443 -j ACCEPT
fi
# redirect family ports ---------------------
if [ -v FAMILY ]; then
sudo iptables -t nat -A PREROUTING -p tcp --dport 543 -j DNAT --to-destination $FAMILY:443
sudo iptables -t nat -A PREROUTING -p tcp --dport 8070 -j DNAT --to-destination $FAMILY:8080
fi
# redirect other ports ----------------------
sudo iptables -t nat -A PREROUTING -p all -j DNAT --to-destination $SERVER
Expand Down

0 comments on commit e7d25d2

Please sign in to comment.