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


PHP Av_sensor::get_ip_by_id方法代码示例

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


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

示例1: _

                      <th>
                         <strong><?php 
    echo _('Scanner IP');
    ?>
</strong>
                      </th>
                      <th>
                         <strong><?php 
    echo _('Scanner connection');
    ?>
</strong>
                      </th>
                  </tr>
                  <?php 
    foreach ($ctest as $k => $v) {
        $sensor_ip = Av_sensor::get_ip_by_id($conn, $k);
        if ($v == '') {
            echo '<tr><td class="nobborder" style="text-align:center;padding:0px 10px;">' . $sensor_ip . '</td>';
            echo '<td class="nobborder" style="text-align:center;padding:0px 10px;"><img class="vcheck_' . md5($sensor_ip) . '" src="../pixmaps/tick.png" border="0" /></td></tr>';
        } else {
            $nf_type = "nf_error";
            echo "<tr><td class='nobborder sstatus' >" . $sensor_ip . "</td>";
            echo "<td width='300' class='nobborder sstatus' >";
            if (preg_match("/Failed to acquire socket/", $v)) {
                $v = 'Unable to connect to vulnerability scanner. If the system has been updated recently the vulnerability scanner is rebuilding its database. Please wait a few minutes.';
                $nf_type = 'nf_warning';
            }
            $config_nt = array('content' => _($v), 'options' => array('type' => $nf_type, 'cancel_button' => false), 'style' => 'width: 80%; margin: 10px auto; text-align: left;');
            $nt = new Notification('nt_2', $config_nt);
            $nt->show();
            echo '</td></tr>';
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:simulate.php

示例2: draw_html_content

function draw_html_content($conn, $ri_data, $edit_mode = FALSE)
{
    $ri_html = '';
    if ($ri_data['type'] == 'indicator') {
        //Allowed host types
        $host_types = array('host', 'server', 'sensor');
        //Getting indicator values
        if (preg_match("/view\\.php\\?map\\=([a-fA-F0-9]*)/", $ri_data['url'], $found)) {
            // Linked to another map: loop by this map indicators
            list($r_value, $v_value, $a_value, $ri_data['asset_id'], $related_sensor, , $ips, $in_assets) = get_map_values($conn, $found[1], $ri_data['asset_id'], $ri_data['asset_type'], $host_types);
        } else {
            // Asset Values
            list(, $related_sensor, , $ips, $in_assets) = get_assets($conn, $ri_data['asset_id'], $ri_data['asset_type'], $host_types);
            list($r_value, $v_value, $a_value) = get_values($conn, $host_types, $ri_data['asset_type'], $ri_data['asset_id'], FALSE);
        }
        // Getting indacator links
        if ($edit_mode == TRUE) {
            $linked_url = "javascript:void(0);";
            $r_url = "javascript:void(0);";
            $v_url = "javascript:void(0);";
            $a_url = "javascript:void(0);";
        } else {
            // Risk link
            $alarm_query = '';
            if ($ri_data['asset_type'] == 'host') {
                $alarm_query .= "&host_id=" . $ri_data['asset_id'];
            } elseif ($ri_data['asset_type'] == 'net') {
                $alarm_query .= "&net_id=" . $ri_data['asset_id'];
            } elseif ($ri_data['asset_type'] == 'sensor') {
                $alarm_query .= "&sensor_query=" . $ri_data['asset_id'];
            } elseif ($ri_data['asset_type'] == 'host_group' || $ri_data['asset_type'] == 'hostgroup') {
                $alarm_query .= "&asset_group=" . $ri_data['asset_id'];
            }
            $r_url = Menu::get_menu_url("/ossim/alarm/alarm_console.php?hide_closed=1" . $alarm_query, 'analysis', 'alarms', 'alarms');
            // Vulnerability link
            if ($ri_data['asset_type'] == 'host_group' || $ri_data['asset_type'] == 'hostgroup') {
                $v_data = '';
                if (valid_hex32($ri_data['asset_id'])) {
                    $_group_object = Asset_group::get_object($conn, $ri_data['asset_id']);
                    if ($_group_object != NULL) {
                        $_assets_aux = $_group_object->get_hosts($conn, '', array(), TRUE);
                        foreach ($_assets_aux[0] as $_host_data) {
                            if ($v_data != '') {
                                $v_data .= ',';
                            }
                            $v_data .= $_host_data[2];
                            // IP
                        }
                    }
                }
            } else {
                $v_data = $ips;
            }
            $v_url = Menu::get_menu_url("/ossim/vulnmeter/index.php?value={$v_data}&type=hn", 'environment', 'vulnerabilities', 'overview');
            // Availability link
            if (!empty($related_sensor)) {
                $conf = $GLOBALS['CONF'];
                $conf = !$conf ? new Ossim_conf() : $conf;
                $nagios_link = $conf->get_conf('nagios_link');
                $scheme = empty($_SERVER['HTTPS']) ? 'http://' : 'https://';
                $path = !empty($nagios_link) ? $nagios_link : '/nagios3/';
                $port = !empty($_SERVER['SERVER_PORT']) ? ':' . $_SERVER['SERVER_PORT'] : "";
                $nagios_url = $scheme . $related_sensor . $port . $path;
                if ($ri_data['asset_type'] == 'host') {
                    $hostname = Asset_host::get_name_by_id($conn, $ri_data['asset_id']);
                    if (preg_match('/\\,/', $ips)) {
                        $hostname .= '_' . preg_replace('/\\,.*/', '', $ips);
                    }
                    $a_url = Menu::get_menu_url("/ossim/nagios/index.php?sensor={$related_sensor}&nagios_link=" . urlencode($nagios_url . "cgi-bin/status.cgi?host=" . $hostname), 'environment', 'availability');
                } else {
                    $a_url = Menu::get_menu_url("/ossim/nagios/index.php?sensor={$related_sensor}&nagios_link=" . urlencode($nagios_url . "cgi-bin/status.cgi?hostgroup=all"), 'environment', 'availability');
                }
            } else {
                $a_url = 'javascript:void(0);';
            }
            //Report link or map link
            if ($ri_data['url'] == 'REPORT') {
                $linked_url = "javascript:void(0);";
                if ($ri_data['asset_type'] == 'sensor') {
                    try {
                        //Special case 1: Sensors don't have detail view
                        $sensor_ip = Av_sensor::get_ip_by_id($conn, $ri_data['asset_id']);
                        if (Asset_host_ips::valid_ip($sensor_ip)) {
                            $filters = array('where' => "host.id = hi.host_id AND hi.ip = INET6_ATON('{$sensor_ip}')\n                                AND hi.host_id = hs.host_id AND hs.sensor_id = UNHEX('" . $ri_data['asset_id'] . "')");
                            list($hosts, $total) = Asset_host::get_list($conn, ', host_sensor_reference hs, host_ip hi', $filters);
                            if ($total == 1) {
                                $ri_data['asset_id'] = key($hosts);
                                $linked_url = Menu::get_menu_url("/ossim/av_asset/common/views/detail.php?asset_id=" . $ri_data['asset_id'], 'environment', 'assets', 'assets');
                            } elseif ($total > 1) {
                                $linked_url = Menu::get_menu_url("/ossim/av_asset/asset/index.php?filter_id=11&filter_value={$sensor_ip}", 'environment', 'assets', 'assets');
                            }
                        }
                    } catch (Exception $e) {
                    }
                } elseif ($ri_data['asset_type'] == 'net_group' || $ri_data['asset_type'] == 'netgroup') {
                    //Special case 2: Net groups don't have detail view
                    $_sm_option = 'assets';
                    $_h_option = 'network_groups';
                    $linked_url = Menu::get_menu_url("/ossim/netgroup/netgroup_form.php?id=" . $ri_data['asset_id'], 'environment', $_sm_option, $_h_option);
                } else {
//.........这里部分代码省略.........
开发者ID:jackpf,项目名称:ossim-arc,代码行数:101,代码来源:riskmaps_functions.php

示例3: array

         } 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 = '';
             }
         }
     }
     break;
 case 'get_sensor_ip':
     $result = Av_sensor::get_ip_by_id($dbconn, $asset);
     break;
 case 'get_system_uuid':
     $result = Util::get_encryption_key();
     break;
 case 'get_varhex':
     $result = bin2hex(inet_pton($asset));
     break;
 case 'insert_host':
     list($hostip, $ctx, $hostname, $aliases) = explode('|', base64_decode($asset));
     $hostid = key(Asset_host::get_id_by_ips($dbconn, $hostip, $ctx));
     if (!Asset_host::is_in_db($dbconn, $hostid)) {
         list($sensor_list, $total) = Av_sensor::get_list($dbconn, array('where' => "acl_sensors.entity_id=UNHEX('{$ctx}')"));
         $sensors = array_keys($sensor_list);
         try {
             $hostid = Util::uuid();
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:31,代码来源:util.php

示例4: array

         } else {
             $filters = array('where' => 'hostname = "' . $data_1 . '" OR fqdns LIKE "%' . $data_1 . '%"');
             $_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 = '';
             }
         }
     }
     break;
 case 'get_sensor_ip':
     $result = Av_sensor::get_ip_by_id($dbconn, $data_1);
     break;
 case 'update_vuln_jobs_assets':
     $action = $data_1;
     $job_id = $data_2;
     $job_type = $data_3;
     $result = Vulnerabilities::update_vuln_job_assets($dbconn, $action, $job_id, $job_type);
     break;
 case 'get_system_uuid':
     $result = Util::get_encryption_key();
     break;
 case 'get_varhex':
     $result = bin2hex(inet_pton($data_1));
     break;
 case 'insert_host':
     list($hostip, $ctx, $hostname, $aliases) = explode('|', base64_decode($data_1));
开发者ID:jackpf,项目名称:ossim-arc,代码行数:31,代码来源:util.php


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