function cancel_scan($wizard) { //File to cache scan object $user = Session::get_session_user(); $scan_file = 'w_last_asset_object-' . md5($user); $step = intval($wizard->get_step_data('scan_step')); if ($step == 1 || $step == 2) { $obj = Av_scan::get_object_from_file($scan_file); $obj->stop(); $obj->delete_scan(); Cache_file::remove_file($scan_file); } $wizard->clean_step_data(); $wizard->save_status(); $response['error'] = FALSE; return $response; }
******************** Search Box ******************** ****************************************************/ $autocomplete_keys = array('hosts', 'nets'); $assets = Autocomplete::get_autocomplete($conn, $autocomplete_keys); /**************************************************** ******************** Clear Scan ******************** ****************************************************/ //Results will be deleted when a custom scan is executed or when an user forces it if (intval($_REQUEST['clearscan']) == 1 || $_REQUEST['action'] == 'custom_scan') { try { //Delete scan task from Redis $av_scan = Av_scan::get_object_from_file($scan_file); if (is_object($av_scan) && !empty($av_scan)) { $av_scan->delete_scan(); //Delete local scan files Cache_file::remove_file($scan_file); } //Delete report scan information @unlink($scan_report_file); } catch (Exception $e) { } } /******************************************************************* *** Custom scan (From Asset Detail or from a Suggestion Link) *** ********************************************************************/ if ($_REQUEST['action'] == 'custom_scan') { if ($_GET['action'] == 'custom_scan') { //It's necessary to validate properly $_POST = $_GET; $_POST['timing_template'] = $ttemplate; $_POST['autodetected'] = $autodetected;