本文整理汇总了PHP中Asset_host::get_closest_net方法的典型用法代码示例。如果您正苦于以下问题:PHP Asset_host::get_closest_net方法的具体用法?PHP Asset_host::get_closest_net怎么用?PHP Asset_host::get_closest_net使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Asset_host
的用法示例。
在下文中一共展示了Asset_host::get_closest_net方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array_keys
$sensors = array_keys(Asset_host_sensors::get_sensors_by_id($conn, $host_id));
}
} else {
if (preg_match("/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\/\\d{1,2}?\$/", $ip_cidr)) {
// Net without ID
$total_host += Util::host_in_net($ip_cidr);
$name = $target;
$perm = TRUE;
} else {
if (preg_match("/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\$/", $ip_cidr)) {
// Host without ID
$total_host++;
$name = $target;
$perm = TRUE;
if (count($sensors) == 0) {
$closetnet_id = key(Asset_host::get_closest_net($conn, $ip_cidr));
$sensors = array_keys(Asset_net_sensors::get_sensors_by_id($conn, $closetnet_id));
}
} else {
if ($unresolved) {
// the target is a hostname
$total_host++;
$perm = true;
$name = '-';
if (count($sensors) == 0) {
$sensors = $ids;
}
}
}
}
}
示例2: header
*
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
require_once 'av_init.php';
$m_perms = array('analysis-menu', 'analysis-menu');
$sm_perms = array('EventsForensics', 'ControlPanelAlarms');
Session::logcheck($m_perms, $sm_perms);
list($ip, $ctx) = explode('-', GET('ip'));
ossim_valid($ip, OSS_IP_ADDR_0, 'illegal:' . _('Ip'));
ossim_valid($ctx, OSS_HEX, OSS_NULLABLE, 'illegal:' . _('Ctx'));
// Maybe nullable from Logger resolves
if (ossim_error()) {
die(ossim_error());
}
$db = new ossim_db();
$conn = $db->connect();
$net = array_shift(Asset_host::get_closest_net($conn, $ip, $ctx));
if (is_array($net)) {
if ($net['icon'] != '') {
echo "<img class='asset_icon w16' src='data:image/png;base64," . base64_encode($net['icon']) . "' border='0'/> ";
}
echo '<strong>' . $net['name'] . '</strong> (' . $net['ips'] . ')';
} else {
echo "<b>{$ip}</b> " . _('not found in home networks');
}
$db->close();
示例3: submit_scan
//.........这里部分代码省略.........
// this month
} else {
$next_day = sprintf("%06d%02d", gmdate("Ym", strtotime("next month GMT", gmdate("U"))), $run_mday);
}
}
preg_match("/(\\d{4})(\\d{2})(\\d{2})/", $next_day, $found);
list($b_y, $b_m, $b_d, $b_h, $b_u, $b_s, $b_time) = Util::get_utc_from_date($dbconn, $found[1] . "-" . $found[2] . "-" . $found[3] . " {$btime_hour}:{$btime_min}:00", $tz);
$requested_run = sprintf("%04d%02d%02d%02d%02d%02d", $b_y, $b_m, $b_d, $b_h, $b_u, "00");
break;
case 'NW':
if ($begin_in_seconds > $current_in_seconds) {
// if it is a future date
$array_time = array('month' => $bbimonth, 'day' => $bbiday, 'year' => $bbiyear);
$requested_run = weekday_month(strtolower($daysMap[$nthdayofweek]['text']), $nthweekday, $btime_hour, $btime_min, $array_time);
} else {
$requested_run = weekday_month(strtolower($daysMap[$nthdayofweek]['text']), $nthweekday, $btime_hour, $btime_min);
}
preg_match("/(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})/", $requested_run, $found);
list($b_y, $b_m, $b_d, $b_h, $b_u, $b_s, $b_time) = Util::get_utc_from_date($dbconn, $found[1] . "-" . $found[2] . "-" . $found[3] . " " . $found[4] . ":" . $found[5] . ":00", $tz);
$requested_run = sprintf("%04d%02d%02d%02d%02d%02d", $b_y, $b_m, $b_d, $b_h, $b_u, "00");
$dayofmonth = $nthweekday;
$dayofweek = $nthdayofweek;
break;
default:
break;
}
$insert_time = gmdate('YmdHis');
if (!empty($_SESSION['_vuln_targets']) && count($_SESSION['_vuln_targets']) > 0) {
$arr_ctx = array();
$sgr = array();
foreach ($_SESSION['_vuln_targets'] as $target_selected => $server_id) {
$sgr[$server_id][] = $target_selected;
if (preg_match('/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\/\\d{1,2}$/i', $target_selected)) {
$related_nets = array_values(Asset_net::get_closest_nets($dbconn, $target_selected));
$firs_net = $related_nets[0];
$closetnet_id = $firs_net['id'];
if (valid_hex32($closetnet_id)) {
$arr_ctx[$target_selected] = Asset_net::get_ctx_by_id($dbconn, $closetnet_id);
}
} else {
if (preg_match('/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/i', $target_selected)) {
$closetnet_id = key(Asset_host::get_closest_net($dbconn, $target_selected));
if (valid_hex32($closetnet_id)) {
$arr_ctx[$target_selected] = Asset_net::get_ctx_by_id($dbconn, $closetnet_id);
}
} else {
if (valid_hostname($target_selected) || valid_fqdns($target_selected)) {
$filters = array('where' => "hostname like '{$target_selected}' OR fqdns like '{$target_selected}'");
$_hosts_data = Asset_host::get_basic_list($dbconn, $filters);
$host_list = $_hosts_data[1];
if (count($host_list) > 0) {
$first_host = array_shift($host_list);
$hips = explode(",", $first_host['ips']);
foreach ($hips as $hip) {
$hip = trim($hip);
$arr_ctx[$hip] = $first_host['ctx'];
}
}
}
}
}
}
ossim_clean_error();
unset($_SESSION['_vuln_targets']);
// clean scan targets
$resolve_names = $not_resolve == '1' ? 0 : 1;