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
Copy file name to clipboardExpand all lines: x-ui.sh
+3-3
Original file line number
Diff line number
Diff line change
@@ -1406,7 +1406,7 @@ iplimit_main() {
1406
1406
;;
1407
1407
5)
1408
1408
read -rp "Enter the IP address you want to ban: " ban_ip
1409
-
if [[ $ban_ip=~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]];then
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
1410
1410
fail2ban-client set 3x-ipl banip "$ban_ip"
1411
1411
echo -e "${green}IP Address ${ban_ip} has been banned successfully.${plain}"
1412
1412
else
@@ -1416,7 +1416,7 @@ iplimit_main() {
1416
1416
;;
1417
1417
6)
1418
1418
read -rp "Enter the IP address you want to unban: " unban_ip
1419
-
if [[ $unban_ip=~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]];then
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
1420
1420
fail2ban-client set 3x-ipl unbanip "$unban_ip"
1421
1421
echo -e "${green}IP Address ${unban_ip} has been unbanned successfully.${plain}"
1422
1422
else
@@ -1440,7 +1440,7 @@ iplimit_main() {
1440
1440
remove_iplimit
1441
1441
iplimit_main
1442
1442
;;
1443
-
*)
1443
+
*)
1444
1444
echo -e "${red}Invalid option. Please select a valid number.${plain}\n"
0 commit comments