Created
December 15, 2017 12:43
-
-
Save SergeyStorm/6c39e602e53ccb6501081b01260e695c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
# 222.169.193.162 - - [15/Dec/2017:07:24:34 -0500] "GET / HTTP/1.0" 302 483 "-" "Mozilla/5.0 (BlackBerry; U; BlackBerry 9850; en) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.0.0.254 Mobile Safari/534.11+" | |
my %ips; | |
my $cnt = 0; | |
while ( my $line = <STDIN> ) { | |
my @f = split( ' ', $line ); | |
$ips{ $f[0] } += 1; | |
#$ips{ $f[0] }{ agent } = $f[ | |
$cnt++; | |
if ( $cnt >= 10 ) { | |
$cnt = 0; | |
print `clear`; | |
print '----------------'."\n"; | |
for my $ip ( sort keys %ips ) { | |
next if $ips{ $ip } <= 10; | |
print $ip.' '.$ips{ $ip }."\n"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment