當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。