當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Asset_host::is_ip_in_nets方法代碼示例

本文整理匯總了PHP中Asset_host::is_ip_in_nets方法的典型用法代碼示例。如果您正苦於以下問題:PHP Asset_host::is_ip_in_nets方法的具體用法?PHP Asset_host::is_ip_in_nets怎麽用?PHP Asset_host::is_ip_in_nets使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Asset_host的用法示例。


在下文中一共展示了Asset_host::is_ip_in_nets方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: host_get_network_data

function host_get_network_data($ip, $groups, $networks)
{
    // search in groups
    $groups_belong['groups'] = array();
    $groups_belong['nets'] = array();
    foreach ($groups as $group_name => $g_data) {
        foreach ($g_data['nets'] as $net_name => $n_data) {
            $address = $n_data['address'];
            if (!strpos($address, "/")) {
                // tvvcox: i've detected some wrong network addresses, catch them with that
                //echo "<font color='red'>"._("Invalid network address for")." $net_name: $address</font><br>";
                continue;
            }
            if (Asset_host::is_ip_in_nets($ip, $address)) {
                if (!$n_data['has_perms'] && !check_sensor_perms($ip, 'host')) {
                    continue;
                }
                $groups_belong['groups'][$group_name]++;
                $groups_belong['nets'][$net_name] = $n_data;
            }
        }
    }
    // search in nets
    foreach ($networks as $net_name => $n_data) {
        $address = $n_data['address'];
        if ($address != "" && Asset_host::is_ip_in_nets($ip, $address)) {
            if (!$n_data['has_perms'] && !check_sensor_perms($ip, 'host')) {
                continue;
            }
            $groups_belong['nets'][$net_name] = $n_data;
        }
    }
    return $groups_belong;
}
開發者ID:AntBean,項目名稱:alienvault-ossim,代碼行數:34,代碼來源:global_score_functions.php

示例2: foreach

    <?php 
/*
 * Hosts
 */
/*
 * If click on a net, only show hosts of this net
 */
if (GET('net')) {
    $_net_aux = Asset_net::get_object($conn, $net_id);
    if (is_object($_net_aux)) {
        $ips = $_net_aux->get_ips();
        print "<h1>{$ips}</h1>";
        if ($ip_list = Asset_host_qualification::get_list($conn)) {
            foreach ($ip_list as $host_qualification) {
                if (Asset_host::is_ip_in_nets($host_qualification->get_host_ip(), $ips)) {
                    $ip_stats[] = new Asset_host_qualification($host_qualification->get_host_ip(), $host_qualification->get_compromise(), $host_qualification->get_attack());
                }
            }
        }
    }
} else {
    $ip_stats = Asset_host_qualification::get_list($conn, '', 'ORDER BY compromise + attack DESC');
}
//if (count($ip_stats) > 0) {
$max_level = max(Ossim_db::max_val($conn, 'compromise', 'host_qualification'), Ossim_db::max_val($conn, 'attack', 'host_qualification'));
?>

    <tr><td colspan="3"><br/></td></tr>
    <tr>
        <th align="center" colspan="3">
開發者ID:AntBean,項目名稱:alienvault-ossim,代碼行數:30,代碼來源:index.php


注:本文中的Asset_host::is_ip_in_nets方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。