enh(linux/local): add timeout and sudo as options for nmap discovery (#2148)

This commit is contained in:
Colin Gagnaire 2020-08-12 20:36:15 +02:00 committed by GitHub
parent 7b1126b2fe
commit 8e9b1ddc4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 1 deletions

View File

@ -35,6 +35,8 @@ sub new {
$options{options}->add_options(arguments => {
'subnet:s' => { name => 'subnet' },
'timeout:s' => { name => 'timeout', default => 120 },
'sudo' => { name => 'sudo' },
'prettify' => { name => 'prettify' }
});
@ -112,7 +114,8 @@ sub run {
command => 'nmap',
command_options => '-sS -sU -R -O --osscan-limit --osscan-guess -p U:161,162,T:21-25,80,139,443,3306,8080,8443 -oX - ',
command_options_suffix => $self->{option_results}->{subnet},
timeout => 120
sudo => $self->{option_results}->{sudo},
timeout => $self->{option_results}->{timeout}
);
my $results = $self->decode_xml_response(
@ -190,6 +193,14 @@ Command used: nmap -sS -sU -R -O --osscan-limit --osscan-guess -p U:161,162,T:21
Specify subnet from which discover
resources (Must be <ip>/<cidr> format) (Mandatory).
=item B<--timeout>
Timeout in seconds (Default: 120).
=item B<--sudo>
Defines if 'sudo' must be used to execute the 'nmap' command.
=item B<--prettify>
Prettify JSON output.