function cancel_scan($wizard)
{
    $step = intval($wizard->get_step_data('scan_step'));
    if ($step == 1 || $step == 2) {
        $obj = new Scan();
        $obj->stop();
        $obj->delete_data();
    }
    $wizard->clean_step_data();
    $wizard->save_status();
    $response['error'] = FALSE;
    return $response;
}
Exemple #2
0
// Launch scan
if (!$only_status && !$only_stop) {
    // This object is only for checking available sensors
    $rscan = new Remote_scan($assets, $scan_mode == 'full' ? 'root' : 'ping');
    $available = $rscan->available_scan(preg_match('/^[0-9A-F]{32}$/i', $sensor) ? $sensor : '');
    $remote_sensor = "null";
    // default runs local scan
    unset($_SESSION['_remote_sensor_scan']);
    if (preg_match('/[0-9A-F]{32}/i', $sensor)) {
        if ($available == '') {
            $remote_sensor = 'null';
            $data['status'] = 'warning';
            $data['data'] = _('Warning! The selected sensor is not available for remote scan. Using automatic option...');
        } else {
            $remote_sensor = $sensor;
            $_SESSION['_remote_sensor_scan'] = $sensor;
        }
    }
    if ($sensor == 'auto' && $available != '') {
        $remote_sensor = $available;
        $_SESSION['_remote_sensor_scan'] = $available;
    }
    $scan = new Scan();
    $scan->delete_data();
    // Launch scan in background
    $cmd = "/usr/bin/php /usr/share/ossim/scripts/vulnmeter/remote_nmap.php '{$assets}' '{$remote_sensor}' '{$timing_template}' '{$scan_mode}' '" . Session::get_session_user() . "' '{$autodetect}' '{$rdns}' '{$custom_ports}' > {$scan_path_log} 2>&1 &";
    system($cmd);
}
session_write_close();
echo json_encode($data);
exit;
                                }
                                else
                                {
                                    var tt_class = 'tt_error';
                                    var hd_class = 'host_details_e';
                                }
                                
                                                                                                                  			
                                var html_details = '<div class="tray_container">' +
                                   '<div class="tray_triangle ' + tt_class +'"></div>' +
                                        details +               
                                   '</div>';           			
                                                                 
                                                                                                                          			
                                dt.fnOpen(nTr, html_details, hd_class);
                            }                  				            				
        				});            				                								
        			});	
    			}                                     		    
    		}                
        });  	
    </script> 
   
    <?php 
    //Delete scan results
    if (count($data['general']['hosts_in_group']) > 0) {
        $scan_object = new Scan();
        $scan_object->delete_data();
    }
    $db->close();
}