Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormhsanaei <ho3ein.sanaei@gmail.com>2024-12-18 14:31:05 +0300
committermhsanaei <ho3ein.sanaei@gmail.com>2024-12-18 14:31:05 +0300
commit0fb0df70561f53290ccecdba992ebbaf382a8e4f (patch)
treed9367b13495844d4d8199f3bdd681728c4315b21 /x-ui.sh
parent73e90e0eaa179e1f9e2ed1b0d697350f5a542880 (diff)
fail2ban - ipv4 & 6
Diffstat (limited to 'x-ui.sh')
-rw-r--r--x-ui.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/x-ui.sh b/x-ui.sh
index 3d624147..9816f4a7 100644
--- a/x-ui.sh
+++ b/x-ui.sh
@@ -1406,7 +1406,7 @@ iplimit_main() {
;;
5)
read -rp "Enter the IP address you want to ban: " ban_ip
- if [[ $ban_ip =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
+ if [[ $ban_ip =~ ^(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9]))$ || $ban_ip =~ ^(([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})$ ]]; then
fail2ban-client set 3x-ipl banip "$ban_ip"
echo -e "${green}IP Address ${ban_ip} has been banned successfully.${plain}"
else
@@ -1416,7 +1416,7 @@ iplimit_main() {
;;
6)
read -rp "Enter the IP address you want to unban: " unban_ip
- if [[ $unban_ip =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
+ if [[ $unban_ip =~ ^(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9]))$ || $unban_ip =~ ^(([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})$ ]]; then
fail2ban-client set 3x-ipl unbanip "$unban_ip"
echo -e "${green}IP Address ${unban_ip} has been unbanned successfully.${plain}"
else
@@ -1440,7 +1440,7 @@ iplimit_main() {
remove_iplimit
iplimit_main
;;
- *)
+ *)
echo -e "${red}Invalid option. Please select a valid number.${plain}\n"
iplimit_main
;;