| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package IO::Socket::PortState; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
26632
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
46
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
30
|
|
|
5
|
1
|
|
|
1
|
|
2068
|
use IO::Socket::INET; |
|
|
1
|
|
|
|
|
50100
|
|
|
|
1
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter; |
|
8
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @EXPORT_OK = qw(check_ports); |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub check_ports { |
|
15
|
0
|
|
|
0
|
0
|
|
my ($ip,$to,$pmhr,$proc) = @_; |
|
16
|
0
|
0
|
|
|
|
|
my $hr = defined wantarray ? {} : $pmhr; |
|
17
|
0
|
|
|
|
|
|
for my $prot (keys %{ $pmhr }) { |
|
|
0
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
for(keys %{ $pmhr->{$prot} }) { |
|
|
0
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
$hr->{$prot}->{$_}->{name} = $pmhr->{$prot}->{$_}->{name}; |
|
20
|
0
|
0
|
|
|
|
|
if(ref $proc eq 'CODE') { |
|
21
|
0
|
|
|
|
|
|
$proc->($hr->{$prot}->{$_},$ip,$_,$prot,$to); |
|
22
|
|
|
|
|
|
|
} else { |
|
23
|
0
|
|
|
|
|
|
my $sock = IO::Socket::INET->new( |
|
24
|
|
|
|
|
|
|
PeerAddr => $ip, |
|
25
|
|
|
|
|
|
|
PeerPort => $_, |
|
26
|
|
|
|
|
|
|
Proto => $prot, |
|
27
|
|
|
|
|
|
|
Timeout => $to |
|
28
|
|
|
|
|
|
|
); |
|
29
|
0
|
0
|
|
|
|
|
$hr->{$prot}->{$_}->{open} = !defined $sock ? 0 : 1; |
|
30
|
0
|
|
|
|
|
|
$hr->{$prot}->{$_}->{note} = 'builtin()'; |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
} |
|
34
|
0
|
|
|
|
|
|
return $hr; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__ |