-
Notifications
You must be signed in to change notification settings - Fork 0
/
allowIncomingPorts.sh
26 lines (26 loc) · 1.02 KB
/
allowIncomingPorts.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
#!/bin/bash
if [ "$1" == "-h" ]; then
echo ""
echo " ========================================================= "
echo " \ allowIncomingPorts.sh / "
echo " \ Allow Incoming Connections to specified Ports / "
echo " \ Created by d43m0nhLInt3r / "
echo " ========================================================= "
echo ""
echo "Usage: ./allowIncomingPorts.sh"
echo "Dependencies: zenity & ufw"
echo "https://github.com/d43m0nhLInt3r/SimpleLinuxScripts"
exit 0
fi
IP=$(zenity --entry --name=allowIncomingPort --text=IP: --entry-text=127.0.0.1)
FP=$(zenity --entry --name=allowIncomingPort --text=from Port: --entry-text=20)
TP=$(zenity --entry --name=allowIncomingPort --text=to Port: --entry-text=22)
P=$(zenity --column 'UDP or TCP?' --list "udp" "tcp")
if [ "$P" == "udp" ]; then
sudo ufw allow from "$IP" to any port "$FP":"$TP" proto "$P"
elif [ "$P" == "tcp" ]; then
sudo ufw allow from "$IP" to any port "$FP":"$TP" proto "$P"
else
echo "Error"
fi
echo "Done"