|
19 | 19 | my $debug = 0; |
20 | 20 | my $tail_pid = 0; |
21 | 21 | $ENV{PATH} = ''; # remove unsecure path |
22 | | -my $VERSION = '7.4'; |
| 22 | +my $VERSION = '7.5'; |
23 | 23 |
|
24 | 24 | use lib '/usr/lib/hawk/'; |
25 | 25 | use POSIX qw(setsid), qw(strftime), qw(WNOHANG); |
@@ -405,25 +405,31 @@ sub proftpd_broot { |
405 | 405 | sub cpanel_broot { |
406 | 406 | #209.62.36.16 - webmail.1h216.com [07/17/2008:16:12:49 -0000] "GET / HTTP/1.1" FAILED LOGIN webmaild: user password hash is miss |
407 | 407 | #201.245.82.85 - khaoib [07/17/2008:19:56:36 -0000] "POST / HTTP/1.1" FAILED LOGIN cpaneld: user name not provided or invalid user |
| 408 | + #[2023-11-27 11:56:16 -0500] info [cpaneld] 185.117.82.70 - dd "GET / HTTP/1.1" FAILED LOGIN cpaneld: user name not provided or invalid user |
408 | 409 | #[2023-11-27 11:29:46 -0500] info [whostmgrd] 185.117.82.70 - dd "GET / HTTP/1.1" FAILED LOGIN whostmgrd: login attempt to whm by a non-reseller/root |
409 | 410 |
|
410 | 411 | my @cpanel = split /\s+/, $_; |
411 | 412 | my $service = 4; # Service type is webmail by default |
412 | | - |
| 413 | + my $ip = $cpanel[5]; |
| 414 | + my $user = $cpanel[2]; |
413 | 415 |
|
414 | 416 | if ($cpanel[10] eq 'cpaneld:') { # Service type is cPanel if the log contains cpaneld: |
415 | 417 | $service = 5; |
| 418 | + $user = $cpanel[7] if $cpanel[1] ne '-'; |
416 | 419 | } elsif ($cpanel[5] eq '[whostmgrd]') { # Service type is WHM if the log contains [whostmgrd] |
417 | 420 | $service = 9; |
418 | | - $cpanel[0] = $cpanel[5]; # Set the IP in the proper place |
419 | | - $cpanel[2] = $cpanel[7]; # Set the User in the proper place |
| 421 | + $user = $cpanel[7]; |
| 422 | + } else { |
| 423 | + $ip = $cpanel[0]; |
420 | 424 | } |
421 | | - $cpanel[2] = 'unknown' if $cpanel[2] =~ /\[/; |
| 425 | + $user = 'unknown' if $user =~ /\[/; |
| 426 | + |
422 | 427 | # return ip, number of failed attempts, service under attack, failed username |
423 | 428 | # this is later stored to the failed_log table via store_to_db |
424 | 429 | # service id 4 -> webmail |
425 | 430 | # service id 5 -> cpanel |
426 | | - return ($cpanel[0], 1, $service, $cpanel[2]); |
| 431 | + # service id 9 -> whm |
| 432 | + return ($ip, 1, $service, $user); |
427 | 433 | } |
428 | 434 |
|
429 | 435 | sub da_broot { |
|
0 commit comments