$is_disabled = $session->is_user_disabled(); if ($is_disabled == TRUE) { $e_msg = _('Error! Scan cannot be completed: Scan owner is disabled'); Av_exception::throw_error(Av_exception::USER_ERROR, $e_msg); } $client = new Alienvault_client($user); $client->auth()->login($user, $pass); //Launching scan $autodetect = $autodetect == 1 ? 'true' : 'false'; $rdns = $rdns == 1 ? 'true' : 'false'; $timing_template = empty($timing_template) ? 'T3' : $timing_template; $scan_options = array('scan_type' => $scan_type, 'scan_timing' => $timing_template, 'autodetect_os' => $autodetect, 'reverse_dns' => $rdns, 'scan_ports' => $custom_ports, 'idm' => 'false'); $av_scan = new Av_scan($targets_p, $sensor, $scan_options); $av_scan->run(); echo "Asset scan:\n"; echo "\tTargets: " . $av_scan->get_targets('scan_format') . "\n"; echo "\tSensor: " . $av_scan->get_sensor() . "\n"; echo "\tScan Options: \n"; $sc_options = $av_scan->get_scan_options(); foreach ($sc_options as $sc_type => $sc_value) { echo "\t\t{$sc_type}: {$sc_value}\n"; } if ($display_results == 1) { $status = $av_scan->get_status(); while ($status['status']['code'] != Av_scan::ST_SCAN_FINISHED) { sleep(2); $status = $av_scan->get_status(); } // Getting discovered hosts $scan_report = $av_scan->download_scan_report(); // Deleting Scan Report