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


PHP ossim_valid函数代码示例

本文整理汇总了PHP中ossim_valid函数的典型用法代码示例。如果您正苦于以下问题:PHP ossim_valid函数的具体用法?PHP ossim_valid怎么用?PHP ossim_valid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: validate_post_params

function validate_post_params($conn, $name, $descr, $sids, $imported_sids)
{
    $vals = array('name' => array(OSS_INPUT, 'illegal:' . _("Name")), 'descr' => array(OSS_TEXT, OSS_NULLABLE, 'illegal:' . _("Description")));
    ossim_valid($name, $vals['name']);
    ossim_valid($descr, $vals['descr']);
    $plugins = array();
    $sids = is_array($sids) ? $sids : array();
    if (intval(POST('pluginid')) > 0) {
        $sids[POST('pluginid')] = "0";
    }
    foreach ($sids as $plugin => $sids_str) {
        if ($sids_str !== '') {
            list($valid, $data) = Plugin_sid::validate_sids_str($sids_str);
            if (!$valid) {
                ossim_set_error(_("Error for data source ") . $plugin . ': ' . $data);
                break;
            }
            if ($sids_str == "ANY") {
                $sids_str = "0";
            } else {
                $aux = count(explode(',', $sids_str));
                $total = Plugin_sid::get_sidscount_by_id($conn, $plugin);
                $sids_str = $aux == $total ? "0" : $sids_str;
            }
            $plugins[$plugin] = $sids_str;
        }
    }
    if (!count($plugins) && !count($imported_sids)) {
        ossim_set_error(_("No Data Sources or Event Types selected"));
    }
    if (ossim_error()) {
        die(ossim_error());
    }
    return array($name, $descr, $plugins);
}
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:35,代码来源:modifyplugingroups.php

示例2: delete_nfsen_source

function delete_nfsen_source($data)
{
    if (!Session::am_i_admin()) {
        $return['error'] = TRUE;
        $return['msg'] = _('Action not authorized');
        return $return;
    }
    require_once '../sensor/nfsen_functions.php';
    $sensor = $data['sensor'];
    ossim_valid($sensor, OSS_ALPHA, 'illegal:' . _('Nfsen Source'));
    if (ossim_error()) {
        $info_error = _('Error') . ': ' . ossim_get_error();
        ossim_clean_error();
        $return['error'] = TRUE;
        $return['msg'] = $info_error;
        return $return;
    }
    $res = delete_nfsen($sensor);
    if ($res['status'] == 'success') {
        $return['error'] = FALSE;
        $return['msg'] = _('Source deleted successfully');
        //To forcer load variables in session again
        unset($_SESSION['tab']);
    } else {
        $return['error'] = TRUE;
        $return['msg'] = $res['data'];
    }
    return $return;
}
开发者ID:jackpf,项目名称:ossim-arc,代码行数:29,代码来源:nfsen_ajax.php

示例3: server_get_servers

function server_get_servers($conn)
{
    $name = GET('name');
    ossim_valid($name, OSS_ALPHA, OSS_PUNC, OSS_SPACE, 'illegal:' . _("Server name"));
    require_once 'ossim_conf.inc';
    $ossim_conf = $GLOBALS["CONF"];
    /* get the port and IP address of the server */
    $address = $ossim_conf->get_conf("server_address");
    $port = $ossim_conf->get_conf("server_port");
    /* create socket */
    $socket = socket_create(AF_INET, SOCK_STREAM, 0);
    if ($socket < 0) {
        echo _("socket_create() failed: reason: ") . socket_strerror($socket) . "\n";
    }
    $list = array();
    $err = "";
    /* connect */
    $result = @socket_connect($socket, $address, $port);
    if (!$result) {
        $err = "<p><b>" . _("socket error") . "</b>: " . gettext("Is OSSIM server running at") . " {$address}:{$port}?</p>";
        return array($list, $err);
    }
    /* first send a connect message to server */
    $in = 'connect id="1" type="web"' . "\n";
    $out = '';
    socket_write($socket, $in, strlen($in));
    $out = @socket_read($socket, 2048, PHP_NORMAL_READ);
    if (strncmp($out, "ok id=", 4)) {
        $err = "<p><b>" . gettext("Bad response from server") . "</b></p>";
        $err .= "<p><b>" . _("socket error") . "</b>: " . gettext("Is OSSIM server running at") . " {$address}:{$port}?</p>";
        return array($list, $err);
    }
    /* get servers from server */
    if ($name != NULL) {
        $in = 'server-get-servers id="2" servername="' . $name . '"' . "\n";
    } else {
        $in = 'server-get-servers id="2"' . "\n";
    }
    $out = '';
    socket_write($socket, $in, strlen($in));
    $pattern = '/server host="([^"]*)" servername="([^"]*)"/ ';
    while ($out = socket_read($socket, 2048, PHP_NORMAL_READ)) {
        if (preg_match($pattern, $out, $regs)) {
            if (Session::hostAllowed($conn, $regs[1])) {
                $s["host"] = $regs[1];
                $s["servername"] = $regs[2];
                //# This should be checked in the server TODO FIXME
                if (!in_array($s, $list)) {
                    $list[] = $s;
                }
            }
        } elseif (!strncmp($out, "ok id=", 4)) {
            break;
        }
    }
    socket_close($socket);
    return array($list, $err);
}
开发者ID:jhbsz,项目名称:ossimTest,代码行数:58,代码来源:server_get_servers.php

示例4: activate_account

function activate_account()
{
    $data = POST('data');
    $token = $data['token'];
    ossim_valid($token, OSS_ALPHA, 'illegal:' . _("OTX auth-token"));
    check_ossim_error();
    $otx = new Otx();
    $otx->register_token($token);
    return array('msg' => _("Your OTX account has been connected. The OTX pulses that you have subscribed to will begin downloading shortly. This process may take a few minutes."), 'token' => $token, 'username' => $otx->get_username(), 'user_id' => $otx->get_user_id(), 'contributing' => TRUE, 'key_version' => $otx->get_key_version(), 'latest_update' => $otx->get_latest_update());
}
开发者ID:jackpf,项目名称:ossim-arc,代码行数:10,代码来源:otx_config.php

示例5: retrieve_groups

function retrieve_groups($num)
{
    $g_list = array();
    for ($i = 1; $i <= $num; $i++) {
        $aux = explode("_", GET('group' . $i));
        if (ossim_valid($aux[0], OSS_HEX, 'illegal:' . _("Group ID"))) {
            $g_list[] = "'" . $aux[0] . "'";
        }
    }
    return implode(',', $g_list);
}
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:11,代码来源:alarm_group_response.php

示例6: get_pulse_detail

function get_pulse_detail()
{
    $data = POST('data');
    ossim_valid($data['pulse_id'], OSS_HEX, 'illegal: Pulse ID');
    if (ossim_error()) {
        return array();
    }
    $otx = new Otx();
    $pulse = $otx->get_pulse_detail($data['pulse_id']);
    //Converting indicator hash to array to use it in the datatables.
    $pulse['indicators'] = array_values($pulse['indicators']);
    return $pulse;
}
开发者ID:jackpf,项目名称:ossim-arc,代码行数:13,代码来源:otx_pulse.php

示例7: 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

示例8: modify_plugingroup_plugin

function modify_plugingroup_plugin($conn, $data)
{
    $plugin_group = $data['plugin_group'];
    $plugin_id = $data['plugin_id'];
    $sids_str = $data['plugin_sids'];
    ossim_valid($plugin_id, OSS_DIGIT, 'illegal:' . _("Plugin ID"));
    ossim_valid($plugin_group, OSS_HEX, 'illegal:' . _("Plugin GroupID"));
    if (ossim_error()) {
        $info_error = "Error: " . ossim_get_error();
        ossim_clean_error();
        $return['error'] = true;
        $return['msg'] = $info_error;
        return $return;
    }
    $total_sel = 1;
    if (is_array($sids_str)) {
        $total_sel = count($sids_str);
        $sids_str = implode(',', $sids_str);
    }
    if ($sids_str !== '') {
        list($valid, $data) = Plugin_sid::validate_sids_str($sids_str);
        if (!$valid) {
            $return['error'] = true;
            $return['msg'] = _("Error for data source ") . $plugin_id . ': ' . $data;
            return $return;
        }
        if ($sids_str == "ANY") {
            $sids_str = "0";
        } else {
            $total = Plugin_sid::get_sidscount_by_id($conn, $plugin_id);
            $sids_str = $total_sel == $total ? "0" : $sids_str;
        }
        Plugin_group::edit_plugin($conn, $plugin_group, $plugin_id, $sids_str);
    }
    $return['error'] = false;
    $return['output'] = '';
    return $return;
}
开发者ID:jackpf,项目名称:ossim-arc,代码行数:38,代码来源:plugin_groups_ajax.php

示例9: validate_post_params

function validate_post_params($conn, $name, $descr, $sids, $imported_sids, $group_id = NULL)
{
    $vals = array('name' => array(OSS_INPUT, 'illegal:' . _("Name")), 'descr' => array(OSS_ALL, OSS_NULLABLE, 'illegal:' . _("Description")), 'group_id' => array(OSS_HEX, OSS_NULLABLE, 'illegal:' . _("Group ID")));
    ossim_valid($group_id, $vals['group_id']);
    ossim_valid($name, $vals['name']);
    if (ossim_error() == FALSE && Plugin_group::is_valid_group_name($conn, $name, $group_id) == FALSE) {
        $name = Util::htmlentities($name);
        ossim_set_error(sprintf(_("DS group name '<strong>%s</strong>' already exists"), $name));
    }
    ossim_valid($descr, $vals['descr']);
    $plugins = array();
    $sids = is_array($sids) ? $sids : array();
    $pluginid = intval(POST('pluginid'));
    if ($pluginid > 0) {
        $sids[$pluginid] = "0";
    }
    foreach ($sids as $plugin => $sids_str) {
        if ($sids_str !== '') {
            list($valid, $data) = Plugin_sid::validate_sids_str($sids_str);
            if (!$valid) {
                ossim_set_error(_("Error for data source ") . $plugin . ': ' . $data);
                break;
            }
            if ($sids_str == "ANY") {
                $sids_str = "0";
            } else {
                $aux = count(explode(',', $sids_str));
                $total = Plugin_sid::get_sidscount_by_id($conn, $plugin);
                $sids_str = $aux == $total ? "0" : $sids_str;
            }
            $plugins[$plugin] = $sids_str;
        }
    }
    if (!count($plugins) && !count($imported_sids)) {
        ossim_set_error(_("No Data Sources or Event Types selected"));
    }
    return array($group_id, $name, $descr, $plugins, ossim_error());
}
开发者ID:jackpf,项目名称:ossim-arc,代码行数:38,代码来源:modifyplugingroups.php

示例10: modify_deploy_hosts

function modify_deploy_hosts($wizard, $data)
{
    $os = $data['os'];
    $hosts = $data['hosts'];
    $username = $data['username'];
    $password = $data['password'];
    $domain = $data['domain'];
    ossim_valid($os, "windows|linux", 'illegal:' . _('Deploy Option'));
    ossim_valid($hosts, OSS_HEX, 'illegal:' . _('Host'));
    ossim_valid($username, OSS_USER_2, 'illegal:' . _('Username'));
    ossim_valid($password, OSS_PASSWORD, 'illegal:' . _('Password'));
    ossim_valid($domain, OSS_NOECHARS, OSS_ALPHA, OSS_PUNC_EXT, OSS_NULLABLE, 'illegal:' . _('Domain'));
    if (ossim_error()) {
        $response['error'] = TRUE;
        $response['msg'] = ossim_get_error();
        ossim_clean_error();
        return $response;
    }
    $domain = $os == 'windows' ? $domain : '';
    //Encrypting password to save it in the object
    $pass_c = Util::encrypt($password, Util::get_system_uuid());
    //First we clean the deploy info stored in the object
    $wizard->clean_step_data();
    //Saving the info to achieve the deploy
    $wizard->set_step_data('deploy_os', $os);
    $wizard->set_step_data('deploy_username', $username);
    $wizard->set_step_data('deploy_password', $pass_c);
    $wizard->set_step_data('deploy_domain', $domain);
    $wizard->set_step_data('deploy_hosts', $hosts);
    //Setting the deploy step to 1 (Inicialized)
    $wizard->set_step_data('deploy_step', 1);
    //Saving wizard status
    $wizard->save_status();
    $response['error'] = FALSE;
    return $response;
}
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:36,代码来源:deploy_ajax.php

示例11: GET

*
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
require_once 'av_init.php';
Session::logcheck("configuration-menu", "CorrelationDirectives");
$directive_id = GET('directive_id');
$file = GET('file');
$engine_id = GET('engine_id');
$rule = GET('rule');
$mode = GET('mode');
ossim_valid($directive_id, OSS_DIGIT, 'illegal:' . _("Directive ID"));
ossim_valid($file, OSS_ALPHA, OSS_DOT, OSS_SCORE, 'illegal:' . _("XML File"));
ossim_valid($engine_id, OSS_HEX, OSS_SCORE, 'illegal:' . _("Engine ID"));
ossim_valid($rule, OSS_DIGIT, '\\-', OSS_NULLABLE, 'illegal:' . _("Rule ID"));
ossim_valid($mode, OSS_ALPHA, OSS_NULLABLE, 'illegal:' . _("Mode"));
if (ossim_error()) {
    die(ossim_error());
}
$directive_editor = new Directive_editor($engine_id);
$filepath = file_exists($directive_editor->engine_path . "/" . $file) ? $directive_editor->engine_path . "/" . $file : $directive_editor->main_path . "/" . $file;
if (preg_match("/^\\d+-\\d+-\\d+\$/", $rule)) {
    if (GET('mode') == "delete") {
        $dom = $directive_editor->get_xml($filepath, "DOMXML");
        $direct = $directive_editor->getDirectiveFromXML($dom, $directive_id);
        $tab_rules = $direct->rules;
        $directive_editor->delrule($rule, &$tab_rules);
        if (!$directive_editor->save_xml($filepath, $dom, "DOMXML")) {
            echo "<!-- ERRORDELETE -->";
        }
    } elseif (GET('mode') == "copy") {
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:get_rules.php

示例12: GET

*   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
****************************************************************************/
/**
* Class and Function List:
* Function list:
* Classes list:
*/
include "classes/Security.inc";
$param = GET('param');
ossim_valid($plugin_id, OSS_ALPHA, OSS_NULLABLE);
if (ossim_error()) {
    die(ossim_error());
}
?>
		
    <div style="
      background-color:#17457c;
      width:100%;
      position:fixed;
      height:2px;
      left:0px;"></div>
		<center>
			<button style="width: 80px; margin-top:8px; cursor:pointer;"
				id="cancel"
				onclick="cancel()"
开发者ID:jhbsz,项目名称:ossimTest,代码行数:31,代码来源:bottom.php

示例13: ossim_db

*
*/
require_once 'av_init.php';
Session::logcheck('configuration-menu', 'PolicyServers');
$db = new ossim_db();
$conn = $db->connect();
$id = GET('id');
$ip = GET('ip');
$sname = GET('name');
$update = intval(GET('update'));
$opensource = Session::is_pro() ? FALSE : TRUE;
$mssp = intval($conf->get_conf("alienvault_mssp"));
$local_id = $conf->get_conf("server_id");
ossim_valid($ip, OSS_IP_ADDR, OSS_NULLABLE, 'illegal:' . _('Server IP'));
ossim_valid($sname, OSS_ALPHA, OSS_PUNC, OSS_NULLABLE, 'illegal:' . _('Server Name'));
ossim_valid($id, OSS_HEX, OSS_NULLABLE, 'illegal:' . _('Server ID'));
if (ossim_error()) {
    die(ossim_error());
}
$action = 'newserver.php';
$all_rservers = Server::get_server_hierarchy($conn, $id);
$error_forward = FALSE;
$can_i_modify_elem = TRUE;
if (!empty($id)) {
    $server = Server::get_object($conn, $id);
    $role_list = Role::get_list($conn, $id);
    if (!empty($server) && !empty($role_list)) {
        $role = $role_list[0];
        $sname = $server->get_name();
        $ip = $server->get_ip();
        $port = $server->get_port();
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:newserverform.php

示例14: foreach

        $AllPlugins = "";
        $NonDOS = "";
        $DisableAll = "";
        $saveplugins = "";
        break;
    case "POST":
        foreach ($postParams as $pp) {
            if (isset($_POST[$pp])) {
                ${$pp} = Util::htmlentities(mysql_real_escape_string(trim($_POST[$pp])), ENT_QUOTES);
            } else {
                ${$pp} = "";
            }
        }
        break;
}
ossim_valid($sid, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("Sid"));
if (ossim_error()) {
    die(_("Invalid Parameter Sid"));
}
if (isset($_POST['authorized_users'])) {
    foreach ($_POST['authorized_users'] as $user) {
        $users[] = Util::htmlentities(mysql_real_escape_string(trim($user)), ENT_QUOTES);
    }
}
//if (!($uroles['profile'] || $uroles['admin'])) {
//   echo "Access Denied!!!<br>";
//   logAccess( $username . " : " . $_SERVER['SCRIPT_NAME'] . " : Unauthorized Access" );
//   //require_once('footer.php');
//   die();
//}
$db = new ossim_db();
开发者ID:jhbsz,项目名称:ossimTest,代码行数:31,代码来源:settings.php

示例15: array

* 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::logcheck('environment-menu', 'PolicyHosts');
//CPE Types
$_cpe_types = array('os' => 'o', 'hardware' => 'h', 'software' => 'a');
$_cpe = GET('q');
$_cpe_type = GET('cpe_type');
ossim_valid($_cpe, OSS_NULLABLE, OSS_ALPHA, OSS_PUNC_EXT, 'illegal:' . _('CPE'));
ossim_valid($_cpe_type, 'os | software | hardware', 'illegal:' . _('CPE Type'));
if (ossim_error() || !array_key_exists($_cpe_type, $_cpe_types)) {
    exit;
}
$db = new Ossim_db();
$conn = $db->connect();
$_cpe = escape_sql($_cpe, $conn);
$filters = array('where' => "`cpe` LIKE 'cpe:/" . $_cpe_types[$_cpe_type] . "%' AND `line` LIKE '%{$_cpe}%'", 'limit' => 20);
$software = new Software($conn, $filters);
$db->close();
foreach ($software->get_software() as $cpe_info) {
    echo $cpe_info['cpe'] . '###' . $cpe_info['line'] . "\n";
}
/* End of file search_cpe.php */
开发者ID:jackpf,项目名称:ossim-arc,代码行数:31,代码来源:search_cpe.php


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