コード例 #1
0
ファイル: wizard_ajax.php プロジェクト: jackpf/ossim-arc
function exit_wizard($data)
{
    $status = intval($data['exit']) == 1 ? 0 : 2;
    Welcome_wizard::clean_wizard($status);
    $response['error'] = FALSE;
    $response['data'] = '';
    return $response;
}
コード例 #2
0
ファイル: select_nets.php プロジェクト: jackpf/ossim-arc
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
* MA  02110-1301  USA
*
*
* On Debian GNU/Linux systems, the complete text of the GNU General
* Public License can be found in `/usr/share/common-licenses/GPL-2'.
*
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
require_once 'av_init.php';
Session::useractive();
if (!Session::am_i_admin()) {
    Av_exception::throw_error(Av_exception::USER_ERROR, _('You do not have permissions to see this section'));
}
$wizard = Welcome_wizard::get_instance();
if (!$wizard instanceof Welcome_wizard) {
    Av_exception::throw_error(Av_exception::USER_ERROR, "There was an error, the Welcome_wizard object doesn't exist");
}
//Getting the scan step to know if we have a scan running
$step = intval($wizard->get_step_data('scan_step'));
//Selected nets
$nets_selected = $wizard->get_step_data('scan_nets');
$nets_selected = is_array($nets_selected) ? $nets_selected : array();
$n_ids = array_fill_keys(array_keys($nets_selected), 1);
$paths = Asset::get_path_url(FALSE);
$iframe_url = $paths['network']['views'] . 'import_all_nets.php?import_type=welcome_wizard_nets';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
コード例 #3
0
ファイル: login.php プロジェクト: alienfault/ossim
                //Creating the vector
                $_SESSION['mdspw'] = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $conf->get_conf('md5_salt'), $pass, MCRYPT_MODE_ECB, $iv);
                $infolog = array($user);
                Log_action::log(1, $infolog);
                if ($first_user_login) {
                    header("Location: first_login.php");
                } elseif ($pass_expire_max > 0 && dateDiff($last_pass_change, date('Y-m-d H:i:s')) >= $pass_expire_max) {
                    header("Location: first_login.php?expired=1");
                } elseif ($user == AV_DEFAULT_ADMIN && $pass == 'admin') {
                    header("Location: first_login.php?changeadmin=1");
                } else {
                    if ($mobile != '') {
                        header("Location: ../statusbar/mobile.php?login="******"&screen={$mobile}");
                    } else {
                        if (Session::am_i_admin()) {
                            if (Welcome_wizard::show_wizard_status_bar()) {
                                $_SESSION['_welcome_wizard_bar'] = TRUE;
                            } else {
                                unset($_SESSION['_welcome_wizard_bar']);
                            }
                        }
                        header("Location: /ossim/{$bookmark}");
                    }
                }
                exit;
            }
        }
    }
}
if ($system_name != '') {
    $title .= " [{$system_name} - {$system_ip}]";
コード例 #4
0
ファイル: step_1.php プロジェクト: jackpf/ossim-arc
if (!Session::am_i_admin()) {
    echo _('You do not have permissions to see this section');
    die;
}
/************************************************************************************************/
/************************************************************************************************/
/***  This file is includen in step_loader.php hence the wizard object is defined in $wizard  ***/
/***                         database connection is stored in $conn                           ***/
/************************************************************************************************/
/************************************************************************************************/
if (!$wizard instanceof Welcome_wizard) {
    throw new Exception("There was an error, the Welcome_wizard object doesn't exist");
}
$interfaces = array();
try {
    $interfaces = Welcome_wizard::get_interfaces();
} catch (Exception $e) {
    $config_nt = array('content' => $e->getMessage(), 'options' => array('type' => 'nf_error', 'cancel_button' => true), 'style' => 'margin:10px auto;width:50%;text-align:center;padding:0 10px;z-index:999');
    $nt = new Notification('nt_notif', $config_nt);
    $nt->show();
}
$v_short = Session::is_pro() ? "USM" : "OSSIM";
$text_descr = _("The network interfaces in AlienVault %s can be configured to run Network Monitoring or as Log Collection & Scanning. Once you've configured the interfaces you'll need to ensure that the networking is configured appropriately for each interface so that AlienVault %s is either receiving data passively or has the ability to reach out to the desired network.");
$text_descr = sprintf($text_descr, $v_short, $v_short);
?>

<script type='text/javascript'>
    
    var __nic ,__n_role ,__n_ip, __n_mask = null;
    var __nic_state = false;
    
コード例 #5
0
function check_deploy_status($conn, $wizard)
{
    $data = array();
    $os = $wizard->get_step_data('deploy_os');
    //Linux Deployment Status --> Apply Configuration
    if ($os == 'linux') {
        $sensor_id = get_sensor_id();
        $error_apply = FALSE;
        try {
            list($agentless_list, $al_total) = Ossec_agentless::get_list($conn, $sensor_id, ' AND status = 1');
            if ($al_total > 0) {
                Ossec_agentless::save_in_config($conn, $sensor_id, $agentless_list);
            }
            //Enabling agentless
            Ossec_control::execute_action($sensor_id, 'enable_al');
            //Restarting ossec
            Ossec_control::execute_action($sensor_id, 'restart');
            // Delete "/var/tmp/.reload_<sensor_id>" file in order to hide the "Apply Changes" button
            @unlink('/var/tmp/.reload_' . $sensor_id);
        } catch (Exception $e) {
            $error_apply = $e->getMessage();
        }
        //If there was an error applying the configuration we show the error
        if ($error_apply !== FALSE) {
            $error_apply_msg = _('Error Applying Agentless Configuration');
            set_scan_error_message($wizard, $error_apply_msg);
            Av_exception::write_log(Av_exception::USER_ERROR, $error_apply);
            $response['error'] = TRUE;
            return $response;
        }
        //If everything was right, the percent is 100% and the remaining is 0
        $data['finish'] = TRUE;
        $data['percent'] = 100;
        $data['remaining'] = 0;
        //Setting the deployment status to 3 --> Finished
        $wizard->set_step_data('deploy_step', 3);
    } elseif ($os == 'windows') {
        $jobs = $wizard->get_step_data('deploy_jobs');
        //If the array of jobs IDs is empty, we are finished
        if (!is_array($jobs) || count($jobs) == 0) {
            $data['finish'] = TRUE;
            $data['percent'] = 100;
            $data['remaining'] = 0;
            //Setting the deployment status to 3 --> Finished
            $wizard->set_step_data('deploy_step', 3);
        } else {
            $succes = 0;
            //Going through the jobs
            foreach ($jobs as $id => $job) {
                try {
                    //Getting the status of the job
                    $state = Welcome_wizard::current_jobs($job['job_id']);
                    if ($state['job_status'] == 'task-succeeded') {
                        //If it is success, we count it and we delete it from the jobs array
                        if ($state['job_result'][0] === TRUE) {
                            unset($jobs[$id]);
                            $succes++;
                        } elseif ($state['job_result'][0] === FALSE) {
                            unset($jobs[$id]);
                            Av_exception::write_log(Av_exception::USER_ERROR, $job['agent'] . ': ' . $state['job_result'][1]);
                        }
                    } elseif ($state['job_status'] == 'task-failed' || $state['job_status'] == 'task-revoked') {
                        unset($jobs[$id]);
                        $_msg = $job['agent'] . ': ' . _("Couldn't complete windows OSSEC agent deploy: ") . $state['job_status'];
                        Av_exception::write_log(Av_exception::USER_ERROR, $_msg);
                    }
                } catch (Exception $e) {
                    //In case of critical error we delete from the array to avoid loops
                    unset($jobs[$id]);
                    Av_exception::write_log(Av_exception::USER_ERROR, $job['agent'] . ': ' . $e->getMessage());
                }
            }
            //IF after checking the status, the array is empty, we are finished
            if (!is_array($jobs) || count($jobs) == 0) {
                $data['finish'] = TRUE;
                $data['percent'] = 100;
                $data['remaining'] = 0;
                //Setting the deployment status to 3 --> Finished
                $wizard->set_step_data('deploy_step', 3);
            } else {
                //Total number of host that were selected to be deployed
                $total = $wizard->get_step_data('deploy_total_ips');
                $total = $total < 1 ? 1 : $total;
                //Number of host left to be deployed --> Pending jobs
                $current = count($jobs);
                //Percentage of the remaining hosts
                $pending = $total - $current;
                $percent = round(100 * ($pending / $total));
                $data['finish'] = FALSE;
                $data['percent'] = $percent;
                $data['remaining'] = $current;
            }
            //Updating the number of host successfully deployed
            $deployed = $wizard->get_step_data('deploy_success');
            $deployed += $succes;
            $wizard->set_step_data('deploy_success', $deployed);
            //Updating the array of jobs left
            $wizard->set_step_data('deploy_jobs', $jobs);
        }
    }
    //Saving wizard status
    $wizard->save_status();
    $response['error'] = FALSE;
    $response['data'] = $data;
    return $response;
}
コード例 #6
0
ファイル: scan_ajax.php プロジェクト: jackpf/ossim-arc
function check_scan_progress($conn, $wizard)
{
    //File to cache scan object
    $user = Session::get_session_user();
    $scan_file = 'w_last_asset_object-' . md5($user);
    $data = array();
    try {
        $obj = Av_scan::get_object_from_file($scan_file);
        //Get status
        $aux_status = $obj->get_status();
        $status = $aux_status['status']['code'];
        if ($status == Av_scan::ST_SCAN_FINISHED) {
            //Scanning has finished properly
            $info = array();
            $scan_report = $obj->download_scan_report();
            //Delete scan
            $obj->delete_scan();
            Cache_file::remove_file($scan_file);
            //Parsing scan report
            $nmap_parser = new Nmap_parser();
            $scan_report = $nmap_parser->parse_json($scan_report, $obj->get_sensor());
            // Add summary
            $scan_report['nmap_data']['elapsed'] = $aux_status['elapsed_time'];
            $info = Welcome_wizard::format_result_scan($conn, $scan_report);
            $wizard->set_step_data('scan_step', 3);
            $wizard->set_step_data('scan_info', $info);
            $data['finish'] = TRUE;
        } else {
            $percent = $aux_status['scanned_targets'] / $aux_status['number_of_targets'] * 100;
            $data['finish'] = FALSE;
            $data['percent'] = round($percent);
            $data['current'] = $aux_status['scanned_targets'];
            $data['total'] = $aux_status['number_of_targets'];
            if ($aux_status['remaining_time'] == -1) {
                $data['time'] = _('Calculating Remaining Time');
            } else {
                $data['time'] = Welcome_wizard::format_time($aux_status['remaining_time']) . ' ' . _('remaining');
            }
        }
        $response['error'] = FALSE;
        $response['data'] = $data;
        $wizard->save_status();
    } catch (Exception $e) {
        $msg = _('Error! Asset scan cannot be completed.  Please try again');
        set_scan_error_message($wizard, $msg);
        $response['error'] = TRUE;
    }
    return $response;
}
コード例 #7
0
function net_devices_activity($conn)
{
    $response = array();
    $wizard = Welcome_wizard::get_instance();
    if ($wizard === FALSE) {
        throw new Exception(_("There was an error, the Welcome_wizard object doesn't exist. Try again later"));
    }
    $plugins = array();
    $flag_end = FALSE;
    $task_id = $wizard->get_step_data('task_id');
    if ($task_id == 'ffffffff-ffff-ffff-ffff-ffffffffffff') {
        $status = 1;
    } else {
        $status = Welcome_wizard::current_jobs($task_id);
        $status = in_array($status['job_status'], array('task-failed', 'task-succeeded', 'task-revoked')) ? 1 : 0;
    }
    if ($status == 1) {
        $devices = Plugin::get_plugins_by_assets();
        foreach ($devices as $h_id => $p_data) {
            $h_id = Util::uuid_format_nc($h_id);
            $p_data = is_array($p_data) ? $p_data : array();
            foreach ($p_data as $pkey => $pdata) {
                $active = Asset_host_devices::check_device_connectivity($conn, $h_id, $pdata['plugin_id'], '', TRUE);
                $plugins[$h_id][$pkey] = $active;
                if ($flag_end) {
                    $flag_end = TRUE;
                }
            }
        }
    }
    $wizard->set_step_data('net_devices_data', $flag_end);
    $wizard->save_status();
    $response['error'] = FALSE;
    $response['data']['plugins'] = $plugins;
    $response['data']['status'] = $status;
    return $response;
}
コード例 #8
0
                                $task = _('Scan Finished');
                            }
                        }
                    }
                }
            }
            if ($data['state'] != 'launching_local_scan') {
                $data['message'] = sprintf(_('%s: <strong>%s</strong> with local sensor, please wait...'), $task, $sc_asset);
                $progress = $obj->get_progress();
                $data['progress']['percent'] = round($progress['hosts_scanned'] / $progress['total_hosts'] * 100);
                $data['progress']['current'] = $progress['hosts_scanned'];
                $data['progress']['total'] = $progress['total_hosts'];
                if ($progress['remaining'] == -1) {
                    $data['progress']['time'] = _('Calculating Remaining Time');
                } else {
                    $data['progress']['time'] = Welcome_wizard::format_time($progress['remaining']) . ' ' . _('remaining');
                }
            } else {
                $data['message'] = NULL;
                $data['progress'] = NULL;
                $data['debug_info'] = NULL;
            }
            $data['debug_info'] = NULL;
        }
    }
} else {
    $scan = new Scan();
    if (preg_match('/finished/i', $scan->get_status())) {
        $lastscan = $scan->get_results();
        $debug_info = '';
        if (is_array($lastscan['nmap_data']) && !empty($lastscan['nmap_data'])) {
コード例 #9
0
function check_scan_progress($conn, $wizard)
{
    $data = array();
    $obj = new Scan();
    $status = $obj->get_status();
    //Get status
    if ($status == 'Scan Finished') {
        $info = array();
        $result = $obj->get_results();
        $obj->delete_data();
        $info = Welcome_wizard::format_result_scan($conn, $result);
        $wizard->set_step_data('scan_step', 3);
        $wizard->set_step_data('scan_info', $info);
        $data['finish'] = TRUE;
    } elseif ($status == 'Scanning Hosts') {
        $progress = $obj->get_progress();
        $percent = $progress['hosts_scanned'] / $progress['total_hosts'] * 100;
        $data['finish'] = FALSE;
        $data['percent'] = round($percent);
        $data['current'] = $progress['hosts_scanned'];
        $data['total'] = $progress['total_hosts'];
        if ($progress['remaining'] == -1) {
            $data['time'] = _('Calculating Remaining Time');
        } else {
            $data['time'] = Welcome_wizard::format_time($progress['remaining']) . ' ' . _('remaining');
        }
    } else {
        $msg = _("Invalid NMAP status ({$status}). Expecting 'Scanning Hosts' or 'Scan Finished'");
        set_scan_error_message($wizard, $msg);
        $response['error'] = TRUE;
        return $response;
    }
    $response['error'] = FALSE;
    $response['data'] = $data;
    $wizard->save_status();
    return $response;
}
コード例 #10
0
ファイル: scan_actions.php プロジェクト: jackpf/ossim-arc
         $targets = $av_scan->get_targets('scan_format');
         $targets_txt = Av_scan::targets_to_string($targets);
         //Database connection
         list($db, $conn) = Ossim_db::get_conn_db();
         $sensor = Av_sensor::get_object($conn, $av_scan->get_sensor());
         $sensor_txt = $sensor->get_name() . ' [' . $sensor->get_ip() . ']';
         $db->close();
         $scan_status['message'] = sprintf(_('Scanning target/s: <strong>%s</strong> with sensor <strong>%s</strong>, please wait...'), $targets_txt, $sensor_txt);
         $scan_status['status'] = $status['status'];
         $scan_status['progress']['percent'] = round($status['scanned_targets'] / $status['number_of_targets'] * 100);
         $scan_status['progress']['current'] = $status['scanned_targets'];
         $scan_status['progress']['total'] = $status['number_of_targets'];
         if (intval($status['remaining_time']) < 0) {
             $scan_status['progress']['time'] = _('Calculating Remaining Time');
         } else {
             $scan_status['progress']['time'] = Welcome_wizard::format_time($status['remaining_time']) . ' ' . _('remaining');
         }
     }
     $data['status'] = 'success';
     $data['data'] = $scan_status;
     break;
 case 'show_scan_report':
     if (file_exists($scan_report_file)) {
         require_once 'scan_util.php';
         $scan_report = file_get_contents($scan_report_file);
         $scan_report = unserialize($scan_report);
         $data['status'] = 'success';
         $data['data'] = NULL;
         if (!empty($scan_report['scanned_ips'])) {
             ob_start();
             //Database connection
コード例 #11
0
ファイル: index.php プロジェクト: jackpf/ossim-arc
require_once 'av_init.php';
Session::useractive();
/* USM Check */
$pro = Session::is_pro();
/* Trial */
$trial_days = Session::trial_days_to_expire();
$flag_trial_popup = FALSE;
if ($pro) {
    if ($trial_days <= 0) {
        if (file_exists('/usr/share/ossim/www/session/trial/index.php')) {
            header("Location: /ossim/session/trial/index.php");
            exit;
        }
    }
}
if (Session::am_i_admin() && Welcome_wizard::run_welcome_wizard()) {
    header('Location: /ossim/wizard/');
}
if ($pro && ($trial_days == 7 || $trial_days == 2)) {
    $db = new ossim_db();
    $conn = $db->connect();
    $user = Session::get_session_user();
    $config = new User_config($conn);
    $popup = $config->get($user, 'popup', 'simple', "trial");
    if ($trial_days == 7) {
        if ($popup != '7days') {
            $flag_trial_popup = TRUE;
            $config->set($user, 'popup', '7days', 'simple', 'trial');
        }
    } elseif ($trial_days == 2) {
        if ($popup != '2days') {