当前位置: 首页>>代码示例>>PHP>>正文


PHP Av_exception::throw_error方法代码示例

本文整理汇总了PHP中Av_exception::throw_error方法的典型用法代码示例。如果您正苦于以下问题:PHP Av_exception::throw_error方法的具体用法?PHP Av_exception::throw_error怎么用?PHP Av_exception::throw_error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Av_exception的用法示例。


在下文中一共展示了Av_exception::throw_error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: check_ossim_error

function check_ossim_error()
{
    if (ossim_error()) {
        $error = ossim_get_error();
        ossim_clean_error();
        Av_exception::throw_error(Av_exception::USER_ERROR, $error);
    }
}
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:8,代码来源:plugin_ajax.php

示例2: get_pulse_detail_from_id

function get_pulse_detail_from_id($conn)
{
    $type = POST('type');
    $pulse = POST('pulse');
    $id = POST('id');
    ossim_valid($type, 'alarm|event|alarm_event', 'illegal:' . _('Type'));
    ossim_valid($pulse, OSS_HEX, 'illegal:' . _('Pulse'));
    ossim_valid($id, OSS_HEX, 'illegal:' . _('ID'));
    if (ossim_error()) {
        Av_exception::throw_error(Av_exception::USER_ERROR, ossim_get_error_clean());
    }
    if ($type == 'alarm') {
        $pulse = Alarm::get_pulse_data_from_alarm($conn, $id, $pulse, TRUE);
    } elseif ($type == 'event') {
        $pulse = Siem::get_pulse_data_from_event($conn, $id, $pulse, FALSE, TRUE);
    } elseif ($type == 'alarm_event') {
        $pulse = Siem::get_pulse_data_from_event($conn, $id, $pulse, TRUE, TRUE);
    }
    return array('name' => $pulse['name'], 'descr' => $pulse['descr'], 'iocs' => array_values($pulse['iocs']));
}
开发者ID:jackpf,项目名称:ossim-arc,代码行数:20,代码来源:otx_reputation_info.php

示例3: make_sid_filter

function make_sid_filter($conn, $ip)
{
    $sids = array();
    if (preg_match("/\\d+\\/\\d+/", $ip)) {
        $aux = Cidr::expand_cidr($ip, 'SHORT', 'IP');
        if ($aux[0] == 'I' && $aux[1] == 'P') {
            $aux[0] = '0x0';
            $aux[1] = '0x0';
        } else {
            $aux[0] = bin2hex(inet_pton($aux[0]));
            $aux[1] = bin2hex(inet_pton($aux[1]));
        }
        $query = "SELECT d.id FROM alienvault_siem.device d, alienvault.sensor s \n\t\t          WHERE d.sensor_id=s.id \n\t\t          AND ( (s.ip >= UNHEX('" . $aux[0] . "') AND s.ip <= UNHEX('" . $aux[1] . "')) \n\t\t          OR (d.device_ip>=UNHEX('" . $aux[0] . "') AND d.device_ip <= UNHEX('" . $aux[1] . "')) )";
    } else {
        $ip = bin2hex(@inet_pton($ip));
        $query = "SELECT d.id FROM alienvault_siem.device d, alienvault.sensor s \n\t\t          WHERE d.sensor_id = s.id AND ( s.ip = UNHEX('{$ip}') OR d.device_ip = UNHEX('{$ip}') )";
    }
    //echo $query;
    if (!($rs =& $conn->Execute($query))) {
        Av_exception::throw_error(Av_exception::DB_ERROR, $conn->ErrorMsg());
    }
    while (!$rs->EOF) {
        $sids[] = $rs->fields['id'];
        $rs->MoveNext();
    }
    return implode(',', $sids);
}
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:27,代码来源:sensor_filter.php

示例4: do_scan

function do_scan($wizard)
{
    try {
        $next_step = 1;
        $data = array('finish' => FALSE);
        //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 == 0) {
            @unlink($scan_file);
        }
        $obj = Av_scan::get_object_from_file($scan_file);
        if (!is_object($obj) || empty($obj)) {
            $nets = $wizard->get_step_data('scan_nets');
            if (count($nets) < 1) {
                $e_msg = _('Invalid networks selected to scan');
                Av_exception::throw_error(Av_exception::USER_ERROR, $e_msg);
            }
            $nets = implode(' ', $nets);
            $scan_options = array('scan_type' => 'fast', 'scan_timing' => 'T3', 'autodetect_os' => 'true', 'reverse_dns' => 'true', 'scan_ports' => '', 'idm' => 'false');
            $obj = new Av_scan($nets, 'local', $scan_options);
            $obj->run();
            Av_scan::set_object_in_file($obj, $scan_file);
        }
        $aux_status = $obj->get_status();
        $status = $aux_status['status']['code'];
        $total = $aux_status['number_of_targets'];
        switch ($status) {
            case Av_scan::ST_SEARCH_FINISHED:
            case Av_scan::ST_SCANNING_HOSTS:
            case Av_scan::ST_SCAN_FINISHED:
                $next_step = $total > 0 ? 2 : 3;
                $wizard->set_step_data('scan_hosts', $total);
                $data = array('finish' => TRUE);
                break;
        }
        $wizard->set_step_data('scan_step', $next_step);
        //error_log("Step: $step\n", 3, '/tmp/test_wizard');
        //error_log("Next Step: $next_step\n", 3, '/tmp/test_wizard');
        //error_log(var_export($aux_status, TRUE)."\n", 3, '/tmp/test_wizard');
        $response['error'] = FALSE;
        $response['data'] = $data;
        $wizard->save_status();
    } catch (Exception $e) {
        //error_log("Error: ".$e->getMessage()."\n", 3, '/tmp/test_wizard');
        $msg = _('Error! Asset scan cannot be completed.  Please try again');
        set_scan_error_message($wizard, $msg);
        $response['error'] = TRUE;
    }
    return $response;
}
开发者ID:jackpf,项目名称:ossim-arc,代码行数:52,代码来源:scan_ajax.php

示例5: array

$sm_perms = array('EventsHids', 'EventsHidsConfig');
$sensor_id = POST('sensor_id');
$agent_id = POST('agent_id');
$agent_ip = POST('agent_ip');
if (Session::menu_perms($m_perms, $sm_perms)) {
    try {
        ossim_valid($agent_id, OSS_DIGIT, 'illegal:' . _('Agent ID'));
        ossim_valid($sensor_id, OSS_HEX, 'illegal:' . _('Sensor ID'));
        if ($agent_ip != 'any') {
            ossim_valid($agent_ip, OSS_IP_CIDR_0, 'illegal:' . _('Agent IP'));
        }
        if (!ossim_error()) {
            $db = new ossim_db();
            $conn = $db->connect();
            if (!Ossec_utilities::is_sensor_allowed($conn, $sensor_id)) {
                Av_exception::throw_error(Av_exception::USER_ERROR, _('Error! Sensor not allowed'));
            }
            $db->close();
        }
        $more_info = Ossec_agent::get_info($sensor_id, $agent_id);
        $last_scan_dates = '';
        if (Asset_host_ips::valid_ip($agent_ip)) {
            $last_scan_dates = Ossec_agent::get_last_scans($sensor_id, $agent_ip);
        }
        if (is_array($more_info) && !empty($more_info)) {
            $syscheck_date = empty($last_scan_dates['syscheck']) ? $more_info[7] : $last_scan_dates['syscheck'];
            $rootcheck_date = empty($last_scan_dates['rootcheck']) ? $more_info[8] : $last_scan_dates['rootcheck'];
            ?>
            <table class='t_agent_mi'>
                <tr><td colspan='2' style='text-align: center;'><?php 
            echo _('Agent information');
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:agent_info.php

示例6: _

*
*
* 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 unexpected error');
}
//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);
?>
<!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>
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:select_nets.php

示例7: session_write_close

session_write_close();
Session::logcheck('environment-menu', 'EventsHidsConfig');
$events_hids_config = Session::menu_perms('environment-menu', 'EventsHidsConfig');
try {
    $db = new ossim_db();
    $conn = $db->connect();
    $sensor_id = POST('sensor_id');
    ossim_valid($sensor_id, OSS_HEX, 'illegal:' . _('Sensor ID'));
    if (!ossim_error()) {
        if (!Ossec_utilities::is_sensor_allowed($conn, $sensor_id)) {
            $e_msg = _('Error! Sensor not allowed');
            Av_exception::throw_error(Av_exception::USER_ERROR, $e_msg);
        }
    } else {
        $e_msg = ossim_get_error_clean();
        Av_exception::throw_error(Av_exception::USER_ERROR, $e_msg);
    }
    $agents = Ossec_agent::get_list($sensor_id);
    $data = array();
    if (is_array($agents) && !empty($agents)) {
        foreach ($agents as $agent_id => $a_data) {
            if (empty($a_data)) {
                continue;
            }
            $a_unique_id = md5($agent_id);
            $agent_actions = Ossec_agent::get_actions($agent_id, $a_data);
            if (!empty($a_data['host_id'])) {
                $asset_name = Asset_host::get_name_by_id($conn, $a_data['host_id']);
            } else {
                $asset_name = '-';
            }
开发者ID:jackpf,项目名称:ossim-arc,代码行数:31,代码来源:dt_agents.php

示例8: _

*
*
* 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>
        <title> <?php 
echo _("AlienVault " . (Session::is_pro() ? "USM" : "OSSIM"));
开发者ID:jackpf,项目名称:ossim-arc,代码行数:31,代码来源:select_nets.php

示例9: get_indicators_from_map

function get_indicators_from_map($conn, $map)
{
    Ossim_db::check_connection($conn);
    $indicators = array();
    $query = "SELECT * FROM risk_indicators WHERE map = UNHEX(?)";
    $params = array($map);
    $rs = $conn->Execute($query, $params);
    if (!$rs) {
        Av_exception::throw_error(Av_exception::DB_ERROR, $conn->ErrorMsg());
    }
    while (!$rs->EOF) {
        if (is_indicator_allowed($conn, $rs->fields['type'], $rs->fields['type_name'])) {
            $id = $rs->fields['id'];
            $indicators[$id] = format_indicator($conn, $rs->fields);
        }
        $rs->MoveNext();
    }
    return $indicators;
}
开发者ID:jackpf,项目名称:ossim-arc,代码行数:19,代码来源:riskmaps_functions.php

示例10: POST

$only_unread = POST('only_unread') ? POST('only_unread') : '';
/**********************************
 ****** VALIDATE POST PARAMS ******
 **********************************/
ossim_valid($search, OSS_INPUT, OSS_NULLABLE, 'illegal:' . _('Search String'));
ossim_valid($only_unread, OSS_LETTER, OSS_NULLABLE, 'illegal:' . _('Only Unread Param'));
/***************************
 ****** RESPONSE VARS ******
 ***************************/
// Response array
$response = array();
// Array to store data
$data = array();
try {
    if (ossim_error()) {
        Av_exception::throw_error(Av_exception::USER_ERROR, ossim_get_error_clean());
    }
    /**********************
     ****** FILTERS *******
     **********************/
    $filters = array();
    if (!empty($search)) {
        $filters['search'] = $search;
    }
    if (!empty($only_unread)) {
        $filters['only_unread'] = 'true';
    }
    /**********************
     ****** GET DATA ******
     **********************/
    $status = new System_notifications();
开发者ID:jackpf,项目名称:ossim-arc,代码行数:31,代码来源:get_notifications_stats.php

示例11: sprintf

                    $response['data']['components_added_msg'] = sprintf($msg, $num_components, $component_type);
                    break;
                    // Delete components
                // Delete components
                case 'delete_components':
                    $tag->remove_components_from_filter($conn);
                    $msg = _('Your label has been deleted from  %d %s(s). You can view asset labels in the asset details');
                    $response['data']['components_deleted_msg'] = sprintf($msg, $num_components, $component_type);
                    break;
                default:
                    Av_exception::throw_error(Av_exception::USER_ERROR, _('Invalid action - please try again'));
            }
        }
        $response['status'] = 'OK';
        $response['data']['id'] = $tag->get_id();
        $response['data']['name'] = $tag->get_name();
        $response['data']['class'] = $tag->get_class();
    } else {
        Av_exception::throw_error(Av_exception::USER_ERROR, _('Action can not be completed'));
    }
} catch (\Exception $e) {
    $error_msg = $e->getMessage();
    if (empty($error_msg)) {
        $error_msg = _('Sorry, operation was not completed due to an error when processing the request');
    }
    $response['status'] = 'error';
    $response['data'] = $error_msg;
}
$db->close();
echo json_encode($response);
exit;
开发者ID:jackpf,项目名称:ossim-arc,代码行数:31,代码来源:tag_components_actions.php

示例12: restart_search

function restart_search($conn, $data)
{
    $return['error'] = FALSE;
    $return['msg'] = '';
    $type = $data['type'];
    ossim_valid($type, 'asset', 'group', 'network', 'illegal:' . _("List Type"));
    if (ossim_error()) {
        $error = ossim_get_error();
        ossim_clean_error();
        $return['error'] = TRUE;
        $return['msg'] = $error;
        return $return;
    }
    Filter_list::delete_filters_from_session();
    try {
        $object = 'Filter_' . $type . '_list';
        if (!class_exists($object)) {
            Av_exception::throw_error(Av_exception::USER_ERROR, _('Invalid List Type'));
        }
        $filter_list = new $object($conn);
        $filter_list->store_filter_list_session();
    } catch (Exception $e) {
        $return['error'] = TRUE;
        $return['msg'] = $e->getMessage();
    }
    return $return;
}
开发者ID:jackpf,项目名称:ossim-arc,代码行数:27,代码来源:asset_filter_ajax.php

示例13: array

                 ***************************/
            /***************************
             ****** Set suppressed *****
             ***************************/
            case 'set_suppressed':
                $status->set_status_message($status_message_id, array('suppressed' => 'true'));
                $data['data'] = _('Notification marked as suppressed');
                break;
                /*******************************
                 ****** Not allowed action *****
                 *******************************/
            /*******************************
             ****** Not allowed action *****
             *******************************/
            default:
                Av_exception::throw_error(Av_exception::USER_ERROR, _('This action could not be completed. Please try again.'));
        }
        $data['status'] = 'OK';
    } catch (\Exception $e) {
        /************************
         ****** Catch error *****
         ************************/
        $error_msg = $e->getMessage();
        if (empty($error_msg)) {
            $error_msg = _('Sorry, operation was not completed due to an error when processing the request. Please try again.');
        }
        Util::response_bad_request($error_msg);
    }
}
$db->close();
echo json_encode($data);
开发者ID:jackpf,项目名称:ossim-arc,代码行数:31,代码来源:notification_actions.php

示例14: save_member_selection

function save_member_selection($conn, $data)
{
    $asset_id = $data['asset_id'];
    $asset_type = $data['asset_type'];
    $member_type = $data['member_type'];
    $all = $data['all'];
    $assets = $data['assets'];
    $search = $data['search'];
    ossim_valid($asset_id, OSS_HEX, 'illegal:' . _('Asset UUID'));
    ossim_valid($asset_type, 'asset', 'network', 'group', 'illegal:' . _('Asset Type'));
    ossim_valid($member_type, 'asset', 'network', 'group', 'illegal:' . _('Asset Type'));
    ossim_valid($search, OSS_INPUT, OSS_NULLABLE, 'illegal:' . _('Search Filter'));
    ossim_valid($assets, OSS_HEX, OSS_NULLABLE, 'illegal:' . _('Assets'));
    ossim_valid($all, OSS_BINARY, 'illegal:' . _('Asset Selection'));
    check_ossim_error();
    if ($all) {
        $total = Filter_list::save_members_from_asset($conn, $asset_id, $asset_type, $search);
    } else {
        $total = Filter_list::save_items($conn, $member_type, $assets);
    }
    if ($total < 1) {
        Av_exception::throw_error(Av_exception::USER_ERROR, _('You need at least one asset to perform any action.'));
    }
    return $total;
}
开发者ID:jackpf,项目名称:ossim-arc,代码行数:25,代码来源:save_selection.php

示例15: ossim_valid

ossim_valid($search_str, OSS_INPUT, OSS_NULLABLE, 'illegal: ' . _('Search String'));
ossim_valid($from, OSS_DIGIT, 'illegal: ' . _('Configuration Parameter 2'));
ossim_valid($sec, OSS_DIGIT, 'illegal: ' . _('Configuration Parameter 3'));
if (ossim_error()) {
    $response['sEcho'] = intval($sec);
    $response['iTotalRecords'] = 0;
    $response['iTotalDisplayRecords'] = 0;
    $response['aaData'] = array();
    echo json_encode($response);
    exit;
}
// Get object from session
$asset_object = unserialize($_SESSION['asset_detail'][$asset_id]);
$class_name = get_class($asset_object);
if (!is_object($asset_object)) {
    Av_exception::throw_error(Av_exception::DB_ERROR, _('Error retrieving the asset data from Memory'));
}
$db = new ossim_db();
$conn = $db->connect();
$filters = array('where' => 'host_properties.property_ref <> 8', 'limit' => "{$from}, {$maxrows}");
if ($search_str != '') {
    $search_str = escape_sql($search_str, $conn);
    $filters['where'] .= ' AND host_properties.value LIKE "%' . $search_str . '%"';
}
// DATA
list($properties, $total) = $asset_object->get_properties($conn, $filters);
$data = array();
foreach ($properties as $_host_id => $prop_list) {
    $_host_aux = Asset_host::get_object($conn, $_host_id);
    $host = $_host_aux->get_name() . ' (' . $_host_aux->get_ips()->get_ips('string') . ')';
    foreach ($prop_list as $prop_id => $prop_data) {
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:get_properties.php


注:本文中的Av_exception::throw_error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。