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


PHP Host::get_ips_and_hostname方法代码示例

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


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

示例1: ob_implicit_flush

ob_implicit_flush();
require_once 'classes/Session.inc';
Session::logcheck("MenuPolicy", "5DSearch");
require_once 'classes/Host.inc';
require_once 'classes/Host_os.inc';
require_once 'classes/Net.inc';
require_once 'classes/Host_scan.inc';
require_once 'classes/Plugin.inc';
require_once 'ossim_db.inc';
require_once 'ossim_conf.inc';
include "functions.php";
// Database Object
$db = new ossim_db();
$conn = $db->connect();
$sensors = $hosts = $ossim_servers = array();
list($sensors, $hosts) = Host::get_ips_and_hostname($conn);
$allowed_hosts_aux = Host::get_list($conn);
// Allowed internal hosts
$allowed_hosts = array();
// Load allowed hosts and all internal hosts to check perms and do not use hostAllowed -> Improve speed!
foreach ($allowed_hosts_aux as $h) {
    $allowed_hosts[$h->get_ip()]++;
}
$networks = "";
$hosts_ips = array_keys($hosts);
$operator = GET('operator');
$descr = GET('description');
$num = GET('num');
$descr = mb_detect_encoding($descr . " ", 'UTF-8,ISO-8859-1') == 'UTF-8' ? $descr : mb_convert_encoding($descr, 'UTF-8', 'ISO-8859-1');
$descr = Util::utf8entities($descr);
$current_profile = !empty($_GET['profile']) ? $_GET['profile'] : $_SESSION['profile'];
开发者ID:jhbsz,项目名称:ossimTest,代码行数:31,代码来源:build_search.php

示例2: GET

$dst_ip = GET('dst_ip');
$backup_inf = $inf = GET('inf');
$sup = GET('sup');
$hide_closed = GET('hide_closed');
$no_resolv = intval(GET('no_resolv'));
$refresh_time = GET('refresh_time');
$autorefresh = GET('autorefresh');
$query = GET('query') != "" ? GET('query') : "";
$directive_id = GET('directive_id');
$sensor_query = GET('sensor_query');
$tag = GET('tag');
$num_events = GET('num_events');
$num_events_op = GET('num_events_op');
$params_string = "order={$order}&src_ip={$src_ip}&dst_ip={$dst_ip}&inf={$inf}&sup={$sup}&hide_closed={$hide_closed}&query={$query}&directive_id={$directive_id}&date_from={$date_from}&date_to={$date_to}&no_resolv={$no_resolv}&sensor_query={$sensor_query}&tag={$tag}";
$sensors = $hosts = $ossim_servers = array();
list($sensors, $hosts, $icons) = Host::get_ips_and_hostname($conn, true);
/*$networks = "";
$_nets = Net::get_all($conn);
$_nets_ips = $_host_ips = $_host = array();
foreach ($_nets as $_net) $_nets_ips[] = $_net->get_ips();
$networks = implode(",",$_nets_ips);*/
$hosts_ips = array_keys($hosts);
$tags = Tags::get_list($conn);
$tags_html = Tags::get_list_html($conn);
$date_from = GET('date_from');
$date_to = GET('date_to');
$num_alarms_page = GET('num_alarms_page');
$param_unique_id = GET('unique_id');
ossim_valid($order, OSS_ALPHA, OSS_SPACE, OSS_SCORE, OSS_NULLABLE, '.', 'illegal:' . _("order"));
ossim_valid($delete, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("delete"));
ossim_valid($close, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("close"));
开发者ID:jhbsz,项目名称:ossimTest,代码行数:31,代码来源:alarm_console.php

示例3: DisplayProcessing


//.........这里部分代码省略.........
        $cmd_opts['profile'] = $_SESSION['profileswitch'];
        $cmd_opts['srcselector'] = implode(':', $process_form['srcselector']);
        print "<pre>\n";
        $pattern = '/(\\s*)([^\\s]+)/';
        $replacement = "\$1<a href='#null' onClick='lookup(\"\$2\", this, event)' title='lookup \$2'>\$2</a>";
        ClearMessages();
        $cmd_opts['args'] = "-T {$run}";
        $cmd_opts['filter'] = $filter;
        $titcol = "";
        if (preg_match("/ srcip/", $run)) {
            $titcol = _("Src IP");
        } elseif (preg_match("/ dstip/", $run)) {
            $titcol = _("Dst IP");
        } elseif (preg_match("/ srcport/", $run)) {
            $titcol = _("Src Port");
        } elseif (preg_match("/ dstport/", $run)) {
            $titcol = _("Dst Port");
        }
        $cmd_out = nfsend_query("run-nfdump", $cmd_opts);
        if (!is_array($cmd_out)) {
            ShowMessages();
        } else {
            require_once "classes/Host.inc";
            require_once "classes/Net.inc";
            require_once 'ossim_db.inc';
            require_once "ossim_conf.inc";
            $conf = $GLOBALS["CONF"];
            $solera = $conf->get_conf("solera_enable", FALSE) ? true : false;
            include "geoip.inc";
            $gi = geoip_open("/usr/share/geoip/GeoIP.dat", GEOIP_STANDARD);
            $db = new ossim_db();
            $conn = $db->connect();
            $sensors = $hosts = $ossim_servers = array();
            list($sensors, $hosts, $icons) = Host::get_ips_and_hostname($conn);
            /*$networks = "";
              $_nets = Net::get_all($conn);
              $_nets_ips = $_host_ips = $_host = array();
              foreach ($_nets as $_net) $_nets_ips[] = $_net->get_ips();
              $networks = implode(",",$_nets_ips);*/
            $hosts_ips = array_keys($hosts);
            /*
            				if ( array_key_exists('arg', $cmd_out) ) {
            					print "** nfdump " . $cmd_out['arg'] . "\n";
            				}
            				if ( array_key_exists('filter', $cmd_out) ) {
            					print "nfdump filter:\n";
            					foreach ( $cmd_out['filter'] as $line ) {
            						print "$line\n";
            					}
            				}
            				foreach ( $cmd_out['nfdump'] as $line ) {
            					print preg_replace($pattern, $replacement, $line) . "\n";
            				}
            				print "</pre>\n";*/
            # parse command line
            #2009-12-09 17:08:17.596    40.262 TCP        192.168.1.9:80    ->   217.126.167.80:51694 .AP.SF   0       70   180978        1    35960   2585     1
            $list = preg_match("/ \\-a  \\-A /", $cmd_out['arg']) ? 1 : 0;
            $regex = $list ? "/(\\d\\d\\d\\d\\-.*?\\s.*?)\\s+(.*?)\\s+(.*?)\\s+(.*?)\\s+->\\s+(.*?)\\s+(.*?)\\s+(.*?)\\s+(.*?)\\s+(.*?\\s*[KMG]?)\\s+(.*?)\\s+(.*?)\\s+(.*?)\\s+(.*)/" : "/(\\d\\d\\d\\d\\-.*?\\s.*?)\\s+(.*?)\\s+(.*?)\\s+(.*?)\\s+(.*?)\\s+(.*?)\\s+(.*?\\s*[KMGT]?)\\s+(.*?)\\s+(.*?)\\s+(.*)/";
            echo "<table style='width:100%;margin-bottom:5px''>";
            $geotools = false;
            if ($list && file_exists("../kml/GoogleEarth.php")) {
                $geotools = true;
                $geoips = array();
                echo "<tr><td class='nobborder'></td><td class='nobborder'></td><td class='nobborder'></td>";
                echo "<td class='center nobborder'>Geo Tools: <a href='' onclick='window.open(\"../kml/TourConfig.php?type=ip_src&ip=&flows=1\",\"Flows sources - Goggle Earth API\",\"width=1024,height=700,scrollbars=NO,toolbar=1\");return false'><img align='absmiddle' src='../pixmaps/google_earth_icon.png' border='0'></a>&nbsp;&nbsp;<a href='' onclick='window.open(\"../kml/IPGoogleMap.php?type=ip_src&ip=&flows=1\",\"Flows sources - Goggle Maps API\",\"width=1024,height=700,scrollbars=NO,toolbar=1\");return false'><img align='absmiddle' src='../pixmaps/google_maps_icon.png' border='0'></a></td>";
                echo "<td class='center nobborder'>Geo Tools: <a href='' onclick='window.open(\"../kml/TourConfig.php?type=ip_dst&ip=&flows=1\",\"Flows destinations - Goggle Earth API\",\"width=1024,height=700,scrollbars=NO,toolbar=1\");return false'><img align='absmiddle' src='../pixmaps/google_earth_icon.png' border='0'></a>&nbsp;&nbsp;<a href='' onclick='window.open(\"../kml/IPGoogleMap.php?type=ip_dst&ip=&flows=1\",\"Flows destinations - Goggle Maps API\",\"width=1024,height=700,scrollbars=NO,toolbar=1\");return false'><img align='absmiddle' src='../pixmaps/google_maps_icon.png' border='0'></a></td>";
开发者ID:jhbsz,项目名称:ossimTest,代码行数:67,代码来源:details.php

示例4: GET

require_once 'classes/User_config.inc';
require_once 'ossim_db.inc';
require_once 'ossim_conf.inc';
include "functions.php";
$new = GET('new') == "1" ? 1 : 0;
$ip = GET('ip');
ossim_valid($ip, OSS_IP_ADDR, OSS_NULLABLE, 'illegal:' . _("ip"));
if (ossim_error()) {
    die(ossim_error());
}
// Database Object
$db = new ossim_db();
$conn = $db->connect();
$net_search = Net::GetClosestNet($conn, $ip, 1);
// Get Networks
list($_sensors, $_hosts) = Host::get_ips_and_hostname($conn, true);
$_nets = Net::get_all($conn, true);
$networks = $hosts = "";
foreach ($_nets as $_net) {
    $networks .= '{ txt:"' . $_net->get_name() . ' [' . $_net->get_ips() . ']", id: "' . $_net->get_ips() . '" },';
}
foreach ($_hosts as $_ip => $_hostname) {
    if ($_hostname != $_ip) {
        $hosts .= '{ txt:"' . $_ip . ' [' . $_hostname . ']", id: "' . $_ip . '" },';
    } else {
        $hosts .= '{ txt:"' . $_ip . '", id: "' . $_ip . '" },';
    }
}
// Get Services and OS
$inventory = "";
$query = "(SELECT DISTINCT os as element FROM host_os ORDER BY os) UNION (SELECT DISTINCT service as element FROM host_services ORDER BY service)";
开发者ID:jhbsz,项目名称:ossimTest,代码行数:31,代码来源:userfriendly.php

示例5: print_indicators

function print_indicators($map, $print_inputs = false, $linked = 1)
{
    require_once 'classes/Host.inc';
    require_once 'classes/Net.inc';
    require_once 'ossim_db.inc';
    $db = new ossim_db();
    $conn = $db->connect();
    list($sensors_aux, $hosts_aux) = Host::get_ips_and_hostname($conn, true);
    $all_nets = Net::get_list($conn);
    $hosts = array_flip($hosts_aux);
    $sensors = array_flip($sensors_aux);
    $nets = array();
    foreach ($all_nets as $k => $v) {
        $nets[$v->get_name()] = $v->get_name();
    }
    $query = "SELECT * FROM risk_indicators WHERE name <> 'rect' AND map= ?";
    $params = array($map);
    if (!($rs =& $conn->Execute($query, $params))) {
        print $conn->ErrorMsg();
    } else {
        while (!$rs->EOF) {
            if (Session::am_i_admin()) {
                $has_perm = 1;
            } else {
                $has_perm = indicatorAllowed($conn, $rs->fields['type'], $rs->fields['type_name'], $hosts, $sensors, $nets);
            }
            if ($has_perm) {
                $id = $rs->fields["id"];
                if ($print_inputs) {
                    $name = mb_detect_encoding($rs->fields["name"] . " ", 'UTF-8,ISO-8859-1') == 'UTF-8' ? $rs->fields["name"] : mb_convert_encoding($rs->fields["name"], 'UTF-8', 'ISO-8859-1');
                    $type = $rs->fields["type"];
                    $type_name = mb_detect_encoding($rs->fields["type_name"] . " ", 'UTF-8,ISO-8859-1') == 'UTF-8' ? $rs->fields["type_name"] : mb_convert_encoding($rs->fields["type_name"], 'UTF-8', 'ISO-8859-1');
                    $url = $rs->fields["url"];
                    $size = $rs->fields["size"];
                    $icon = preg_replace("/\\#.*/", "", $rs->fields["icon"]);
                    $val = preg_match("/\\#(.+)/", $rs->fields["icon"], $found) ? $found[1] : "";
                    echo "<input type='hidden' name='dataname" . $id . "'     id='dataname" . $id . "'     value='" . $name . "'/>\n";
                    echo "<input type='hidden' name='datatype" . $id . "'     id='datatype" . $id . "'     value='" . $type . "'/>\n";
                    echo "<input type='hidden' name='type_name" . $id . "'    id='type_name" . $id . "'    value='" . $type_name . "'/>\n";
                    echo "<input type='hidden' name='dataurl" . $id . "'     id='dataurl" . $id . "'      value='" . $url . "'/>\n";
                    echo "<input type='hidden' name='dataicon" . $id . "'     id='dataicon" . $id . "'     value='" . $icon . "'/>\n";
                    echo "<input type='hidden' name='dataiconsize" . $id . "' id='dataiconsize" . $id . "' value='" . $size . "'/>\n";
                    echo "<input type='hidden' name='dataiconbg" . $id . "'   id='dataiconbg" . $id . "'   value='" . $val . "'/>\n";
                }
                $style = "z-index:10;\r\n\t\t\t\t\t\t  border:1px solid transparent;\r\n\t\t\t\t\t\t  cursor:pointer;\r\n\t\t\t\t\t\t  background:url(../pixmaps/1x1.png);\r\n\t\t\t\t\t\t  visibility:hidden;\r\n\t\t\t\t\t\t  position:absolute;\r\n\t\t\t\t\t\t  left:" . $rs->fields["x"] . "px;\r\n\t\t\t\t\t\t  top:" . $rs->fields["y"] . "px;\r\n\t\t\t\t\t\t  height:" . $rs->fields["h"] . "px;\r\n\t\t\t\t\t\t  width:" . $rs->fields["w"] . "px;\r\n\t\t\t\t";
                ?>
				<div id="indicator<?php 
                echo $id;
                ?>
" class="itcanbemoved" style="<?php 
                echo $style;
                ?>
">
					<?php 
                print_indicator_content($conn, $rs, $linked);
                ?>
				</div>
				<?php 
            }
            $rs->MoveNext();
        }
    }
    $query = "SELECT * FROM risk_indicators WHERE name='rect' AND map = ?";
    $params = array($map);
    if (!($rs =& $conn->Execute($query, $params))) {
        print $conn->ErrorMsg();
    } else {
        while (!$rs->EOF) {
            $has_perm = 0;
            if (Session::am_i_admin()) {
                $has_perm = 1;
            } else {
                if ($type == "host") {
                    $has_perm = !empty($hosts[$type_name]) ? 1 : 0;
                } elseif ($type == "sensor" || $type == "server") {
                    $has_perm = !empty($sensors[$type_name]) ? 1 : 0;
                } elseif ($type == "net") {
                    $has_perm = !empty($nets[$type_name]) ? 1 : 0;
                } elseif ($type == "host_group") {
                    if (Session::groupHostAllowed($conn, $type_name)) {
                        $has_perm = 1;
                    }
                } else {
                    $has_perm = 1;
                }
            }
            if ($has_perm) {
                $id = $rs->fields["id"];
                if ($print_inputs) {
                    $name = $rs->fields["name"];
                    $url = $rs->fields["url"];
                    echo "<input type='hidden' name='dataname" . $id . "' id='dataname" . $id . "' value='" . $name . "'/>\n";
                    echo "<input type='hidden' name='dataurl" . $id . "' id='dataurl" . $id . "' value='" . $url . "'/>\n";
                }
                $style = "border:1px solid transparent;\r\n\t\t\t\t\t\t  cursor:pointer;\r\n\t\t\t\t\t\t  background:url(../pixmaps/1x1.png);\r\n\t\t\t\t\t\t  visibility:hidden;\r\n\t\t\t\t\t\t  position:absolute;\r\n\t\t\t\t\t\t  left:" . $rs->fields["x"] . "px;\r\n\t\t\t\t\t\t  top:" . $rs->fields["y"] . "px;\r\n\t\t\t\t\t\t  height:" . $rs->fields["h"] . "px;\r\n\t\t\t\t\t\t  width:" . $rs->fields["w"] . "px;\r\n\t\t\t\t";
                ?>
				
				<div id="rect<?php 
                echo $id;
                ?>
//.........这里部分代码省略.........
开发者ID:jhbsz,项目名称:ossimTest,代码行数:101,代码来源:riskmaps_functions.php


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