本文整理汇总了PHP中Host::hostname2ip方法的典型用法代码示例。如果您正苦于以下问题:PHP Host::hostname2ip方法的具体用法?PHP Host::hostname2ip怎么用?PHP Host::hostname2ip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Host
的用法示例。
在下文中一共展示了Host::hostname2ip方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
$session_data = $_SESSION;
foreach ($_SESSION as $k => $v) {
if (preg_match("/^(_|alarms_|back_list|current_cview|views|ports_cache|acid_|report_|graph_radar|siem_event|deletetask|mdspw).*/", $k)) {
unset($session_data[$k]);
}
}
$_SESSION['views']['default']['data'] = $session_data;
$config->set($login, 'custom_views', $_SESSION['views'], 'php', 'siem');
}
if ($_GET["search_str"] == "search term") {
unset($_GET["search_str"]);
}
// resolv host2ip if needed
if ($_GET["search_str"] != "" && preg_match("/.*IP/", $_GET["submit"]) && !preg_match("/\\d+\\.\\d+(\\.\\d+\\.\\d+)?/", $_GET["search_str"])) {
include_once "classes/Host.inc";
$_GET["search_str"] = Host::hostname2ip($conn_aux, $_GET["search_str"], true);
}
$db_aux->close($conn_aux);
if ($_SESSION['view_name_changed']) {
$_GET['custom_view'] = $_SESSION['view_name_changed'];
$_SESSION['view_name_changed'] = "";
$_SESSION['norefresh'] = 1;
} else {
$_SESSION['norefresh'] = "";
}
$custom_view = $_GET['custom_view'];
if ($custom_view != "") {
$_SESSION['current_cview'] = $custom_view;
if (is_array($_SESSION['views'][$custom_view]['data'])) {
foreach ($_SESSION['views'][$custom_view]['data'] as $skey => $sval) {
if (!preg_match("/^(_|alarms_|back_list|current_cview|views|ports_cache|acid_|report_|graph_radar|siem_event|deletetask|mdspw).*/", $skey)) {
示例2: explode
$assets_aux = !empty($assets) ? explode(" ", trim($assets)) : array();
$assets = null;
$db = new ossim_db();
$conn = $db->connect();
foreach ($assets_aux as $k => $v) {
$aux = null;
if (!preg_match('/,/', $v)) {
$aux = array($v);
} else {
$aux = explode(",", $v);
}
foreach ($aux as $i => $j) {
$j = trim($j);
ossim_valid($j, OSS_IP_ADDRCIDR, 'illegal:' . _("Assets"));
if (ossim_error()) {
$ip_cidr = Host::hostname2ip($conn, $j);
$ip_cidr = empty($ip_cidr) ? Net::get_ips_by_name($conn, $j) : $ip_cidr . "/32";
if (empty($ip_cidr)) {
$info_error[] = ossim_get_error();
$error = true;
break;
} else {
$aux[$i] = $ip_cidr;
}
} else {
if (!preg_match('/\\//', $j)) {
$aux[$i] = $j . "/32";
}
}
ossim_clean_error();
}
示例3: elseif
} elseif ($date_from == date('Y-m-d', strtotime("-1 year")) && $date_to == date('Y-m-d', time())) {
$type_active = 'lastYear';
} else {
$type_active = 'null';
}
require_once 'ossim_db.inc';
require_once 'ossim_conf.inc';
// Database Object
$db = new ossim_db();
$conn = $db->connect();
$conn_snort = $db->snort_connect();
if ($host == $hostname && preg_match('/^(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)$/', $host)) {
$hostname = Host::ip2hostname($conn, $host);
}
if ($host == "" && $hostname != "") {
$host = Host::hostname2ip($conn, $hostname);
}
if ($host == "" && GET('netname') != "") {
$aux_list = Net::get_list($conn, "name='" . GET('netname') . "'");
$host = preg_replace("/,.*/", "", $aux_list[0]->get_ips());
}
$hostname = "Host";
$_SESSION['host_report'] = $host;
$network = 0;
if (preg_match("/\\/\\d+/", $host)) {
$network = 1;
}
if ($network) {
require_once 'classes/Net.inc';
require_once 'classes/Net_scan.inc';
$netaux = Net::get_list($conn, "name='" . Net::get_name_by_ip($conn, $host) . "'");
示例4: ossim_get_error
$info_error[] = ossim_get_error();
ossim_clean_error();
$error = true;
}
// destinations
if ($dst != "") {
$all_destinations = explode("\n", $dst);
$tdestinations = array();
// sources for tshark
foreach ($all_destinations as $destination) {
$destination = trim($destination);
$destination_type = null;
if (ossim_error() == false) {
if (!preg_match("/\\//", $destination)) {
if (!preg_match('/^(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)$/', $destination)) {
$destination = Host::hostname2ip($dbconn, $destination, true);
}
// resolve to ip
ossim_valid($destination, OSS_IP_ADDR, 'illegal:' . _("Destination ip"));
$destination_type = 'host';
} else {
ossim_valid($destination, OSS_IP_CIDR, 'illegal:' . _("Destination cidr"));
$destination_type = 'net';
}
}
if (ossim_error()) {
$info_error[] = ossim_get_error();
ossim_clean_error();
$error = true;
} else {
if ($destination_type == 'host') {