Trying to do a custom regex at /usr/local/csf/bin/regex.custom.pm to ban wp-login.php fail
Using NCSA extended/combined log format = "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-agent}i"
Example log entry (i only replaced external IP and name of the test site)_
Code: Select all
"151.11.222.111 - - [31/Jan/2021:08:35:51 +0000] "POST /wp-login.php HTTP/1.1" 200 2783 "https://myshinysite.com/wp-login.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36 Edg/88.0.705.56"
Trying something like that (according what i saw in previous threads) :
Code: Select all
if (($globlogs{CUSTOM1_LOG}{$lgfile}) and ($line =~ /(\S+).*] "\w*(?:GET|POST) \/wp-login\.php.*" /)) {
return ("wp-login.php WP ban",$1,"WPLOGINorWHATEVER","3","80,443,21,25,22,23","1");
}
Are you kind please, to help me in this goal ?
Thanks (and if you suggest me a book to learn regex you make me the happiest man in the world)