| 1 | package Parse::Netstat::Colorizer; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use 5.006; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use base 'Error::Helper'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use Parse::Netstat; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Parse::Netstat::Search; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use Parse::Netstat::Search::Sort; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use Term::ANSIColor; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use Text::Table; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use Net::DNS; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | Parse::Netstat::Colorizer - Searches and colorizes the output from Parse::Netstat | ||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | Version 0.1.0 | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 2 | our $VERSION = '0.1.0'; | |||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | use Parse::Netstat; | ||||||||||||||||||||||||||||||||||||||||||
| 30 | use Parse::Netstat::Colorizer; | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | my $pnc = Parse::Netstat::Colorizer->new(); | ||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | # don't even bother parsing unix sockets... Parse::Netstat::Search, Parse::Netsat::Search::Sort; | ||||||||||||||||||||||||||||||||||||||||||
| 35 | # and this only currently handle non-unix network connections | ||||||||||||||||||||||||||||||||||||||||||
| 36 | my $res = parse_netstat(output => join("", `netstat -n`), tcp=>1, udp=>1, unix=>0, flavor=>$^O); | ||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | # search only for connections to/from specific networks | ||||||||||||||||||||||||||||||||||||||||||
| 39 | my @networks=('192.168.0.0/24', '10.10.10.0/24'); | ||||||||||||||||||||||||||||||||||||||||||
| 40 | my $search=$pnc->get_search; | ||||||||||||||||||||||||||||||||||||||||||
| 41 | $search->set_cidrs( \@networks ); | ||||||||||||||||||||||||||||||||||||||||||
| 42 | if ( $search->error ){ | ||||||||||||||||||||||||||||||||||||||||||
| 43 | warn( 'One of the passed CIDRs is bad' ); | ||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | # set it to host local sort | ||||||||||||||||||||||||||||||||||||||||||
| 47 | my $sorter=$pnc->get_sort; | ||||||||||||||||||||||||||||||||||||||||||
| 48 | $sorter->set_sort( 'host_l' ); | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | Sorting and searching is handled via L<Parse::Netsat::Search> and | ||||||||||||||||||||||||||||||||||||||||||
| 51 | L<Parse::Netstat::Search::Sort>. Their objects for tweaking can be | ||||||||||||||||||||||||||||||||||||||||||
| 52 | fetched via get_sort and get_search. | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | L<Net::DNS::Resolver> is used for resolving hostnames. | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | Creates a new object. This will never error. | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | my $pnc->new; | ||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 1 | my $self={ | |||||||||||||||||||||||||||||||||||||||||
| 68 | perror=>undef, | ||||||||||||||||||||||||||||||||||||||||||
| 69 | error=>undef, | ||||||||||||||||||||||||||||||||||||||||||
| 70 | errorString=>'', | ||||||||||||||||||||||||||||||||||||||||||
| 71 | errorExtra=>{ | ||||||||||||||||||||||||||||||||||||||||||
| 72 | 1 => 'badResults', | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 2 => 'searchErrored', | ||||||||||||||||||||||||||||||||||||||||||
| 74 | 3 => 'sortErrored', | ||||||||||||||||||||||||||||||||||||||||||
| 75 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 76 | os=>$^O, | ||||||||||||||||||||||||||||||||||||||||||
| 77 | invert=>undef, | ||||||||||||||||||||||||||||||||||||||||||
| 78 | port_resolve=>1, | ||||||||||||||||||||||||||||||||||||||||||
| 79 | search=>Parse::Netstat::Search->new, | ||||||||||||||||||||||||||||||||||||||||||
| 80 | sort=>Parse::Netstat::Search::Sort->new, | ||||||||||||||||||||||||||||||||||||||||||
| 81 | resolver=>Net::DNS::Resolver->new, | ||||||||||||||||||||||||||||||||||||||||||
| 82 | use_ptr=>1, | ||||||||||||||||||||||||||||||||||||||||||
| 83 | no_color=>0, | ||||||||||||||||||||||||||||||||||||||||||
| 84 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 85 | 1 | bless $self; | |||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | =head1 colorize | ||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | This runs the configured search and colorizes | ||||||||||||||||||||||||||||||||||||||||||
| 93 | the output. | ||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | One value is taken and that is the array ref returned | ||||||||||||||||||||||||||||||||||||||||||
| 96 | by Parse::Netstat. | ||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | my $colorized=$pnc->colorize($res); | ||||||||||||||||||||||||||||||||||||||||||
| 99 | if ( $pnc->error ){ | ||||||||||||||||||||||||||||||||||||||||||
| 100 | warn( 'Either $res is not valid post a basic check or sorting failed. | ||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | 1 | ▶ | sub colorize{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
colorize: called CC=19 SCAR=40.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | 1 | my $self=$_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 107 | 1 | my $res=$_[1]; | |||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 1 | ▶ | if( ! $self->errorblank ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | #make sure what ever we are passed is sane and very likely a return from Parse::Netdata | ||||||||||||||||||||||||||||||||||||||||||
| 114 | 1 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
ref $res ne "ARRAY" or not defined $res->[2] or not defined $res->[2]{"active_conns"}
ref $res ne "ARRAY" or not defined $res->[2]
MC/DC0%0/3
ref $res ne "ARRAY" or not defined $res->[2] or not defined $res->[2]{"active_conns"}
ref $res ne "ARRAY"
not defined $res->[2]
not defined $res->[2]{"active_conns"}
Truth table25%1/4
A or not(B) or not(C)
A= ref $res ne "ARRAY"B= not defined $res->[2]C= not defined $res->[2]{"active_conns"}
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | ( ref( $res ) ne 'ARRAY' ) || | ||||||||||||||||||||||||||||||||||||||||||
| 116 | ( ! defined( $res->[2] ) ) || | ||||||||||||||||||||||||||||||||||||||||||
| 117 | ( ! defined( $res->[2]->{active_conns} ) ) | ||||||||||||||||||||||||||||||||||||||||||
| 118 | ){ | ||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | $self->{error}=1; | |||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | $self->{errorString}='$res->[2]->{active_conns} not defiend. Does not appear to be a Parse::Netstat return'; | |||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | $self->warn; | |||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | 1 | my @found=$self->{search}->search( $res ); | |||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | # sort it all | ||||||||||||||||||||||||||||||||||||||||||
| 128 | 1 | @found=$self->{sort}->sort( \@found ); | |||||||||||||||||||||||||||||||||||||||||
| 129 | 1 | ▶ | if ( $self->{sort}->error ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | $self->{error}=3; | |||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | $self->{errorString}='Sort failed'; | |||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | $self->warn; | |||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | # invert if needed | ||||||||||||||||||||||||||||||||||||||||||
| 137 | 1 | ▶ | if ( $self->{invert} ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | @found=reverse(@found); | |||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | # Holds colorized lines for the table. | ||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | 1 | my @colored; | |||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | 1 | ▶ | if ( $self->{no_color} ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | push( @colored, ([ | |||||||||||||||||||||||||||||||||||||||||
| 147 | color('underline').'Proto'.color('reset'), | ||||||||||||||||||||||||||||||||||||||||||
| 148 | color('underline').'SendQ'.color('reset'), | ||||||||||||||||||||||||||||||||||||||||||
| 149 | color('underline').'RecvQ'.color('reset'), | ||||||||||||||||||||||||||||||||||||||||||
| 150 | color('underline').'Local Host'.color('reset'), | ||||||||||||||||||||||||||||||||||||||||||
| 151 | color('underline').'Port'.color('reset'), | ||||||||||||||||||||||||||||||||||||||||||
| 152 | color('underline').'Remote Host'.color('reset'), | ||||||||||||||||||||||||||||||||||||||||||
| 153 | color('underline').'Port'.color('reset'), | ||||||||||||||||||||||||||||||||||||||||||
| 154 | color('underline').'State'.color('reset'), | ||||||||||||||||||||||||||||||||||||||||||
| 155 | ]) | ||||||||||||||||||||||||||||||||||||||||||
| 156 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 157 | }else{ | ||||||||||||||||||||||||||||||||||||||||||
| 158 | 1 | push( @colored, ([ | |||||||||||||||||||||||||||||||||||||||||
| 159 | color('underline white').'Proto'.color('reset'), | ||||||||||||||||||||||||||||||||||||||||||
| 160 | color('underline white').'SendQ'.color('reset'), | ||||||||||||||||||||||||||||||||||||||||||
| 161 | color('underline white').'RecvQ'.color('reset'), | ||||||||||||||||||||||||||||||||||||||||||
| 162 | color('underline white').'Local Host'.color('reset'), | ||||||||||||||||||||||||||||||||||||||||||
| 163 | color('underline white').'Port'.color('reset'), | ||||||||||||||||||||||||||||||||||||||||||
| 164 | color('underline white').'Remote Host'.color('reset'), | ||||||||||||||||||||||||||||||||||||||||||
| 165 | color('underline white').'Port'.color('reset'), | ||||||||||||||||||||||||||||||||||||||||||
| 166 | color('underline white').'State'.color('reset'), | ||||||||||||||||||||||||||||||||||||||||||
| 167 | ]) | ||||||||||||||||||||||||||||||||||||||||||
| 168 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||
| 171 | # process each connection | ||||||||||||||||||||||||||||||||||||||||||
| 172 | 1 | my $conn=pop(@found); | |||||||||||||||||||||||||||||||||||||||||
| 173 | 1 | ▶ | while ( defined( $conn->{local_port} ) ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | 7 | my $port_l=$conn->{local_port}; | |||||||||||||||||||||||||||||||||||||||||
| 175 | 7 | my $port_f=$conn->{foreign_port}; | |||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | #resolve port numbers if needed | ||||||||||||||||||||||||||||||||||||||||||
| 178 | 7 | ▶ | if ( $self->{port_resolve} ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | my $port_l_search=getservbyport( $port_l, '' ); | |||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | ▶ | if ( defined( $port_l_search ) ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | $port_l=$port_l_search; | |||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | # make sure we have have a actual number | ||||||||||||||||||||||||||||||||||||||||||
| 185 | # UDP may not have one of these listed | ||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | if ( $port_f =~ /^\d+$/ ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | my $port_f_search=getservbyport( $port_f, '' ); | |||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | if ( defined( $port_f_search ) ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | $port_f=$port_f_search; | |||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | 7 | ▶ | if ( $self->{use_ptr} ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 195 | 7 | my $answer_f=$self->{resolver}->search( $conn->{foreign_host} ); | |||||||||||||||||||||||||||||||||||||||||
| 196 | 7 | my $answer_l=$self->{resolver}->search( $conn->{local_host} ); | |||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | 7 | ▶ | if ( defined( $answer_f->{answer}[0] ) && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $answer_f->{"answer"}[0] and ref $answer_f->{"answer"}[0] eq "Net::DNS::RR::PTR"
MC/DC0%0/2
defined $answer_f->{"answer"}[0] and ref $answer_f->{"answer"}[0] eq "Net::DNS::RR::PTR"
defined $answer_f->{"answer"}[0]
ref $answer_f->{"answer"}[0] eq "Net::DNS::RR::PTR"
Truth table33%1/3
A and B
A= defined $answer_f->{"answer"}[0]B= ref $answer_f->{"answer"}[0] eq "Net::DNS::RR::PTR"
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | ( ref( $answer_f->{answer}[0] ) eq 'Net::DNS::RR::PTR' ) | ||||||||||||||||||||||||||||||||||||||||||
| 200 | ){ | ||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | $conn->{foreign_host}=lc($answer_f->{answer}[0]->ptrdname); | |||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | 7 | ▶ | if ( defined( $answer_l->{answer}[0] ) && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $answer_l->{"answer"}[0] and ref $answer_l->{"answer"}[0] eq "Net::DNS::RR::PTR"
MC/DC50%1/2
defined $answer_l->{"answer"}[0] and ref $answer_l->{"answer"}[0] eq "Net::DNS::RR::PTR"
defined $answer_l->{"answer"}[0]
ref $answer_l->{"answer"}[0] eq "Net::DNS::RR::PTR"
Truth table66%2/3
A and B
A= defined $answer_l->{"answer"}[0]B= ref $answer_l->{"answer"}[0] eq "Net::DNS::RR::PTR"
| |||||||||||||||||||||||||||||||||||||||||||
| 205 | ( ref( $answer_l->{answer}[0] ) eq 'Net::DNS::RR::PTR' ) | ||||||||||||||||||||||||||||||||||||||||||
| 206 | ){ | ||||||||||||||||||||||||||||||||||||||||||
| 207 | 1 | $conn->{local_host}=lc($answer_l->{answer}[0]->ptrdname); | |||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | 7 | ▶ | if ( $self->{no_color} ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | push( @colored, ([ | ||||||||||||||||||||||||||||||||||||||||||
| 213 | $conn->{proto}, | ||||||||||||||||||||||||||||||||||||||||||
| 214 | $conn->{sendq}, | ||||||||||||||||||||||||||||||||||||||||||
| 215 | $conn->{recvq}, | ||||||||||||||||||||||||||||||||||||||||||
| 216 | $conn->{local_host}, | ||||||||||||||||||||||||||||||||||||||||||
| 217 | $port_l, | ||||||||||||||||||||||||||||||||||||||||||
| 218 | $conn->{foreign_host}, | ||||||||||||||||||||||||||||||||||||||||||
| 219 | $port_f, | ||||||||||||||||||||||||||||||||||||||||||
| 220 | $conn->{state}, | ||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | ]) | |||||||||||||||||||||||||||||||||||||||||
| 222 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 223 | }else{ | ||||||||||||||||||||||||||||||||||||||||||
| 224 | push( @colored, ([ | ||||||||||||||||||||||||||||||||||||||||||
| 225 | color('BRIGHT_YELLOW').$conn->{proto}.color('reset'), | ||||||||||||||||||||||||||||||||||||||||||
| 226 | color('BRIGHT_CYAN').$conn->{sendq}.color('reset'), | ||||||||||||||||||||||||||||||||||||||||||
| 227 | color('BRIGHT_RED').$conn->{recvq}.color('reset'), | ||||||||||||||||||||||||||||||||||||||||||
| 228 | color('BRIGHT_GREEN').$conn->{local_host}.color('reset'), | ||||||||||||||||||||||||||||||||||||||||||
| 229 | color('GREEN').$port_l.color('reset'), | ||||||||||||||||||||||||||||||||||||||||||
| 230 | color('BRIGHT_MAGENTA').$conn->{foreign_host}.color('reset'), | ||||||||||||||||||||||||||||||||||||||||||
| 231 | color('MAGENTA').$port_f.color('reset'), | ||||||||||||||||||||||||||||||||||||||||||
| 232 | 7 | color('BRIGHT_BLUE').$conn->{state}.color('reset'), | |||||||||||||||||||||||||||||||||||||||||
| 233 | ]) | ||||||||||||||||||||||||||||||||||||||||||
| 234 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | 7 | $conn=pop(@found); | |||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||
| 240 | 1 | my $tb = Text::Table->new; | |||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | 1 | return $tb->load( @colored ); | |||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||
| 245 | =head2 get_invert | ||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | This returns a boolean as to if the return | ||||||||||||||||||||||||||||||||||||||||||
| 248 | from the sort is inverted or not. | ||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||
| 250 | my $invert=$pnc->get_invert; | ||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | 3 | ▶ | sub get_invert{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_invert: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | 3 | my $self=$_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | 3 | ▶ | if( ! $self->errorblank ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | 3 | return $self->{invert}; | |||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||
| 264 | =head2 get_no_color | ||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | This returns a boolean as to if the return | ||||||||||||||||||||||||||||||||||||||||||
| 267 | is to be colorized or not. | ||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||
| 269 | my $no_color=$pnc->get_no_color; | ||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||
| 273 | 3 | ▶ | sub get_no_color{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_no_color: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 274 | 3 | my $self=$_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||
| 276 | 3 | ▶ | if( ! $self->errorblank ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | 3 | return $self->{no_color}; | |||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||
| 283 | =head2 get_port_resolve | ||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | This gets the port_resolve value, which is if it should try to resolve | ||||||||||||||||||||||||||||||||||||||||||
| 286 | port names or not. | ||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||
| 288 | The returned value is a boolean and defaults to 1. | ||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||
| 290 | my $port_resolve=$pnc->get_port_resolve; | ||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||
| 292 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | 3 | ▶ | sub get_port_resolve{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_port_resolve: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 295 | 3 | my $self=$_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | 3 | ▶ | if( ! $self->errorblank ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | 3 | return $self->{port_resolve}; | |||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||
| 304 | =head2 get_ptr_resolve | ||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||
| 306 | This gets the current setting for if it should resolve | ||||||||||||||||||||||||||||||||||||||||||
| 307 | IPs to PTRs or not. | ||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||
| 309 | The returned value is a boolean and defaults to 1. | ||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||
| 311 | my $use_ptr=$pnc->get_ptr_resolve; | ||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||
| 313 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | ▶ | sub get_ptr_resolve{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_ptr_resolve: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | my $self=$_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | ▶ | if( ! $self->errorblank ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | return $self->{use_ptr}; | |||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | =head2 get_resolver | ||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||
| 327 | This returns the L<Net::DNS::Resolver> object used | ||||||||||||||||||||||||||||||||||||||||||
| 328 | for resolving IPs to PTRs. | ||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | my $resolver=$pnc->get_resolver; | ||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||
| 332 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | ▶ | sub get_resolver{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_resolver: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | my $self=$_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | if( ! $self->errorblank ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | return $self->{resolver}; | |||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||
| 344 | =head1 get_search | ||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||
| 346 | This returns the Parse::Netstat::Search object. | ||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | my $search=$pnc->get_search; | ||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||
| 350 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | ▶ | sub get_search{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_search: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | my $self=$_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | ▶ | if( ! $self->errorblank ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | return $self->{search}; | |||||||||||||||||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||
| 362 | =head1 get_sort | ||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||
| 364 | This returns the Parse::Netstat::Search::Sort object. | ||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||
| 366 | my $sorter=$pnc->get_sort; | ||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||
| 368 | # set it to host local sort | ||||||||||||||||||||||||||||||||||||||||||
| 369 | $sorter->set_sort( 'host_l' ); | ||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||
| 371 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | ▶ | sub get_sort{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_sort: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | my $self=$_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | ▶ | if( ! $self->errorblank ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | return $self->{sort}; | |||||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||
| 383 | =head2 set_invert | ||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||
| 385 | This sets wether or not it should invert the | ||||||||||||||||||||||||||||||||||||||||||
| 386 | returned sort or not. | ||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||
| 388 | # sets it to false, the default | ||||||||||||||||||||||||||||||||||||||||||
| 389 | $pnc->set_invert; | ||||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||
| 391 | # the results will be inverted | ||||||||||||||||||||||||||||||||||||||||||
| 392 | $pnc->set_invert(1); | ||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||
| 394 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||
| 396 | 2 | ▶ | sub set_invert{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_invert: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 397 | 2 | my $self=$_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||
| 399 | 2 | ▶ | if( ! $self->errorblank ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||
| 403 | 2 | $self->{invert}=$_[1]; | |||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||
| 405 | 2 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||
| 408 | =head2 set_no_color | ||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||
| 410 | This sets wether or not the return from | ||||||||||||||||||||||||||||||||||||||||||
| 411 | colorized should be colored or not. | ||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||
| 413 | # sets it to false, the default | ||||||||||||||||||||||||||||||||||||||||||
| 414 | $pnc->set_no_color; | ||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||
| 416 | # the results will by the default console | ||||||||||||||||||||||||||||||||||||||||||
| 417 | # text color when printed | ||||||||||||||||||||||||||||||||||||||||||
| 418 | $pnc->set_no_color(1); | ||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||
| 420 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||
| 422 | 2 | ▶ | sub set_no_color{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_no_color: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 423 | 2 | my $self=$_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||
| 425 | 2 | ▶ | if( ! $self->errorblank ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||
| 429 | 2 | $self->{no_color}=$_[1]; | |||||||||||||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||
| 432 | =head2 set_port_resolve | ||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||
| 434 | This sets wether or not the ports should be resolved or not. | ||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||
| 436 | One value is taken and that is a perl boolean. | ||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||
| 438 | # sets it to true, the default | ||||||||||||||||||||||||||||||||||||||||||
| 439 | $pnc->set_port_resolve(1); | ||||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||
| 441 | # set it false, don't resolve the ports | ||||||||||||||||||||||||||||||||||||||||||
| 442 | $pnc->set_port_resolve; | ||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||
| 444 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||
| 446 | 2 | ▶ | sub set_port_resolve{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_port_resolve: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 447 | 2 | my $self=$_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||
| 449 | 2 | ▶ | if( ! $self->errorblank ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||
| 453 | 2 | $self->{port_resolve}=$_[1]; | |||||||||||||||||||||||||||||||||||||||||
| 454 | } | ||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||
| 456 | =head2 set_ptr_resolve | ||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||
| 458 | This sets wether or not it will resolve IPs to PTRs. | ||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||
| 460 | One value is taken and that is a perl boolean. | ||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||
| 462 | # sets it to true, the default | ||||||||||||||||||||||||||||||||||||||||||
| 463 | $pnc->set_ptr_resolve(1); | ||||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||
| 465 | # set it false, don't resolve the ports | ||||||||||||||||||||||||||||||||||||||||||
| 466 | $pnc->set_ptr_resolve; | ||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||
| 468 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | ▶ | sub set_ptr_resolve{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_ptr_resolve: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | my $self=$_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | ▶ | if( ! $self->errorblank ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | $self->{use_ptr}=$_[1]; | |||||||||||||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||
| 480 | =head | ||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||
| 482 | =head1 ERROR CODES / FLAGS | ||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||
| 484 | Error handling is provided by L<Error::Helper>. | ||||||||||||||||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||||||||||||||||
| 486 | =head2 1 / badResults | ||||||||||||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||||||||||||
| 488 | The passed Parse::Netstat array does not appear to be properly formatted. | ||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||
| 490 | =head2 2 / searchErrored | ||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||
| 492 | Parse::Netstat::Search->search errored. | ||||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||
| 494 | =head2 3 / sortErrored | ||||||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||||||
| 496 | Parse::Netsat::Search::Sort errored. | ||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||
| 498 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||||||||||||
| 500 | Zane C. Bowers-Hadley, C<< <vvelox at vvelox.net> >> | ||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||
| 502 | =head1 BUGS | ||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||
| 504 | Please report any bugs or feature requests to C<bug-parse-netstat-colorizer at rt.cpan.org>, or through | ||||||||||||||||||||||||||||||||||||||||||
| 505 | the web interface at L<https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Parse-Netstat-Colorizer>. I will be notified, and then you'll | ||||||||||||||||||||||||||||||||||||||||||
| 506 | automatically be notified of progress on your bug as I make changes. | ||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||
| 511 | =head1 SUPPORT | ||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||
| 513 | You can find documentation for this module with the perldoc command. | ||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||
| 515 | perldoc Parse::Netstat::Colorizer | ||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||
| 518 | You can also look for information at: | ||||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||
| 520 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||
| 522 | =item * RT: CPAN's request tracker (report bugs here) | ||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||
| 524 | L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Parse-Netstat-Colorizer> | ||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||
| 526 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||
| 528 | L<http://annocpan.org/dist/Parse-Netstat-Colorizer> | ||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||
| 530 | =item * CPAN Ratings | ||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||
| 532 | L<https://cpanratings.perl.org/d/Parse-Netstat-Colorizer> | ||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||
| 534 | =item * Search CPAN | ||||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||
| 536 | L<https://metacpan.org/release/Parse-Netstat-Colorizer> | ||||||||||||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||||||||||||
| 538 | =item * Code Repo | ||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||
| 540 | L<https://gitea.eesdp.org/vvelox/Parse-Netstat-Colorizer> | ||||||||||||||||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||||||||||||||||
| 542 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||||||
| 545 | =head1 ACKNOWLEDGEMENTS | ||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||||||||||||
| 548 | =head1 LICENSE AND COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||
| 550 | Copyright 2019 Zane C. Bowers-Hadley. | ||||||||||||||||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||||||||||||||||
| 552 | This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||||||||||||||||
| 553 | under the terms of the the Artistic License (2.0). You may obtain a | ||||||||||||||||||||||||||||||||||||||||||
| 554 | copy of the full license at: | ||||||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||||||
| 556 | L<http://www.perlfoundation.org/artistic_license_2_0> | ||||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||
| 558 | Any use, modification, and distribution of the Standard or Modified | ||||||||||||||||||||||||||||||||||||||||||
| 559 | Versions is governed by this Artistic License. By using, modifying or | ||||||||||||||||||||||||||||||||||||||||||
| 560 | distributing the Package, you accept this license. Do not use, modify, | ||||||||||||||||||||||||||||||||||||||||||
| 561 | or distribute the Package, if you do not accept this license. | ||||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||
| 563 | If your Modified Version has been derived from a Modified Version made | ||||||||||||||||||||||||||||||||||||||||||
| 564 | by someone other than you, you are nevertheless required to ensure that | ||||||||||||||||||||||||||||||||||||||||||
| 565 | your Modified Version complies with the requirements of this license. | ||||||||||||||||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||||||||||||||||
| 567 | This license does not grant you the right to use any trademark, service | ||||||||||||||||||||||||||||||||||||||||||
| 568 | mark, tradename, or logo of the Copyright Holder. | ||||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||
| 570 | This license includes the non-exclusive, worldwide, free-of-charge | ||||||||||||||||||||||||||||||||||||||||||
| 571 | patent license to make, have made, use, offer to sell, sell, import and | ||||||||||||||||||||||||||||||||||||||||||
| 572 | otherwise transfer the Package with respect to any patent claims | ||||||||||||||||||||||||||||||||||||||||||
| 573 | licensable by the Copyright Holder that are necessarily infringed by the | ||||||||||||||||||||||||||||||||||||||||||
| 574 | Package. If you institute patent litigation (including a cross-claim or | ||||||||||||||||||||||||||||||||||||||||||
| 575 | counterclaim) against any party alleging that the Package constitutes | ||||||||||||||||||||||||||||||||||||||||||
| 576 | direct or contributory patent infringement, then this Artistic License | ||||||||||||||||||||||||||||||||||||||||||
| 577 | to you shall terminate on the date that such litigation is filed. | ||||||||||||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||||||||||||
| 579 | Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER | ||||||||||||||||||||||||||||||||||||||||||
| 580 | AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. | ||||||||||||||||||||||||||||||||||||||||||
| 581 | THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | ||||||||||||||||||||||||||||||||||||||||||
| 582 | PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY | ||||||||||||||||||||||||||||||||||||||||||
| 583 | YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR | ||||||||||||||||||||||||||||||||||||||||||
| 584 | CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR | ||||||||||||||||||||||||||||||||||||||||||
| 585 | CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, | ||||||||||||||||||||||||||||||||||||||||||
| 586 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||||||||
| 589 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||||||||||||||||
| 591 | 2 | 1; # End of Parse::Netstat::Colorizer | |||||||||||||||||||||||||||||||||||||||||