fix a few issues and bump to 0.0.1

This commit is contained in:
Zane C. B-H 2019-02-24 06:22:10 -06:00
parent 06d7442b8b
commit 2b60eacef3
2 changed files with 25 additions and 4 deletions

View File

@ -1,6 +1,10 @@
Revision history for Parse-Netstat-Search
0.0.1 2019-02-24/06:30
- Handle where FreeBSD does not state LISTEN.
- Add a missing error flag.
- If state is not defined use '?'.
0.0.0 2019-02-20/06:00
-Initial release.

View File

@ -12,11 +12,11 @@ Parse::Netstat::Search - Searches the connection list in the results returned by
=head1 VERSION
Version 0.0.0
Version 0.0.1
=cut
our $VERSION = '0.0.0';
our $VERSION = '0.0.1';
=head1 SYNOPSIS
@ -37,6 +37,8 @@ our $VERSION = '0.0.0';
Two big things to bet aware of is this module does not currently resulve names and this module
does not handle unix sockets. Unix sockets will just be skipped over.
If it comes across instance where the state is undefined, it is set to '?'.
=head1 methods
=head2 new
@ -57,6 +59,7 @@ sub new{
errorExtra=>{
'1'=>'badCIDR',
'2' =>'unknownService',
'3'=>'badResults',
},
cidrs=>[],
protocols=>{},
@ -221,6 +224,19 @@ sub search{
my $sendq=$res->[2]->{active_conns}->[$res_int]->{sendq};
my $recvq=$res->[2]->{active_conns}->[$res_int]->{recvq};
# works around a edge case in which Parse::Netstat does not properly handle LISTEN ports
if (
( $foreign_host eq '*' ) &&
( ! defined( $state ) )
){
$state='LISTEN';
}
# sometimes no state appears to be returned for UDP
if ( !defined( $state ) ){
$state='?';
}
# checks for making sure a check is meet... defaults to 1
my $port_meet=1;
my $cidr_meet=1;
@ -293,12 +309,13 @@ sub search{
){
push( @found, {
'foreign_port'=>$foreign_port,
'foriegn_host'=>$foreign_host,
'foreign_host'=>$foreign_host,
'local_port'=>$local_port,
'local_host'=>$local_host,
'sendq'=>$sendq,
'recvq'=>$recvq,
'proto'=>$protocol,
'state'=>$state,
}
);
}