blib/lib/ASNMTAP/Asnmtap/Plugins/IO.pm

filter: Statementstmt 39.7% 74 / 186 Branchbran 23.8% 30 / 126 Conditioncond 5.8% 1 / 17 MC/DCmcdc 0.0% 0 / 11 Subroutinesub 88.8% 8 / 9 Podpod 0.0% 0 / 1 totaltotal 32.2% 113 / 350 CC 70 SCAR 74.9
CC
70
Cov
32%
scan_socket_info
1992.1
__ANON__
2.0
BEGIN
1.0
CRAP 1787.9
« blib/lib/ASNMTAP/Asnmtap/Applications/CGI.pm ↑ Summary blib/lib/ASNMTAP/Asnmtap/Applications.pm »
1 # ----------------------------------------------------------------------------------------------------------
2 # © Copyright 2003-2011 by Alex Peeters [alex.peeters@citap.be]
3 # ----------------------------------------------------------------------------------------------------------
4 # 2011/mm/dd, v3.002.003, package ASNMTAP::Asnmtap::Plugins::IO
5 # ----------------------------------------------------------------------------------------------------------
6  
7 package ASNMTAP::Asnmtap::Plugins::IO;
8  
9 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10  
11 3 ▶use Carp qw(cluck);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14  
15 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 3 ▶use warnings; # Must be used in test mode only. This reduces a little process speed
Subroutine BEGIN: called CC=1 SCAR=0.0
17 #use diagnostics; # Must be used in test mode only. This reduces a lot of process speed
18  
19 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
20  
21 3 ▶use ASNMTAP::Asnmtap qw(%STATE %ERRORS %TYPE);
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
24  
25 3 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
26 3 ▶ use Exporter ();
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 3 @ASNMTAP::Asnmtap::Plugins::IO::ISA = qw(Exporter ASNMTAP::Asnmtap);
29  
30 3 %ASNMTAP::Asnmtap::Plugins::IO::EXPORT_TAGS = ( ALL => [ qw(&scan_socket_info) ],
31  
32 SOCKET => [ qw(&scan_socket_info) ] );
33  
34 3 @ASNMTAP::Asnmtap::Plugins::IO::EXPORT_OK = ( @{ $ASNMTAP::Asnmtap::Plugins::IO::EXPORT_TAGS{ALL} } );
35
36 3 $ASNMTAP::Asnmtap::Plugins::IO::VERSION = do { my @r = (q$Revision: 3.002.003$ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r };
37 }
38  
39 # Utility methods - - - - - - - - - - - - - - - - - - - - - - - - - - - -
40  
41 14 ▶sub scan_socket_info {
Subroutine scan_socket_info: called CC=70 SCAR=76.0
Pod undocumented
42 14 my %defaults = ( asnmtapInherited => undef,
43 custom => undef,
44 customArguments => undef,
45 protocol => undef,
46 host => undef,
47 port => undef,
48 service => undef,
49 request => undef,
50 socketTimeout => undef,
51 timeout => 10,
52 POP3 => {}
53 );
54  
55 14 my %parms = (%defaults, @_);
56
57 14 my $asnmtapInherited = $parms{asnmtapInherited};
58 0 ▶ unless ( defined $asnmtapInherited ) { cluck ( 'ASNMTAP::Asnmtap::Plugins::IO: asnmtapInherited missing' ); exit $ERRORS{UNKNOWN} }
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $asnmtapInherited) 0 14 14
59  
60 14 ▶ unless ( defined $parms{protocol} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $parms{"protocol"}) 1 13 14
61 1 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing attribute protocol' }, $TYPE{APPEND} );
62 1 return ( $ERRORS{UNKNOWN} );
63 }
64  
65 13 ▶ unless ( $parms{protocol} =~ /(?:tcp|udp)/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($parms{"protocol"} =~ /(?:tcp|udp)/) 1 12 13
66 1 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Wrong value for attribute protocol: '. $parms{protocol} }, $TYPE{APPEND} );
67 1 return ( $ERRORS{UNKNOWN} );
68 }
69  
70 12 ▶ unless ( defined $parms{host} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $parms{"host"}) 1 11 12
71 1 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing attribute host' }, $TYPE{APPEND} );
72 1 return ( $ERRORS{UNKNOWN} );
73 }
74  
75 11 ▶ unless ( $parms{host} =~ /^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z][-a-zA-Z0-9]+(\.[a-zA-Z][-a-zA-Z0-9]+)*)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($parms{"host"} =~ /^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z][-a-zA-Z0-9]+(\.[a-zA-Z][-a-zA-Z0-9]+)*)$/) 1 10 11
76 1 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Wrong value for attribute host: '. $parms{host} }, $TYPE{APPEND} );
77 1 return ( $ERRORS{UNKNOWN} );
78 }
79  
80 10 ▶ unless ( defined $parms{port} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $parms{"port"}) 1 9 10
81 1 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing attribute port' }, $TYPE{APPEND} );
82 1 return ( $ERRORS{UNKNOWN} );
83 }
84  
85 9 ▶ unless ( $parms{port} =~ /^([1-9]?(?:\d*))$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($parms{"port"} =~ /^([1-9]?(?:\d*))$/) 1 8 9
86 1 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Wrong value for attribute port: '. $parms{port} }, $TYPE{APPEND} );
87 1 return ( $ERRORS{UNKNOWN} );
88 }
89  
90 8 ▶ unless ( defined $parms{service} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $parms{"service"}) 1 7 8
91 1 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing attribute service' }, $TYPE{APPEND} );
92 1 return ( $ERRORS{UNKNOWN} );
93 }
94  
95 7 ▶ if ( $parms{port} == 110 and $parms{service} eq 'pop3' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parms{"port"} == 110 and $parms{"service"} eq "pop3") 7 0 7
Condition33%1/3
$parms{"port"} == 110 and $parms{"service"} eq "pop3"
!ll&&!rl&&r
007
MC/DC0%0/2
$parms{"port"} == 110 and $parms{"service"} eq "pop3"
$parms{"port"} == 110 $parms{"service"} eq "pop3"
Truth table33%1/3
A and B
A= $parms{"port"} == 110B= $parms{"service"} eq "pop3"
ABresult
0X0
100
111
96 7 ▶ unless ( defined $parms{POP3}{username} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $parms{"POP3"}{"username"}) 1 6 7
97 1 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing attribute username' }, $TYPE{APPEND} );
98 1 return ( $ERRORS{UNKNOWN} );
99 }
100  
101 6 ▶ unless ( defined $parms{POP3}{password} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $parms{"POP3"}{"password"}) 1 5 6
102 1 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing attribute password' }, $TYPE{APPEND} );
103 1 return ( $ERRORS{UNKNOWN} );
104 }
105  
106 5 ▶ unless ( defined $parms{POP3}{serviceReady} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $parms{"POP3"}{"serviceReady"}) 1 4 5
107 1 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing attribute serviceReady' }, $TYPE{APPEND} );
108 1 return ( $ERRORS{UNKNOWN} );
109 }
110  
111 4 ▶ unless ( defined $parms{POP3}{passwordRequired} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $parms{"POP3"}{"passwordRequired"}) 1 3 4
112 1 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing attribute passwordRequired' }, $TYPE{APPEND} );
113 1 return ( $ERRORS{UNKNOWN} );
114 }
115  
116 3 ▶ unless ( defined $parms{POP3}{mailMessages} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $parms{"POP3"}{"mailMessages"}) 1 2 3
117 1 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing attribute mailMessages' }, $TYPE{APPEND} );
118 1 return ( $ERRORS{UNKNOWN} );
119 }
120  
121 2 ▶ unless ( defined $parms{POP3}{closingSession} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $parms{"POP3"}{"closingSession"}) 1 1 2
122 1 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Missing attribute closingSession' }, $TYPE{APPEND} );
123 1 return ( $ERRORS{UNKNOWN} );
124 }
125 }
126  
127 1 ▶ if ( defined $parms{socketTimeout} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $parms{"socketTimeout"}) 1 0 1
128 1 ▶ unless ( $parms{socketTimeout} =~ /^([1-9]?(?:\d*))$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($parms{"socketTimeout"} =~ /^([1-9]?(?:\d*))$/) 1 0 1
129 1 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Wrong value for attribute socketTimeout: '. $parms{socketTimeout} }, $TYPE{APPEND} );
130 1 return ( $ERRORS{UNKNOWN} );
131 }
132 }
133  
134 0 ▶ unless ( $parms{timeout} =~ /^([1-9]?(?:\d*))$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($parms{"timeout"} =~ /^([1-9]?(?:\d*))$/) 0 0 0
135 0 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{UNKNOWN}, error => 'Wrong value for attribute timeout: '. $parms{timeout} }, $TYPE{APPEND} );
136 0 return ( $ERRORS{UNKNOWN} );
137 }
138  
139 0 ▶ my $debug = $$asnmtapInherited->getOptionsValue ( 'debug' ) || 0;
Condition0%0/2
$$asnmtapInherited->getOptionsValue('debug') || 0
l!l
00
MC/DC0%0/1
$$asnmtapInherited->getOptionsValue('debug') || 0
$$asnmtapInherited->getOptionsValue('debug')
Truth table0%0/2
A
A= $$asnmtapInherited->getOptionsValue('debug')
Aresult
11
00
140  
141 0 ▶ if ( $debug >= 2 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($debug >= 2) 0 0 0
142 0 print 'ASNMTAP::Asnmtap::Plugins::IO::scan_socket_info::protocol: ', $parms{protocol}, "\n";
143 0 print 'ASNMTAP::Asnmtap::Plugins::IO::scan_socket_info::host: ', $parms{host}, "\n";
144 0 print 'ASNMTAP::Asnmtap::Plugins::IO::scan_socket_info::port: ', $parms{port}, "\n";
145 0 print 'ASNMTAP::Asnmtap::Plugins::IO::scan_socket_info::service: ', $parms{service}, "\n";
146 0 ▶ print 'ASNMTAP::Asnmtap::Plugins::IO::scan_socket_info::request: ', $parms{request}, "\n" if ( defined $parms{request} );
Branch: 1 branch
BranchTrueFalseTotal
if defined $parms{"request"} 0 0 0
147 0 print 'ASNMTAP::Asnmtap::Plugins::IO::scan_socket_info::socketTimeout: ', $parms{socketTimeout}, "\n";
148 0 print 'ASNMTAP::Asnmtap::Plugins::IO::scan_socket_info::timeout: ', $parms{timeout}, "\n";
149 }
150  
151 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
152  
153 0 my ($exit, $action, $INET);
154 0 $exit = 0;
155 0 $action = '<NIHIL>';
156  
157 0 ▶ $SIG{ALRM} = sub { alarm (0); $exit = 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
158 0 alarm ( $parms{timeout} ); $exit = 0;
159  
160 3 ▶ use IO::Socket;
Subroutine BEGIN: called CC=1 SCAR=0.0
161  
162 0 ▶ if ( defined $parms{socketTimeout} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $parms{'socketTimeout'}) { } 0 0 0
163 0 $INET = IO::Socket::INET->new ( Proto => $parms{protocol}, PeerAddr => $parms{host}, PeerPort => $parms{port} );
164 } else {
165 0 $INET = IO::Socket::INET->new ( Proto => $parms{protocol}, PeerAddr => $parms{host}, PeerPort => $parms{port}, Timeout => $parms{socketTimeout} );
166 }
167  
168 0 ▶ if ( $INET ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($INET) { } 0 0 0
169 0 ▶ print "ASNMTAP::Asnmtap::Plugins::IO::scan_socket_info::action::IO::Socket::INET: $INET\n" if ( $debug >= 2 );
Branch: 1 branch
BranchTrueFalseTotal
if $debug >= 2 0 0 0
170 } else {
171 0 ▶ print "ASNMTAP::Asnmtap::Plugins::IO::scan_socket_info::action::IO::Socket::INET: Cannot connect to ${parms{host}}:${parms{service}}\n" if ( $debug >= 2 );
Branch: 1 branch
BranchTrueFalseTotal
if $debug >= 2 0 0 0
172 0 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{CRITICAL}, alert => "Cannot connect to ${parms{host}}:${parms{service}}" }, $TYPE{APPEND} );
173 0 return ( $ERRORS{CRITICAL} );
174 }
175  
176 0 $INET->autoflush ( 1 );
177  
178 0 ▶ if ( $INET && ($parms{protocol} eq 'tcp') ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($INET and $parms{'protocol'} eq 'tcp') { } 0 0 0
elsif ($INET and $parms{'protocol'} eq 'udp') { } 0 0 0
Condition0%0/3
$INET and $parms{"protocol"} eq "tcp"
!ll&&!rl&&r
000
MC/DC0%0/2
$INET and $parms{"protocol"} eq "tcp"
$INET $parms{"protocol"} eq "tcp"
Truth table0%0/3
A and B
A= $INETB= $parms{"protocol"} eq "tcp"
ABresult
0X0
100
111
179 0 ▶ if ( $parms{port} == 25 and $parms{service} eq 'smtp' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($parms{'port'} == 25 and $parms{'service'} eq 'smtp') { } 0 0 0
elsif ($parms{'port'} == 110 and $parms{'service'} eq 'pop3') { } 0 0 0
Condition0%0/3
$parms{"port"} == 25 and $parms{"service"} eq "smtp"
!ll&&!rl&&r
000
MC/DC0%0/2
$parms{"port"} == 25 and $parms{"service"} eq "smtp"
$parms{"port"} == 25 $parms{"service"} eq "smtp"
Truth table0%0/3
A and B
A= $parms{"port"} == 25B= $parms{"service"} eq "smtp"
ABresult
0X0
100
111
180 0 ▶ print "ASNMTAP::Asnmtap::Plugins::IO::scan_socket_info::action::smtp(25): wait for answer\n" if ( $debug >= 2 );
Branch: 1 branch
BranchTrueFalseTotal
if $debug >= 2 0 0 0
181  
182 0 ▶ while ( <$INET> ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $INET)) 0 0 0
183 0 chomp;
184  
185 0 ▶ print "ASNMTAP::Asnmtap::Plugins::IO::scan_socket_info::action::smtp(25): <$_>\n" if ( $debug >= 2 );
Branch: 1 branch
BranchTrueFalseTotal
if $debug >= 2 0 0 0
186 0 ▶ if ( $exit ) { $action = '<TIMEOUT>'; last; }
Branch: 1 branch
BranchTrueFalseTotal
if ($exit) 0 0 0
187  
188 SWITCH: {
189 0 ▶ if ( $_ =~ /^220 / ) { print $INET "HELP\n"; }
Branch: 1 branch
BranchTrueFalseTotal
if ($_ =~ /^220 /) 0 0 0
190 0 ▶ if ( $_ =~ /^211 / ) { print $INET "QUIT\n"; $action = 'OK (211)'; }
Branch: 1 branch
BranchTrueFalseTotal
if ($_ =~ /^211 /) 0 0 0
191 0 ▶ if ( $_ =~ /^214 / ) { print $INET "QUIT\n"; $action = 'OK (214)'; }
Branch: 1 branch
BranchTrueFalseTotal
if ($_ =~ /^214 /) 0 0 0
192 0 ▶ if ( $_ =~ /^250 / ) { print $INET "QUIT\n"; $action = 'OK (250)'; }
Branch: 1 branch
BranchTrueFalseTotal
if ($_ =~ /^250 /) 0 0 0
193 0 ▶ if ( $_ =~ /^421 / ) { print $INET "QUIT\n"; $action = 'OK (421)'; }
Branch: 1 branch
BranchTrueFalseTotal
if ($_ =~ /^421 /) 0 0 0
194 0 ▶ if ( $_ =~ /^500 / ) { print $INET "QUIT\n"; $action = 'OK (500)'; }
Branch: 1 branch
BranchTrueFalseTotal
if ($_ =~ /^500 /) 0 0 0
195 0 ▶ if ( $_ =~ /^501 / ) { print $INET "QUIT\n"; $action = 'OK (501)'; }
Branch: 1 branch
BranchTrueFalseTotal
if ($_ =~ /^501 /) 0 0 0
196 0 ▶ if ( $_ =~ /^502 / ) { print $INET "QUIT\n"; $action = 'OK (502)'; }
Branch: 1 branch
BranchTrueFalseTotal
if ($_ =~ /^502 /) 0 0 0
197 0 ▶ if ( $_ =~ /^504 / ) { print $INET "QUIT\n"; $action = 'OK (504)'; }
Branch: 1 branch
BranchTrueFalseTotal
if ($_ =~ /^504 /) 0 0 0
198 0 ▶ if ( $_ =~ /^221 / ) { $action = 'OK (221)'; last; }
Branch: 1 branch
BranchTrueFalseTotal
if ($_ =~ /^221 /) 0 0 0
199 }
200 }
201 ▶ } elsif ( $parms{port} == 110 and $parms{service} eq 'pop3' ) {
Condition0%0/3
$parms{"port"} == 110 and $parms{"service"} eq "pop3"
!ll&&!rl&&r
000
MC/DC0%0/2
$parms{"port"} == 110 and $parms{"service"} eq "pop3"
$parms{"port"} == 110 $parms{"service"} eq "pop3"
Truth table0%0/3
A and B
A= $parms{"port"} == 110B= $parms{"service"} eq "pop3"
ABresult
0X0
100
111
202 0 ▶ print "ASNMTAP::Asnmtap::Plugins::IO::scan_socket_info::action::pop3(110): wait for answer\n" if ( $debug >= 2 );
Branch: 1 branch
BranchTrueFalseTotal
if $debug >= 2 0 0 0
203  
204 0 ▶ while ( <$INET> ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $INET)) 0 0 0
205 0 chomp;
206  
207 0 ▶ print "ASNMTAP::Asnmtap::Plugins::IO::scan_socket_info::action::pop3(110): <$_>\n" if ( $debug >= 2 );
Branch: 1 branch
BranchTrueFalseTotal
if $debug >= 2 0 0 0
208 0 ▶ if ( $exit ) { $action = "<TIMEOUT>"; last; }
Branch: 1 branch
BranchTrueFalseTotal
if ($exit) 0 0 0
209  
210 0 ▶ if ($_ =~ /^\+OK /) {
Branch: 2 branches
BranchTrueFalseTotal
if ($_ =~ /^\+OK /) { } 0 0 0
elsif ($_ =~ /^\-ERR /) { } 0 0 0
211 SWITCH: {
212 0 ▶ if ( $_ =~ /${parms{POP3}{serviceReady}}/ ) { $action = 'USER (POP3)'; print "ASNMTAP::Asnmtap::Plugins::IO::scan_socket_info::action: $action\n" if ( $debug >= 2 ); print $INET "USER ${parms{POP3}{username}}\r\n"; }
Branch: 2 branches
BranchTrueFalseTotal
if ($_ =~ /$parms{"POP3"}{"serviceReady"}/) 0 0 0
if $debug >= 2 0 0 0
213 0 ▶ if ( $_ =~ /${parms{POP3}{passwordRequired}}/ ) { $action = 'PASS (POP3)'; print "ASNMTAP::Asnmtap::Plugins::IO::scan_socket_info::action: $action\n" if ( $debug >= 2 ); print $INET "PASS ${parms{POP3}{password}}\r\n"; }
Branch: 2 branches
BranchTrueFalseTotal
if ($_ =~ /$parms{"POP3"}{"passwordRequired"}/) 0 0 0
if $debug >= 2 0 0 0
214 0 ▶ if ( $_ =~ /${parms{POP3}{mailMessages}}/ ) { $action = 'QUIT (POP3)'; print "ASNMTAP::Asnmtap::Plugins::IO::scan_socket_info::action: $action\n" if ( $debug >= 2 ); print $INET "QUIT\r\n"; }
Branch: 2 branches
BranchTrueFalseTotal
if ($_ =~ /$parms{"POP3"}{"mailMessages"}/) 0 0 0
if $debug >= 2 0 0 0
215 0 ▶ if ( $_ =~ /${parms{POP3}{closingSession}}/ ) { $action = 'OK (POP3)'; print "ASNMTAP::Asnmtap::Plugins::IO::scan_socket_info::action: $action\n" if ( $debug >= 2 ); last; }
Branch: 2 branches
BranchTrueFalseTotal
if ($_ =~ /$parms{"POP3"}{"closingSession"}/) 0 0 0
if $debug >= 2 0 0 0
216 }
217 0 } elsif ($_ =~ /^\-ERR /){ $action = "<$_>"; print $INET "HELP\n"; last; }
218 }
219 } else {
220 0 ▶ print "ASNMTAP::Asnmtap::Plugins::IO::scan_socket_info::tcp: no RFC implementation: ${parms{protocol}} ${parms{service}}(${parms{port}})\n" if ( $debug >= 2 );
Branch: 1 branch
BranchTrueFalseTotal
if $debug >= 2 0 0 0
221 }
222 ▶ } elsif ( $INET && $parms{protocol} eq 'udp' ) {
Condition0%0/3
$INET and $parms{"protocol"} eq "udp"
!ll&&!rl&&r
000
MC/DC0%0/2
$INET and $parms{"protocol"} eq "udp"
$INET $parms{"protocol"} eq "udp"
Truth table0%0/3
A and B
A= $INETB= $parms{"protocol"} eq "udp"
ABresult
0X0
100
111
223 0 ▶ print "ASNMTAP::Asnmtap::Plugins::IO::scan_socket_info::udp: no RFC implementation: ${parms{protocol}} ${parms{service}}(${parms{port}})\n" if ( $debug >= 2 );
Branch: 1 branch
BranchTrueFalseTotal
if $debug >= 2 0 0 0
224 }
225  
226 0 ▶ if ( defined $parms{custom} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $parms{'custom'}) { } 0 0 0
227 0 ▶ ( defined $parms{customArguments} ) ? $parms{custom}->($$asnmtapInherited, \%parms, \$INET, \$action, $parms{customArguments}) : $parms{custom}->($$asnmtapInherited, \%parms, \$INET, \$action);
Branch: 1 branch
BranchTrueFalseTotal
defined $parms{'customArguments'} ? : 0 0 0
228 } else {
229 0 ▶ print 'ASNMTAP::Asnmtap::Plugins::IO::scan_socket_info: ', $$asnmtapInherited->{_programDescription}, "\n" if ($debug);
Branch: 1 branch
BranchTrueFalseTotal
if $debug 0 0 0
230 }
231  
232 0 alarm (0); $SIG{ALRM} = 'DEFAULT';
233 0 close ( $INET );
234  
235 0 ▶ $INET = ( defined $parms{request} ? $parms{request} : "${parms{service}}(${parms{port}})" );
Branch: 1 branch
BranchTrueFalseTotal
defined $parms{'request'} ? : 0 0 0
236  
237 0 ▶ if ( $INET eq $action ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($INET eq $action) { } 0 0 0
238 0 $$asnmtapInherited->pluginValue ( stateValue => $ERRORS{OK} );
239 0 return ( $ERRORS{OK} );
240 } else {
241 0 $$asnmtapInherited->pluginValues ( { stateValue => $ERRORS{CRITICAL}, alert => "Wrong answer from ${parms{host}} ${parms{service}}: $action" }, $TYPE{APPEND} );
242 0 return ( $ERRORS{CRITICAL} );
243 }
244 }
245  
246 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
247  
248 3 1;
249  
250 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
251  
252 __END__
« blib/lib/ASNMTAP/Asnmtap/Applications/CGI.pm ↑ Summary blib/lib/ASNMTAP/Asnmtap/Applications.pm »