Skip to content

Commit

Permalink
option to show rules added.
Browse files Browse the repository at this point in the history
  • Loading branch information
Incognito-Coder committed Apr 27, 2024
1 parent 2192362 commit 38d0664
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion iptables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ modify() {
done
echo "Finalizing Changes in IP Tables."
iptables -t nat -A POSTROUTING -j MASQUERADE -o $interface
menu
}

modify_nat() {
Expand All @@ -76,6 +77,7 @@ modify_nat() {
iptables -t nat -A PREROUTING -j DNAT --to-destination $ip
echo "Finalizing Changes in IP Tables."
iptables -t nat -A POSTROUTING -j MASQUERADE -o $interface
menu
}

port_to_port() {
Expand All @@ -94,6 +96,7 @@ port_to_port() {
iptables -t nat -A PREROUTING -p $proto --dport $ports -j DNAT --to-destination $ip:$dport
echo "Finalizing Changes in IP Tables."
iptables -t nat -A POSTROUTING -j MASQUERADE -o $interface
menu
}

flush() {
Expand All @@ -114,12 +117,14 @@ flush() {
$ipt -t mangle -X
$ipt -t raw -F
$ipt -t raw -X
menu
}

menu() {
clear
echo "Welcome to Easy Port Forwarder"
PS3='Please enter your choice: '
options=("Port Forward" "NAT Forward" "Port to Port" "Flush Rules" "Save Rules" "Restore Rules" "Print Usage" "Quit")
options=("Port Forward" "NAT Forward" "Port to Port" "Flush Rules" "Save Rules" "Restore Rules" "Show Rules" "Print Usage" "Quit")
select opt in "${options[@]}"; do
case $opt in
"Port Forward")
Expand Down Expand Up @@ -154,6 +159,11 @@ menu() {
sudo /sbin/iptables-restore </etc/iptables/rules.v4
echo "Restored."
;;
"Show Rules")
iptables -t nat --list
#!/bin/bash
read -n1 -r -p "Press any key to continue..."
;;
"Print Usage")
usage
break
Expand Down

0 comments on commit 38d0664

Please sign in to comment.