improve IP address regex

This commit is contained in:
sceox 2021-12-27 15:27:52 -08:00
parent c64617f937
commit 19ddf883ee

View File

@ -13,7 +13,7 @@ test -f $cache || install -m 600 /dev/null $cache
tail $tail_opts $logf | while read line ; do tail $tail_opts $logf | while read line ; do
case $line in (*"POST"*) case $line in (*"POST"*)
ip=`echo $line | awk '{print $1}'` ip=`echo $line | awk '{print $1}'`
ip_regex=`echo $ip | sed 's/\./\\./g'` ip_regex=`echo $ip | sed 's/\./\\./g; s/^/^/; s/$/$/'`
if ! grep -q $ip_regex $cache; then if ! grep -q $ip_regex $cache; then
/usr/local/bin/forumspam.sh "$ip" && echo $ip >> $cache /usr/local/bin/forumspam.sh "$ip" && echo $ip >> $cache
fi fi