Skip to content

Commit a290984

Browse files
committed
Update
1 parent e0f3996 commit a290984

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ipban.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ function block_ip() {
1313
iptables -D INPUT -s $ip -j DROP
1414
fi
1515

16-
echo "$ip,$end_time" >> "$CSV_FILE"
16+
if ! awk -F',' -v ip="$ip" '$1 == ip' "$CSV_FILE" | grep -q .; then
17+
echo "$ip,$end_time" >> "$CSV_FILE"
18+
fi
1719

1820
iptables -A INPUT -s $ip -j DROP
1921
}

0 commit comments

Comments
 (0)