-
Notifications
You must be signed in to change notification settings - Fork 0
/
ipt.sh
executable file
·114 lines (104 loc) · 2.95 KB
/
ipt.sh
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash
source "lib/basic.sh"
source "lib/rule_handling.sh"
source "lib/colors.sh"
source "lib/define.sh"
source "lib/rule_management.sh"
# Default policies
DEFAULT_POLICY="DROP"
LOOPBACK_POLICY="ACCEPT"
interface=""
see_all_interfaces
while [ true ]; do
read -p "Enter The WAN interface name : " interface
if ip link show "$interface" >/dev/null 2>&1; then
# echo -e "${BRIGHT_WHITE} WAN DEv s"
echo -e "${GREEN}Selected WAN interface : $interface ${RESET}"
break
else
echo -e "${RED} WRONG interface selected : $interface ${RESET}"
fi
done
# Flush iptables rules
sudo iptables -F
sudo iptables -t nat -F
# wan_dev = $(select_dev)
basic $interface
handle_ip_traffic
handle_services
clear
while [ true ]; do
# clear
echo -e "${BRIGHT_MAGENTA}********************************************************${RESET}"
echo -e "${BRIGHT_YELLOW}Menu${RESET}"
echo -e "${BRIGHT_MAGENTA}********************************************************${RESET}"
for option in "${options[@]}"; do
echo -e "${BRIGHT_WHITE} ${option}${RESET}"
done
echo -e "${BRIGHT_MAGENTA}********************************************************${RESET}"
echo -e "Enter your menu choice ${BRIGHT_MAGENTA}[1-10]${RESET}: "
read choice
case $choice in
1)
echo "You have selected the option 1"
rule_mand
;;
2)
echo "You have selected the option 2"
port_forwarding $interface
;;
3)
echo "You have selected the option 3"
create_network_segments
;;
4)
echo "You have selected the option 4"
see_all_interfaces
;;
5)
echo "You have selected the option 5"
View_rules
;;
6)
echo "You have selected the option 6"
#
del_mand
;;
7)
echo "You have selected the option 7"
rule_modify
;;
8)
echo "You have selected the option 8"
echo -e "${CYAN} SAVING RULES .... > rules.v4${RESET}"
sudo iptables-save >rules.v4
sudo iptables-save >/etc/iptables/rules.v4
sudo systemctl restart iptables
echo -e "${CYAN}Done..${RESET}"
;;
9)
echo "You have selected the option 9"
echo -e "${BRIGHT_BLUE}Restart iptables ${RESET}"
sudo systemctl restart iptables
;;
10)
echo "Quitting ..."
# exit
break
;;
11)
clear
;;
*) echo "invalid option" ;;
esac
# clear
done
echo -e "${BRIGHT_MAGENTA}********************************************************${RESET}"
sudo iptables -L -v -n
echo -e "${BRIGHT_MAGENTA}********************************************************${RESET}"
sudo iptables -t nat -L
echo -e "${BRIGHT_MAGENTA}********************************************************${RESET}"
sudo iptables -F
sudo iptables -t nat -F
echo -e "${CYAN}Flusing all the Rules....!"
# iptables -A INPUT -i lo -j $LOOPBACK_POLICY