diff --git a/pandora_server/lib/PandoraFMS/Recon/Base.pm b/pandora_server/lib/PandoraFMS/Recon/Base.pm index 68ab9a76d8..37bd81c13a 100644 --- a/pandora_server/lib/PandoraFMS/Recon/Base.pm +++ b/pandora_server/lib/PandoraFMS/Recon/Base.pm @@ -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); diff --git a/pandora_server/lib/PandoraFMS/ReconServer.pm b/pandora_server/lib/PandoraFMS/ReconServer.pm index 8407398645..1ceff0740d 100644 --- a/pandora_server/lib/PandoraFMS/ReconServer.pm +++ b/pandora_server/lib/PandoraFMS/ReconServer.pm @@ -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,