Clean blanks and HTML entities from recon tasks.

This commit is contained in:
Ramon Novoa 2017-03-14 08:27:44 +01:00
parent 4fb6a26365
commit fcb75ec1aa
2 changed files with 10 additions and 2 deletions

View File

@ -858,6 +858,10 @@ sub snmp_responds($$) {
return 1 if (defined($self->get_community($device)));
foreach my $community (@{$self->{'communities'}}) {
# Clean blanks.
$community =~ s/\s+//g;
`snmpwalk -M/dev/null -r$self->{'snmp_checks'} -t$self->{'snmp_timeout'} -v1 -On -Oe -c $community $device .0 2>/dev/null`;
if ($? == 0) {
$self->set_community($device, $community);
@ -1036,6 +1040,10 @@ sub scan($) {
$self->call('message', "[1/7] Scanning the network...", 3);
my @subnets = @{$self->get_subnets()};
foreach my $subnet (@subnets) {
# Clean blanks.
$subnet =~ s/\s+//g;
my $net_addr = new NetAddr::IP ($subnet);
if (!defined($net_addr)) {
$self->call('message', "Invalid network: $subnet", 3);

View File

@ -153,8 +153,8 @@ sub data_consumer ($$) {
my $nmap_args = '-nsP -PE --max-retries '.$pa_config->{'icmp_checks'}.' --host-timeout '.$pa_config->{'networktimeout'}.'s -T'.$pa_config->{'recon_timing_template'};
my $np = new PandoraFMS::NmapParser;
eval {
my @subnets = split(/,/, $task->{'subnet'});
my @communities = split(/,/, $task->{'snmp_community'});
my @subnets = split(/,/, safe_output($task->{'subnet'}));
my @communities = split(/,/, safe_output($task->{'snmp_community'}));
my $recon = new PandoraFMS::Recon::Base(
communities => \@communities,