A netstat wrapper is availalable from CPAN, Net::Netstat, but the version tried does not work on Solaris7 , so Wrappers/Netstat.pm is used.
my $netstat = Netstat->new(PFORM => "OpenSuSE_9.3"); # ...or "Solaris_7" at present... foreach my $c (@{$netstat->connections()}) { # ...where $c has the following attributes: # # $c->{LOCAL_HOST} # $c->{REMOTE_HOST} # # $c->{LOCAL_PORT} # $c->{REMOTE_PORT} # # $c->{STATE} }
Add methods to encapsulate all attributes.
It should be simple to add support for other versions of Linux and/or Unix.
...previous | up (conts) | next... |