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


PHP Asset_host::get_ctx_by_id方法代码示例

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


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

示例1: _

     $data['data'] = _('Your changes have been saved');
     $validation_errors = validate_form_fields('POST', $validate);
     if (is_array($validation_errors) && !empty($validation_errors)) {
         //Formatted message
         $error_msg = '<div>' . _('The following errors occurred') . ":</div>\n                          <div style='padding: 5px;'>" . implode('<br/>', $validation_errors) . '</div>';
         Util::response_bad_request($error_msg);
     } else {
         try {
             $db = new ossim_db();
             $conn = $db->connect();
             $asset_id = POST('asset_id');
             $protocol = POST('s_protocol');
             $protocol_name = Protocol::get_protocol_by_number($protocol);
             $port = POST('s_port');
             $service = POST('s_name');
             $ctx = Asset_host::get_ctx_by_id($conn, $asset_id);
             $n_ports = Port::get_list($conn, " AND port_number = {$port} and protocol_name = '{$protocol_name}'");
             if (count($n_ports) == 0) {
                 Port::insert($conn, $port, $protocol_name, $service, '', $ctx);
             } else {
                 $data['status'] = 'warning';
                 $data['data'] = _('Warning! This port has already been added');
             }
             $db->close();
         } catch (Exception $e) {
             Util::response_bad_request(_('Error! Your changes could not be saved'));
         }
     }
     break;
     //Asset properties, MAC address, Software and Services
 //Asset properties, MAC address, Software and Services
开发者ID:jackpf,项目名称:ossim-arc,代码行数:31,代码来源:asset_actions.php

示例2: ini_set

* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
ini_set('include_path', '/usr/share/ossim/include');
require_once 'av_init.php';
$option = $argv[1];
$asset = $argv[2];
$result = '';
$db = new ossim_db();
$dbconn = $db->connect();
$_SESSION['_user'] = 'admin';
switch ($option) {
    case 'get_ctx':
        if (preg_match("/^([a-f\\d]{32})#\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\$/i", $asset, $found)) {
            // host_id#IP
            $result = Asset_host::get_ctx_by_id($dbconn, $found[1]);
        } else {
            if (preg_match("/^([a-f\\d]{32})#\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\/\\d{1,2}\$/i", $asset, $found)) {
                // net_id#CIDR
                $result = Asset_net::get_ctx_by_id($dbconn, $found[1]);
            } else {
                $filters = array('where' => 'hostname = "' . $asset . '" OR fqdns LIKE "%' . $asset . '%"');
                $_hosts_data = Asset_host::get_basic_list($dbconn, $filters);
                $hosts_list = $_hosts_data[1];
                $total = count($hosts_list);
                if ($total > 0) {
                    $host_id = key($hosts_list);
                    $result = $hosts_list[$host_id]['ctx'];
                } else {
                    $result = '';
                }
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:util.php


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