コード例 #1
0
ファイル: simulate.php プロジェクト: AntBean/alienvault-ossim
    <th><?php 
echo _("Nmap Scan");
?>
</th>
    <th><?php 
echo _("Load");
?>
</th>
</tr>
    <?php 
// get available sensors
$_list_data = Av_sensor::get_list($conn);
$all_sensors = $_list_data[0];
// remote nmap
$rscan = new Remote_scan('', '');
$rscan->available_scan();
$ids = array();
if (is_array($rscan->get_sensors()) && count(array_keys($rscan->get_sensors())) > 0) {
    $agents = $rscan->get_sensors();
    foreach ($agents as $asid => $agent) {
        $ids[] = $asid;
    }
}
$withnmapforced = 0;
if (valid_hex32($scan_server) && !$hosts_alive && $sensor_id != "") {
    $ids = array_merge(array($sensor_id), $ids);
    $withnmapforced = 1;
}
// targets
$total_host = 0;
// count total targets to scan
コード例 #2
0
ファイル: do_scan.php プロジェクト: AntBean/alienvault-ossim
$assets = $assets_string;
$scan_path_log = "/tmp/nmap_scanning_" . md5(Session::get_secure_id()) . '.log';
// Only Stop
if ($only_stop) {
    $scan = new Scan();
    $scan->stop();
    $data['status'] = 'OK';
    $data['data'] = NULL;
    echo json_encode($data);
    exit;
}
// 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;