} } // Get nmap status for IP $reload = false; $cmd = ""; if (scanning_now($ip)) { $reload = true; ?> <script type="text/javascript">document.getElementById('content').innerHTML = "[<a href='nmap_process.php?ip=<?php echo $ip; ?> &action=stop'>Stop</a>] Running Nmap for <?php echo $ip; ?> <img src='../pixmaps/loading.gif' align='absmiddle' width='16'>";</script><?php while (scanning_now($ip)) { if (file_exists("/tmp/nmap_scan_{$ip}.log")) { $lines = file("/tmp/nmap_scan_{$ip}.log"); $perc = 0; foreach ($lines as $line) { if (preg_match("/About\\s+(\\d+\\.\\d+)\\%/", $line, $found)) { $perc = $found[1]; } } if ($perc > 0) { ?> <script type="text/javascript">document.getElementById('progress').innerHTML = "<?php echo $found[1]; ?> %";</script><?php }
$longitude = $record->longitude; } geoip_close($gi); } $num_sensors = count($sensors); } } /* services update */ if (GET('update') == 'services') { $conf = $GLOBALS["CONF"]; $nmap = $conf->get_conf("nmap_path"); touch("/tmp/nmap_scan_{$ip}.log"); $cmd = "{$nmap} -sV -d1 -P0 {$ip} > /tmp/nmap_scan_{$ip}.log 2>&1 &"; system($cmd); } $scanning = scanning_now($ip); if (GET('newport') != "" || GET('port') != "") { if (GET('newport') == "") { $newPort = GET('port'); } else { $newPort = GET('newport'); } $aux = explode("-", $newPort); $port_number = trim($aux[0]); $protocol_name = trim($aux[1]); $nservice = GET('service'); $newport_nagios = GET('newportnagios') != "" ? 1 : 0; ossim_valid($port_number, OSS_PORT, 'illegal:' . _("Port number")); ossim_valid($protocol_name, OSS_PROTOCOL, 'illegal:' . _("Protocol name")); ossim_valid($nservice, OSS_NULLABLE, OSS_ALPHA, OSS_SPACE, OSS_PUNC, 'illegal:' . _("Service")); if (ossim_error()) {