@@ -383,6 +383,10 @@ sub __host_port_tag_hdlr {
383383 || ' unknown'
384384 if ( $state ne ' ' );
385385
386+ $port_hashref -> {$proto }{$portid }{reason_ttl } = $state -> {att }-> {reason_ttl }
387+ || ' unknown'
388+ if ($state ne ' ' );
389+
386390 # GET SERVICE INFORMATION
387391 $port_hashref -> {$proto }{$portid }{service } =
388392 __host_service_tag_hdlr( $port_tag , $portid )
@@ -878,13 +882,24 @@ sub _get_port_state {
878882
879883}
880884
885+ sub _get_port_state_ttl {
886+ my $self = shift ;
887+ my $proto = pop ;
888+ my $portid = lc (shift );
889+
890+ return undef unless ( exists $self -> {ports }{$proto }{$portid } );
891+ return $self -> {ports }{$proto }{$portid }{reason_ttl };
892+ }
893+
881894# changed this to use _get_ports since it was similar code
882895sub tcp_ports { return _get_ports( @_ , ' tcp' ); }
883896sub udp_ports { return _get_ports( @_ , ' udp' ); }
884897
885898sub tcp_port_count { return $_ [0]-> {ports }{tcp_port_count }; }
886899sub udp_port_count { return $_ [0]-> {ports }{udp_port_count }; }
887900
901+ sub tcp_port_state_ttl { return _get_port_state_ttl( @_ , ' tcp' ); }
902+
888903sub tcp_port_state { return _get_port_state( @_ , ' tcp' ); }
889904sub udp_port_state { return _get_port_state( @_ , ' udp' ); }
890905
@@ -1524,6 +1539,10 @@ be counted as an 'open' port as well as a 'filtered' one.>
15241539
15251540Returns the total of TCP|UDP ports scanned respectively.
15261541
1542+ =item B<tcp_port_state_ttl() >
1543+
1544+ Returns the 'reason_ttl' value present in nmap xml result.
1545+
15271546=item B<tcp_del_ports($portid, [$portid, ...]) >
15281547
15291548=item B<udp_del_ports($portid, [ $portid, ...]) >
0 commit comments