Exemplo n.º 1
0
require_once dirname(__FILE__) . '/../../../config.inc';
$system_id = POST('system_id');
ossim_valid($system_id, OSS_DIGIT, OSS_LETTER, '-', 'illegal:' . _('System ID'));
//Profiles enabled
$profiles = empty($_POST['profiles']) ? array() : array_flip(explode(',', $_POST['profiles']));
unset($profiles['database']);
if (ossim_error()) {
    $config_nt = array('content' => ossim_get_error(), 'options' => array('type' => 'nf_error', 'cancel_button' => FALSE), 'style' => 'margin: auto; width: 90%; text-align: center;');
    $nt = new Notification('nt_1', $config_nt);
    $nt->show();
    exit;
}
/**************************************************************
*****************  Logs  *****************
***************************************************************/
$log_files = Av_center::get_available_logs();
$t_header = array('sensor' => array('id' => 'h_sensor', 'title' => _('Alienvault Sensor')), 'server' => array('id' => 'h_server', 'title' => _('Alienvault Server')), 'framework' => array('id' => 'h_framework', 'title' => _('AlienVault Web')));
?>
<div id='log_container'>

    <div class='sec_title'><?php 
echo _('System Logs');
?>
</div>
	<table id='t_logs'>
		<thead>			
			<tr>
				<td class='subheader_e'></td>
				
				<td class='subheader sh_selected' id='h_system'><?php 
echo _('System');
Exemplo n.º 2
0
function get_only_updates()
{
    $new_updates = Av_center::get_software_updates();
    $return['error'] = FALSE;
    $return['output'] = $new_updates;
    return $return;
}
Exemplo n.º 3
0
     }
 } else {
     $data = array();
     $force_delete = TRUE;
     //If we do not confirm the delete, then we check if the system is down
     if (!$confirm) {
         $reachable = Av_center::is_system_reachable($system_id);
         //If the system is down then we'll ask the user for extra confirmation
         if (!$reachable) {
             $force_delete = FALSE;
         }
     }
     //Delete the system
     if ($force_delete) {
         try {
             $res = Av_center::delete_system($system_id);
             // Refresh
             Av_component::report_changes('sensors');
             Av_component::report_changes('servers');
             $data['status'] = 'success';
             $data['data'] = $res;
         } catch (Exception $e) {
             $data['status'] = 'error';
             $data['data'] = $e->getMessage();
         }
     } else {
         //Ask for confirmation
         $data['status'] = 'confirm';
         $data['data'] = '';
     }
 }
Exemplo n.º 4
0
    $data = array();
    $data['general_admin_ip'] = POST('admin_ip');
    $data['general_hostname'] = POST('hostname');
    if (POST('ntp_server') == '') {
        $data['general_ntp_server'] = 'no';
    } else {
        //Change NTP Server format(from comma-separated to space-separated)
        /*
        $ntp_servers = trim(POST('ntp_server'));
        $ntp_servers = str_replace(' ', '', $ntp_servers);
        $ntp_servers = str_replace(',', ' ', $ntp_servers);
        */
        //One IP address or server name is allowed (Patch temporary)
        $data['general_ntp_server'] = POST('ntp_server');
    }
    if (POST('mailserver_relay') == '') {
        $data['general_mailserver_relay'] = 'no';
        $data['general_mailserver_relay_passwd'] = 'unconfigured';
        $data['general_mailserver_relay_user'] = '******';
        $data['general_mailserver_relay_port'] = '25';
    } else {
        $data['general_mailserver_relay'] = POST('mailserver_relay');
        if (!Util::is_fake_pass(POST('mailserver_relay_passwd'))) {
            $data['general_mailserver_relay_passwd'] = POST('mailserver_relay_passwd') == '' ? 'unconfigured' : POST('mailserver_relay_passwd');
        }
        $data['general_mailserver_relay_user'] = POST('mailserver_relay_user') == '' ? 'unconfigured' : POST('mailserver_relay_user');
        $data['general_mailserver_relay_port'] = POST('mailserver_relay_port') == '' ? '25' : POST('mailserver_relay_port');
    }
    $res = Av_center::set_network_configuration($system_id, $data);
    echo json_encode($res);
}
Exemplo n.º 5
0
    echo json_encode($data);
    exit;
}
if ($action == 'update_system' || $action == 'update_system_feed') {
    //Check system status
    $res = Av_center::get_task_status($system_id, 'alienvault-update');
    if ($res['status'] == 'done') {
        if ($action == 'update_system') {
            $data = Av_center::update_av_system($system_id);
        } else {
            $data = Av_center::update_av_feed($system_id);
        }
    } elseif ($res['status'] == 'running') {
        $data['status'] = 'warning';
        $data['data'] = _('Update process was launched previously');
    } else {
        $data['status'] = 'warning';
        $data['data'] = _('Update process can not be launched at this time.  Please, try again later');
    }
} elseif ($action == 'check_update_status') {
    sleep(2);
    $res = Av_center::get_task_status($system_id, 'alienvault-update');
    $data['status'] = 'success';
    if ($res['status'] == 'running') {
        $data['data'] = 'sw_pkg_installing';
    } else {
        $data['data'] = 'sw_pkg_pending';
    }
}
echo json_encode($data);
exit;
Exemplo n.º 6
0
/**
 * This function calculates status of systems with profile sensor enabled
 *
 * @param object $conn  DataBase access object
 *
 * @return array
 */
function calc_sensors_status($conn)
{
    // Getting system list
    $avc_list = Av_center::get_avc_list($conn);
    $total = 0;
    $up_sensors = array();
    $down_sensors = array();
    // Getting DOWN systems
    $filters = array('level' => 'error', 'message_id' => Util::uuid_format('00000000000000000000000000010011'));
    $pagination = array('page' => 1, 'page_rows' => count($avc_list['data']));
    $status = new System_notifications();
    list($notification_list, $total_notifications) = $status->get_status_messages($filters, $pagination);
    if ($total_notifications > 0) {
        $down_systems = array();
        foreach ($notification_list as $notification) {
            $down_systems[$notification['component_id']] = 1;
        }
    }
    //Calculating UP and DOWN sensors
    if (is_array($avc_list['data']) && !empty($avc_list['data'])) {
        foreach ($avc_list['data'] as $avc_data) {
            if (preg_match('/sensor/i', $avc_data['profile'])) {
                if (isset($down_systems[Util::uuid_format($avc_data['system_id'])])) {
                    $down_sensors[$avc_data['sensor_id']] = 1;
                } else {
                    $up_sensors[$avc_data['sensor_id']] = 1;
                }
            }
        }
    }
    $up = count($up_sensors);
    $down = count($down_sensors);
    $total = $up + $down;
    return array($total, $up, $down);
}
Exemplo n.º 7
0
*
*/
//Config File
require_once dirname(__FILE__) . '/../../../config.inc';
session_write_close();
$res_si = array();
$packages_info = array();
$release_info = array();
$error_msg = NULL;
try {
    //Get software information
    $no_cache = $id_section == 'sw_pkg_checking' ? TRUE : FALSE;
    $res_si = Av_center::get_system_status($system_id, 'software', $no_cache);
    if ($res_si['packages']['pending_updates'] == TRUE) {
        $packages_info = Av_center::get_packages_pending($system_id, TRUE);
        $release_info = Av_center::get_release_info($system_id);
    }
} catch (\Exception $e) {
    $error_msg = $e->getMessage();
}
?>

<div id='cont_sw_av'>
    <?php 
if (is_array($release_info) && !empty($release_info)) {
    $r_class = preg_match('/patch/i', $release_info['type']) ? 'r_patch' : 'r_upgrade';
    ?>
        <div id='c_release_info'>
            <div>
                <div id='r_title'>
                    <?php 
Exemplo n.º 8
0
require_once dirname(__FILE__) . '/../../../config.inc';
session_write_close();
if ($_SERVER['SCRIPT_NAME'] != '/ossim/av_center/data/sections/home/alienvault_status.php') {
    exit;
}
$system_id = POST('system_id');
$force_request = POST('force_request') == 1 ? TRUE : FALSE;
ossim_valid($system_id, OSS_DIGIT, OSS_LETTER, '-', 'illegal:' . _('System ID'));
$error_msg = NULL;
if (ossim_error()) {
    $error_msg = _('System ID not found. Information not available');
    echo 'error###' . $error_msg;
    exit;
}
try {
    $st = Av_center::get_system_status($system_id, 'alienvault', $force_request);
    $st = $st['profiles'];
} catch (\Exception $e) {
    echo 'error###' . $e->getMessage();
    exit;
}
/*************************************************************
******************  Alienvault Status Data *******************
**************************************************************/
$profiles = array();
//Sensor profile
if (is_array($st['sensor']) && !empty($st['sensor'])) {
    $plugins_enabled = $st['sensor']['plugins_enabled'];
    $sniffing_interfaces = empty($st['sensor']['sniffing_interfaces']) ? "<img src='" . AVC_PIXMAPS_DIR . "/cross.png' alt='" . _('No') . "'/>" : str_replace(',', ', ', $st['sensor']['sniffing_interfaces']);
    $network_monitored = $st['sensor']['network_monitored'];
    $netflow = $st['sensor']['sensor_netflow'] == 'yes' ? 'tick.png' : 'cross.png';
Exemplo n.º 9
0
ossim_valid($log_id, OSS_LETTER, '_', 'illegal:' . _('Log id'));
ossim_valid($num_rows, OSS_DIGIT, 'illegal:' . _('Num Rows'));
if (ossim_error()) {
    $data['status'] = 'error';
    $data['data'] = ossim_get_error();
    echo json_encode($data);
    exit;
}
if ($action == 'view_log') {
    session_start();
    if (!isset($_SESSION['log_files'])) {
        $_SESSION['log_files'] = Av_center::get_available_logs();
        $log_files = $_SESSION['log_files'];
    } else {
        $log_files = $_SESSION['log_files'];
    }
    session_write_close();
    if (empty($log_files[$log_id])) {
        $data['status'] = 'error';
        $data['data'] = _("Log file not found");
    } else {
        if (array_key_exists($log_files[$log_id]['section'], $profiles) || $log_files[$log_id]['section'] == 'system') {
            $data = Av_center::get_log_file($system_id, $log_id, $num_rows);
        } else {
            $data['status'] = 'error';
            $data['data'] = _("You don't have permission to view this log");
        }
    }
    echo json_encode($data);
    exit;
}
Exemplo n.º 10
0
$url .= 'SERVER_IP/ossim/session/login.php?action=logout';
/**************************************************************
*****************  General Configuraton Data  *****************
***************************************************************/
$general_cnf = Av_center::get_general_configuration($system_id);
if ($general_cnf['status'] == 'error') {
    $config_nt = array('content' => _('Error retrieving information. Please, try again'), 'options' => array('type' => 'nf_error', 'cancel_button' => FALSE), 'style' => 'margin: 100px auto; width: 550px; text-align: center;');
    $nt = new Notification('nt_1', $config_nt);
    $nt->show();
} else {
    $cnf_data = $general_cnf['data'];
    $yes_no = array('no' => _('No'), 'yes' => _('Yes'));
    //Get all admin IPs
    try {
        $admin_ips[$cnf_data['admin_ip']['value']] = $cnf_data['admin_ip']['value'];
        $st = Av_center::get_system_status($system_id, 'network');
        foreach ($st['interfaces'] as $i_name => $i_data) {
            if ($i_name != 'lo' && $i_data['ipv4']['address'] != '') {
                $admin_ips[$i_data['ipv4']['address']] = $i_data['ipv4']['address'];
            }
        }
    } catch (Exception $e) {
    }
    ?>
    <div id='gc_notification'>
        <div id='gc_info' class='c_info'></div>
    </div>

    <div id='gc_container'>

        <div class="w_overlay" style="height:100%;"></div>
Exemplo n.º 11
0
        session_write_close();
        try {
            $data['status'] = 'success';
            //System Status
            $data['data']['general_status'] = Av_center::get_system_status($system_id, 'general', TRUE);
            //Network Status
            $data['data']['network_status'] = Av_center::get_system_status($system_id, 'network', TRUE);
        } catch (Exception $e) {
            $data['status'] = 'error';
            $data['data']['general_status'] = NULL;
            $data['data']['network_status'] = NULL;
        }
    } elseif ($id_section == 'sw_pkg_installing') {
        $us = Av_center::get_update_status($system_id);
        if ($us['status'] == 'fail') {
            $us['status'] = 'error';
            if (file_exists($us['log'])) {
                $us['msg'] .= _(" For further information please check the following log: ") . $us['log'];
            }
        } elseif ($us['status'] == 'done') {
            //Refresh software information (Cache will be flushed)
            try {
                Av_center::get_system_status($system_id, 'software', TRUE);
            } catch (\Exception $e) {
            }
        }
        $data['status'] = $us['status'];
        $data['data'] = $us['msg'];
    }
    echo json_encode($data);
}
Exemplo n.º 12
0
*
* 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
*
*/
//Config File
require_once dirname(__FILE__) . '/../../../config.inc';
$system_id = POST('system_id');
$action = POST('action');
ossim_valid($system_id, OSS_DIGIT, OSS_LETTER, '-', 'illegal:' . _('System ID'));
ossim_valid($action, OSS_LETTER, '_', 'illegal:' . _('Action'));
if (ossim_error()) {
    $config_nt = array('content' => ossim_get_error(), 'options' => array('type' => 'nf_error', 'cancel_button' => FALSE), 'style' => 'margin: auto; width: 80%;');
    $nt = new Notification('nt_1', $config_nt);
    $nt->show();
    exit;
}
if ($action == 'check_reconfig_status') {
    sleep(1);
    $executing_reconfig = -1;
    //Check Reconfig status
    $reconfig = Av_center::get_task_status($system_id, 'alienvault-reconfig');
    if ($reconfig['status'] == 'running') {
        $executing_reconfig = 1;
    } else {
        $executing_reconfig = 0;
    }
    echo $executing_reconfig;
}
Exemplo n.º 13
0
require_once dirname(__FILE__) . '/../../../config.inc';
session_write_close();
if ($_SERVER['SCRIPT_NAME'] != '/ossim/av_center/data/sections/home/network.php') {
    exit;
}
$system_id = POST('system_id');
$force_request = 1 == POST('force_request') ? TRUE : FALSE;
ossim_valid($system_id, OSS_DIGIT, OSS_LETTER, '-', 'illegal:' . _('System ID'));
$error_msg = NULL;
if (ossim_error()) {
    $error_msg = _('System ID not found. Information not available');
    echo 'error###' . $error_msg;
    exit;
}
try {
    $st = Av_center::get_system_status($system_id, 'network', $force_request);
} catch (\Exception $e) {
    echo 'error###' . $e->getMessage();
    exit;
}
/*************************************************************
***********************  Network Data  ***********************
*************************************************************/
$dns_servers = $st['dns_servers'];
$dns = is_array($dns_servers) && !empty($dns_servers) ? 'tick.png' : 'cross.png';
$firewall_active = 'yes' === $st['firewall_active'] ? 'tick.png' : 'cross.png';
$internet = 'yes' === $st['internet_connection'] ? 'tick.png' : 'cross.png';
$vpn_access = 'yes' === $st['vpn_access'] ? 'tick.png' : 'cross.png';
$img_firewall = AVC_PIXMAPS_DIR . '/' . $firewall_active;
$img_internet = AVC_PIXMAPS_DIR . '/' . $internet;
$img_vpn = AVC_PIXMAPS_DIR . '/' . $vpn_access;
Exemplo n.º 14
0
/**
 * @param object $conn  DataBase access object
 *
 * @return array
 */
function calc_sensors_status($conn)
{
    // Get component list
    $avc_list = Av_center::get_avc_list($conn);
    $total = count($avc_list['data']);
    $up = $total;
    $down = 0;
    // Get notifications list
    $filters = array('level' => 'notification', 'message_id' => 11);
    $pagination = array('page' => 1, 'page_rows' => $total);
    $status = new System_status();
    list($notification_list, $total_notifications) = $status->get_status_messages($filters, $pagination);
    if ($total_notifications > 0) {
        $notification_components = array();
        foreach ($notification_list as $notification) {
            $notification_components[$notification['component_id']] = 1;
        }
        foreach ($avc_list['data'] as $avc_data) {
            if (preg_match('/sensor/i', $avc_data['profile'])) {
                if (isset($notification_components[Util::uuid_format($avc_data['system_id'])])) {
                    $down++;
                    $up--;
                }
            }
        }
    }
    return array($total, $up, $down);
}
Exemplo n.º 15
0
require_once dirname(__FILE__) . '/../../../config.inc';
session_write_close();
if ($_SERVER['SCRIPT_NAME'] != '/ossim/av_center/data/sections/home/system_status.php') {
    exit;
}
$system_id = POST('system_id');
$force_request = POST('force_request') == 1 ? TRUE : FALSE;
ossim_valid($system_id, OSS_DIGIT, OSS_LETTER, '-', 'illegal:' . _('System ID'));
$error_msg = NULL;
if (ossim_error()) {
    $error_msg = _('System ID not found. Information not available');
    echo 'error###' . $error_msg;
    exit;
}
try {
    $st = Av_center::get_system_status($system_id, 'general', $force_request);
} catch (\Exception $e) {
    echo 'error###' . $e->getMessage();
    exit;
}
/**************************************************************
********************  System Status Data  ********************
**************************************************************/
$hostname = $st['hostname'] . ' [' . $st['admin_ip'] . ']';
$system_time = $st['system_time'];
$system_uptime = $st['uptime'];
$running_processes = $st['process']['total'];
$load_average = $st['load_average'];
$current_sessions = $st['sessions']['total'];
//CPU
$cpu_data = $st['cpu'];
Exemplo n.º 16
0
    ?>
    				var av_components = [ <?php 
    echo $av_components;
    ?>
 ];
    				Main.autocomplete_avc(av_components);
    												
    				$('#go').click(function() { Main.search(); }); 
    														
    				<?php 
    if ($external_access == TRUE && count($avc_list['data']) == 1) {
        $ip_data = Av_center::get_system_info_by_ip($conn, $ip);
        if ($ip_data['status'] == 'error') {
            if (is_array($avc_list['data']) && !empty($avc_list['data'])) {
                $system_ids = array_keys($avc_list['data']);
                $ip_data = Av_center::get_system_info_by_id($conn, $system_ids[0]);
            }
        }
        if ($ip_data['status'] == 'success') {
            ?>
    						Main.display_avc_info(false);
    																				
    						var data = {
    							system_id: '<?php 
            echo $ip_data['data']['system_id'];
            ?>
', 
    							profiles:  '<?php 
            echo $ip_data['data']['profile'];
            ?>
', 
Exemplo n.º 17
0
 ossim_valid($sensor_id, OSS_HEX, 'illegal:' . _('Sensor ID'));
 if (ossim_error()) {
     echo "<div style='color:gray; margin:15px; text-align:center;'>" . _('Trend chart not available') . "</div>";
     exit;
 }
 $tz = Util::get_timezone();
 $timetz = gmdate("U") + 3600 * $tz;
 // time to generate dates with timezone correction
 $agent = $_SESSION['_agent_info'][md5($agent_id)];
 $db = new ossim_db();
 $conn = $db->connect();
 //Agents trends
 if ($agent['ip'] == '127.0.0.1') {
     // Get default system uuid
     $system_id = Util::get_system_uuid();
     $system_info = Av_center::get_system_info_by_id($conn, $system_id);
     if ($system_info['status'] == 'success') {
         $sensor_ip = $system_info['data']['admin_ip'];
     }
     $ip_cidr = empty($sensor_ip) ? $agent['ip'] : $sensor_ip;
 } else {
     $agent_idm_data = Ossec_agent::get_idm_data($sensor_id, $agent['ip']);
     $agent_idm_ip = $agent_idm_data['ip'];
     if (empty($agent_idm_ip)) {
         try {
             $agent_idm_ip = Ossec_agent::get_last_ip($sensor_id, $agent);
         } catch (Exception $e) {
         }
     }
     $ip_cidr = Asset_host_ips::valid_ip($agent_idm_ip) ? $agent_idm_ip : $agent['ip'];
 }
Exemplo n.º 18
0
* 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
*
*/
//Config File
require_once dirname(__FILE__) . '/../../../config.inc';
session_write_close();
$packages_info = array();
$error_msg = NULL;
try {
    $packages_info = Av_center::get_packages_installed($system_id);
} catch (Exception $e) {
    $error_msg = $e->getMessage();
}
?>


<div id='cont_sw_av'>
    <table class='table_data t_info_pkg'>
    <?php 
if (is_array($packages_info) && !empty($packages_info)) {
    ?>
        <thead>
           <tr>
                <th><?php 
    echo _('Package');
Exemplo n.º 19
0
 } catch (Exception $e) {
     $validation_errors['asset_id'] = $e->getMessage();
 }
 if (empty($validation_errors)) {
     //Getting asset information
     $_ips = $asset->get_ips();
     $ips = $_ips->get_ips();
     //Checking HIDS Sensor
     $cnd_1 = Ossec_utilities::is_sensor_allowed($conn, $sensor_id) == FALSE;
     $asset_sensors = Asset_host_sensors::get_sensors_by_id($conn, $asset_id);
     $cnd_2 = empty($asset_sensors[$sensor_id]);
     if ($cnd_1 || $cnd_2) {
         $validation_errors['sensor_id'] = sprintf(_("Sensor %s not allowed. Please check with your account admin for more information"), Av_sensor::get_name_by_id($conn, $sensor_id));
     } else {
         $system_ids = Av_center::get_system_id_by_component($conn, $sensor_id);
         $res = Av_center::get_system_info_by_id($conn, $system_ids['non-canonical']);
         if ($res['status'] == 'success') {
             //We use this function to calculate sensor name because in HA environments there are two systems for one Sensor ID
             if (empty($res['data']['ha_ip'])) {
                 $sensor_name = $res['data']['name'];
             } else {
                 $sensor_name = Av_sensor::get_name_by_id($conn, $sensor_id);
             }
             $sensor_ip = $res['data']['current_ip'];
             if (Ossec_utilities::get_default_sensor_id() == $sensor_id && empty($res['data']['ha_ip'])) {
                 $sensor_ip = $res['data']['admin_ip'];
             }
             $sensor_ip_txt = $sensor_ip . ' [' . $sensor_name . ']';
         }
         //Getting Agent information
         $_aux_agent = Asset_host::get_related_hids_agents($conn, $asset_id, $sensor_id);
Exemplo n.º 20
0
require_once dirname(__FILE__) . '/../../../config.inc';
session_write_close();
if ($_SERVER['SCRIPT_NAME'] != '/ossim/av_center/data/sections/home/software.php') {
    exit;
}
$system_id = POST('system_id');
$force_request = POST('force_request') == 1 ? TRUE : FALSE;
ossim_valid($system_id, OSS_DIGIT, OSS_LETTER, '-', 'illegal:' . _('System ID'));
$error_msg = NULL;
if (ossim_error()) {
    $error_msg = _('System ID not found. Information not available');
    echo "error###{$error_msg}";
    exit;
}
try {
    $st = Av_center::get_system_status($system_id, 'software', $force_request);
} catch (\Exception $e) {
    echo 'error###' . $e->getMessage();
    exit;
}
/*************************************************************
***********************  Software Data  **********************
**************************************************************/
$current_version = _('Unknown');
$packages_installed = _('Unknown');
$last_update = '--';
if (is_array($st) && !empty($st)) {
    //Packages installed
    $packages_installed = $st['packages']['total'];
    //Last update
    if ($st['last_update'] != '' && $st['last_update'] != 'unknown') {
Exemplo n.º 21
0
    if (is_array($validation_errors) && !empty($validation_errors)) {
        $data['status'] = 'error';
        $data['data'] = $validation_errors;
        echo json_encode($data);
        exit;
    } elseif (POST('ajax_validation_all') == TRUE && empty($validation_errors)) {
        $data['status'] = 'OK';
        echo json_encode($data);
        exit;
    }
}
//Action: Save Network Configuration
$action = POST('action');
if ($action == 'save_changes') {
    $system_id = POST('system_id');
    ossim_valid($system_id, OSS_DIGIT, OSS_LETTER, '-', 'illegal:' . _('System ID'));
    if (ossim_error()) {
        $data['status'] = 'error';
        $data['data'] = ossim_get_error();
        echo json_encode($data);
        exit;
    }
    $data = array();
    $data['general_admin_dns'] = str_replace(' ', '', POST('admin_dns'));
    $data['firewall_active'] = POST('firewall_active');
    $data['general_admin_ip'] = POST('admin_ip');
    $data['general_admin_gateway'] = POST('admin_gateway');
    $data['general_admin_netmask'] = POST('admin_netmask');
    $res = Av_center::set_general_configuration($system_id, $data);
    echo json_encode($res);
}
Exemplo n.º 22
0
    echo json_encode($data);
    exit;
} else {
    //Checking form token
    if (!isset($_POST['ajax_validation_all']) || POST('ajax_validation_all') == FALSE) {
        if (Token::verify('tk_form_a_deployment', POST('token')) == FALSE) {
            Token::show_error();
            exit;
        }
    }
    $validation_errors = validate_form_fields('POST', $validate);
    //Check Token
    if (empty($validation_errors)) {
        $db = new ossim_db();
        $conn = $db->connect();
        $res = Av_center::get_system_info_by_ip($conn, POST('sensor_ip'));
        if ($res['status'] == 'success') {
            $sensor_id = $res['data']['sensor_id'];
            $ossec_server_ip = $res['data']['admin_ip'];
            if (!Ossec_utilities::is_sensor_allowed($conn, $sensor_id)) {
                $validation_errors['sensor_ip'] = _('Error! Sensor not allowed');
            }
        } else {
            $validation_errors['sensor_ip'] = _('Error! Unable to validate sensor IP');
        }
        $db->close();
    }
}
if (is_array($validation_errors) && !empty($validation_errors)) {
    $data['status'] = 'error';
    if (POST('ajax_validation_all') == TRUE) {
Exemplo n.º 23
0
        $conn = $db->connect();
        $avc_tree = new Avc_tree($conn, $type);
        $db->close();
        if ($avc_tree->is_valid_order($type) == FALSE) {
            $t_load_error = utf8_encode(_('Load error'));
            echo '{"title" : "<span>' . $t_load_error . '</span>", "icon" : "", "addClass" : "bold_red dynatree-statusnode-error",  "key" : "error",  "noLink" : true}';
            exit;
        }
    }
    $avc_tree = $_SESSION['tree_object'];
    session_write_close();
    echo $avc_tree->get_branch($key, $page);
} elseif (POST('action') == 'display_avc') {
    $db = new ossim_db();
    $conn = $db->connect();
    $avc_list = Av_center::get_avc_list($conn);
    $db->close();
    if ($avc_list['status'] == 'error') {
        echo "error###" . _("Error retrieving Alienvault Component");
        exit;
    }
    echo "success###";
    ?>
        <div id='avc_list_container'>
            <div id='header_avc_list'>
                <div id='l_hal'><?php 
    echo _('Alienvault Components Information');
    ?>
</div>
                <div id='r_hal'></div>
                <div id='c_hal'><div id='c_hal_content'></div></div>
Exemplo n.º 24
0
    </script>
    
</head>

<body>

	<div class='content'>

        <div id='w_notif'></div>
        
		<div style="padding:30px">

        <?php 
if ($system_id && $rpass) {
    try {
        $data = Av_center::add_system($system_id, $rpass);
        $config_nt = array('content' => sprintf(_("<< %s >> successfully authenticated"), "<b>" . $data['hostname'] . "</b>"), 'options' => array('type' => 'nf_success', 'cancel_button' => false), 'style' => 'width: 60%; margin: 10px auto 30px auto; text-align:center;');
        $nt = new Notification('nt_1', $config_nt);
        $nt->show();
        Util::make_form("POST", AV_MAIN_PATH . "/#configuration/deployment/components", "_top", "Close");
    } catch (Exception $e) {
        $config_nt = array('content' => $e->getMessage(), 'options' => array('type' => 'nf_error', 'cancel_button' => false), 'style' => 'width: 80%; margin: 10px auto 30px auto; text-align:center;');
        $nt = new Notification('nt_1', $config_nt);
        $nt->show();
        Util::make_form("POST", "add_system.php?id=" . urlencode($system_id));
    }
} else {
    ?>
            
            <form action="add_system.php" method="POST">
            <input type="hidden" name="id" value="<?php 
Exemplo n.º 25
0
require_once 'data/sections/configuration/utilities.php';
session_write_close();
$system_id = POST('system_id');
ossim_valid($system_id, OSS_DIGIT, OSS_LETTER, '-', 'illegal:' . _('System ID'));
if (ossim_error()) {
    $config_nt = array('content' => ossim_get_error(), 'options' => array('type' => 'nf_error', 'cancel_button' => FALSE), 'style' => 'margin: auto; width: 90%; text-align: center;');
    $nt = new Notification('nt_1', $config_nt);
    $nt->show();
    exit;
}
/**************************************************************
*****************  Sensor Configuraton Data  *****************
***************************************************************/
$db = new ossim_db();
$conn = $db->connect();
$sensor_cnf = Av_center::get_sensor_configuration($system_id);
if ($sensor_cnf['status'] == 'error') {
    $config_nt = array('content' => _('Error retrieving information. Please, try again'), 'options' => array('type' => 'nf_error', 'cancel_button' => FALSE), 'style' => 'margin: 100px auto; width: 550px; text-align: center;');
    $nt = new Notification('nt_1', $config_nt);
    $nt->show();
} else {
    session_start();
    $cnf_data = $sensor_cnf['data'];
    $_SESSION['sensor_cnf'] = $cnf_data;
    session_write_close();
    /*
    echo "<pre>";
    	print_r($cnf_data);
    echo "</pre>";
    */
    ?>
Exemplo n.º 26
0
session_write_close();
$system_id = POST('system_id');
ossim_valid($system_id, OSS_DIGIT, OSS_LETTER, '-', 'illegal:' . _('System ID'));
if (ossim_error()) {
    $config_nt = array('content' => ossim_get_error(), 'options' => array('type' => 'nf_error', 'cancel_button' => FALSE), 'style' => 'margin: auto; width: 90%; text-align: center;');
    $nt = new Notification('nt_1', $config_nt);
    $nt->show();
    exit;
}
//Framework URL
$url = empty($_SERVER['HTTPS']) ? 'http://' : 'https://';
$url .= 'SERVER_IP/ossim/session/login.php?action=logout';
/**************************************************************
*****************  Network Configuraton Data  *****************
***************************************************************/
$network_cnf = Av_center::get_network_configuration($system_id);
if ($network_cnf['status'] == 'error') {
    $config_nt = array('content' => _('Error retrieving information. Please, try again'), 'options' => array('type' => 'nf_error', 'cancel_button' => FALSE), 'style' => 'margin: 100px auto; width: 550px; text-align: center;');
    $nt = new Notification('nt_1', $config_nt);
    $nt->show();
} else {
    $cnf_data = $network_cnf['data'];
    $yes_no = array('no' => _('No'), 'yes' => _('Yes'));
    ?>
	<div id='nc_notification'>
        <div id='nc_info' class='c_info'></div>
	</div>
    
	<div id='nc_container'>
		
		<div class="w_overlay" style="height:100%;"></div>
Exemplo n.º 27
0
    session_write_close();
    //Update master server
    if (!empty($old_server) && $old_server == $server_ip) {
        $res['status'] = 'success';
        $res['data']['id'] = md5($new_server);
        $res['data']['server_type'] = _('Server, Inventory');
        $res['data']['is_master'] = TRUE;
    } else {
        $res['status'] = 'success';
        $res['data']['id'] = md5($new_server);
        $res['data']['server_type'] = _('Server');
        $res['data']['is_master'] = FALSE;
    }
    session_write_close();
    echo json_encode($res);
    exit;
} elseif ($action == 'detectors') {
    try {
        $db = new ossim_db();
        $conn = $db->connect();
        $sensor_ids = Av_center::get_component_id_by_system($conn, $system_id);
        $db->close();
        $res['status'] = 'success';
        $res['data'] = Av_center::get_detectors_status($sensor_ids['canonical']);
    } catch (\Exception $e) {
        $res['status'] = 'error';
        $res['data'] = $e->getMessage();
    }
    echo json_encode($res);
    exit;
}
Exemplo n.º 28
0
    }
    $data = array();
    if (is_array($_POST['sensor_networks']) && !empty($_POST['sensor_networks'])) {
        $data['sensor_networks'] = implode(',', $_POST['sensor_networks']);
    }
    if (is_array($_POST['sensor_interfaces']) && !empty($_POST['sensor_interfaces'])) {
        $data['sensor_interfaces'] = implode(',', $_POST['sensor_interfaces']);
    }
    if (isset($_POST['sensor_detectors'])) {
        $data['sensor_detectors'] = '';
        if (is_array($_POST['sensor_detectors']) && !empty($_POST['sensor_detectors'])) {
            //Change deprecated plugin Ossec_av_format by ossec-single-line
            $s_detectors = array_flip($_POST['sensor_detectors']);
            if (array_key_exists('ossec_av_format', $s_detectors)) {
                unset($s_detectors['ossec_av_format']);
                unset($s_detectors['ossec-single-line']);
                $s_detectors = array_flip($s_detectors);
                $s_detectors[] = 'ossec-single-line';
                $_POST['sensor_detectors'] = $s_detectors;
            }
            $data['sensor_detectors'] = implode(',', $_POST['sensor_detectors']);
        }
    }
    $data['sensor_mservers'] = $mservers;
    $data['server_server_ip'] = $server_ip;
    // Server IP
    /* If server_ip is 127.0.0.1, we change local IP for real IP */
    $data['framework_framework_ip'] = $server_ip == $l_server_ip_1 ? $l_server_ip_2 : $server_ip;
    $res = Av_center::set_sensor_configuration($system_id, $data);
    echo json_encode($res);
}
Exemplo n.º 29
0
*
* 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
*
*/
//Get all plugins and enabled plugins
$plugins = array();
$s_plugins = array();
try {
    $sensor_id = 'local';
    if ($system_id != 'local') {
        $db = new Ossim_db();
        $conn = $db->connect();
        $sensor_ids = Av_center::get_component_id_by_system($conn, $system_id, 'sensor');
        $db->close();
        if (is_array($sensor_ids) && !empty($sensor_ids)) {
            $sensor_id = $sensor_ids['canonical'];
        }
    }
    $plugins = Plugin::get_plugins_from_api($sensor_id);
    $plugins = array_keys($plugins);
    $s_plugins = Plugin::get_plugins_from_api($sensor_id, array(), TRUE);
    // only enabled
} catch (Exception $e) {
}
//Check deprecated plugins
$deprecated_plugins = FALSE;
//OSSEC
if (array_key_exists('ossec_av_format', $s_plugins)) {
Exemplo n.º 30
0
*
*
* 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';
if (!Session::am_i_admin()) {
    $config_nt = array('content' => _("You do not have permission to see this section"), 'options' => array('type' => 'nf_error', 'cancel_button' => false), 'style' => 'width: 60%; margin: 30px auto; text-align:center;');
    $nt = new Notification('nt_1', $config_nt);
    $nt->show();
    die;
}
$_system_list_data = Av_center::get_avc_list_from_api(TRUE);
$default_system_id = strtolower(Util::get_default_uuid());
if ($_system_list_data['status'] != 'success') {
    // Exception
}
$system_list = $_system_list_data['data'];
$checking_msg = _('Checking for backups in progress');
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title><?php 
echo _('AlienVault ' . (Session::is_pro() ? 'USM' : 'OSSIM'));
?>
</title>