Need some help with regex.custom.pm.
Posted: 21 Jun 2017, 21:05
I am trying to get the following to work under one rule:
SERVER is the hostanme, SITE is the sites domain name, and IP is the IP address from the attacker.
So the following works when testing from perl itself (testing concept borrowed from another post):
But when I place the following line in regex.custom.pm it doesn't work:
Regex is not my strong suite and I would appreciate some help. If more information is needed, just let me know.
Code: Select all
Jun 19 09:36:02 SERVER wp(SITE)[20246]: Authentication attempt for unknown user Admin from IP
Jun 20 19:03:38 SERVER wp(SITE)[2740]: XML-RPC authentication failure from IP
Jun 20 08:13:55 SERVER wp(SITE)[9518]: Authentication failure for admin from IP
Jun 21 14:49:46 SERVER wordpress(SITE)[14990]: XML-RPC authentication failure for admin from IP
Jun 21 14:49:48 SERVER wordpress(SITE)[14995]: Authentication failure for admin from IP
So the following works when testing from perl itself (testing concept borrowed from another post):
Code: Select all
#!/usr/local/cpanel/3rdparty/bin/perl
#$line = 'Jun 21 14:49:46 SERVER wordpress(SITE)[14990]: XML-RPC authentication failure for admin from IP';
#$line = 'Jun 20 08:14:31 SERVER wp(globalmotherdivine.org)[9711]: Authentication failure for daiello from IP';
#$line = 'Jun 19 09:36:02 SERVER wp(fairfieldinfocenter.org)[20246]: Authentication attempt for unknown user Admin from IP';
$line = 'Jun 20 19:03:38 SERVER wp(SITE)[2740]: XML-RPC authentication failure from IP';
if ( ($line =~ /w(ord)?p(ress)?.*: (XML-RPC )?(A|a)uthentication failure (for( unknown user)? .* )?from (\S+)/)) {
print ("Failed wp-login.php login from",$1,"wp-login.php","1","80","60");
}
Code: Select all
if (($lgfile eq $config{SYSLOG_LOG}) and ($line =~ /w(ord)?p(ress)?.*: (XML-RPC )?(A|a)uthentication failure (for( unknown user)? .* )?from (\S+)/)) {
return ("Failed WordPress login from",$1,"wordpressbf","5","80,443","3600");
}