Closed rmorandell-pgum closed 1 year ago
The issue is about the stderr ? I don't understand how it can be an issue because the nmap doesnt redirect stderr to stdout.
it seem so but if on this error i write the nmap response to file i find this lines above in the output file .. and this seems definitely error or warnings from nmap ..
redirecting with "2> /dev/null" the lines doesn't appear and the plugin is working well
You're right. by default i redirect stderr...
Command:
perl apps-nmap-cli.pl --plugin=apps::nmap::cli::plugin --mode=discovery --subnet='x.x.x.x/24' --timeout=900 --prettify
Error:
UNKNOWN: Cannot decode xml response: not well-formed (invalid token) at line 151, column 115, byte 5368 at /usr/lib64/perl5/vendor_perl/XML/Parser.pm line 187. XML::Simple called at apps-nmap-cli.pl line 105.
I changed the plugin writing out the output of the nmap cmd to file before the plugin parses the output. The problem is that in the nmap output i find this lines in "non xml format"
I have changed the plugin in the run functions adding "2 > /dev/null" to ignore errors and warnings as workaround.
my ($stdout) = $options{custom}->execute_command( command => 'nmap', command_options => $self->{option_results}->{nmap_options}, command_options_suffix => "$self->{option_results}->{subnet} 2> /dev/null", timeout => 120 );