User Tools

Site Tools


programming:count_ips_that_connect_a_specific_port_with_perl

Count ips that open a specific port with perl

For exemple with port 11212 :

netstat -npv 2>/dev/null |perl -lane 'BEGIN {my %out;} next unless $F[3] =~ /:11212/; $F[4] =~ /(.*):\d+/ and $out{$1}++; END { foreach $key (keys %out) { print "$out{$key} \t$key"; } }'|sort -n
programming/count_ips_that_connect_a_specific_port_with_perl.txt · Last modified: 2018/09/25 15:00 (external edit)