You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
echo -e "\n${green}\t1.${plain} Install Fail2ban and configure IP Limit"
1358
1363
echo -e "${green}\t2.${plain} Change Ban Duration"
@@ -1406,7 +1411,8 @@ iplimit_main() {
1406
1411
;;
1407
1412
5)
1408
1413
read -rp "Enter the IP address you want to ban: " ban_ip
1409
-
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
1414
+
ip_validation
1415
+
if [[ $ban_ip=~$ipv4_regex||$ban_ip=~$ipv6_regex ]];then
1410
1416
fail2ban-client set 3x-ipl banip "$ban_ip"
1411
1417
echo -e "${green}IP Address ${ban_ip} has been banned successfully.${plain}"
1412
1418
else
@@ -1416,7 +1422,8 @@ iplimit_main() {
1416
1422
;;
1417
1423
6)
1418
1424
read -rp "Enter the IP address you want to unban: " unban_ip
1419
-
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
1425
+
ip_validation
1426
+
if [[ $unban_ip=~$ipv4_regex||$unban_ip=~$ipv6_regex ]];then
1420
1427
fail2ban-client set 3x-ipl unbanip "$unban_ip"
1421
1428
echo -e "${green}IP Address ${unban_ip} has been unbanned successfully.${plain}"
0 commit comments