Skip to content

Instantly share code, notes, and snippets.

@SergeyStorm
Created December 15, 2017 12:43
Show Gist options
  • Save SergeyStorm/6c39e602e53ccb6501081b01260e695c to your computer and use it in GitHub Desktop.
Save SergeyStorm/6c39e602e53ccb6501081b01260e695c to your computer and use it in GitHub Desktop.
#!/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