本文整理汇总了PHP中Host::ip2hostname方法的典型用法代码示例。如果您正苦于以下问题:PHP Host::ip2hostname方法的具体用法?PHP Host::ip2hostname怎么用?PHP Host::ip2hostname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Host
的用法示例。
在下文中一共展示了Host::ip2hostname方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: jgraph_attack_graph
function jgraph_attack_graph($target, $hosts, $type = "Bar3D", $width = 450, $height = 250)
{
global $security_report;
global $datapath;
global $base_dir;
if (!strcmp($target, "ip_src")) {
if (!($fp = @fopen("{$base_dir}/tmp/ip_src.xml", "w"))) {
print "Error: <b>{$datapath}</b> directory must exists and be <br/>\n";
print "writable by the user the webserver runs as";
exit;
}
} else {
if (!($fp = @fopen("{$base_dir}/tmp/ip_dst.xml", "w"))) {
print "Error: <b>{$datapath}</b> directory must exists and be <br/>\n";
print "writable by the user the webserver runs as";
exit;
}
}
fwrite($fp, "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" . "<CategoryDataset>\n <Series name=\"{$target}\">\n");
$list = $security_report->AttackHost($target, $hosts);
foreach ($list as $l) {
$ip = $l[0];
$occurrences = $l[1];
$hostname = Host::ip2hostname($security_report->ossim_conn, $ip);
$os_pixmap = Host_os::get_os_pixmap($security_report->ossim_conn, $ip);
if (strlen($hostname) > MAX_HOSTNAME_LEN) {
$hostname = $ip;
}
fwrite($fp, " <Item>\n <Key>{$hostname}</Key>\n <Value>{$occurrences}</Value>\n </Item>\n");
}
fwrite($fp, " </Series>\n</CategoryDataset>\n\n");
fclose($fp);
echo "\n<applet archive=\"../java/jcommon-0.9.5.jar,../java/jfreechart-0.9.20.jar,../java/jossim-graph.jar\" code=\"net.ossim.graph.applet.OssimGraphApplet\" width=\"{$width}\" height=\"{$height}\" alt=\"You should see an applet, not this text.\">\n <param name=\"graphType\" value=\"{$type}\">";
if (!strcmp($target, "ip_src")) {
echo " <param name=\"xmlDataUrl\" value=\"{$datapath}/ip_src.xml\">";
} else {
echo " <param name=\"xmlDataUrl\" value=\"{$datapath}/ip_dst.xml\">";
}
echo "\n <param name=\"alpha\" value=\"0.42f\">\n <param name=\"legend\" value=\"false\">\n <param name=\"tooltips\" value=\"false\">\n <param name=\"orientation\" value=\"HORIZONTAL\">\n</applet>\n";
}
示例2: ip_max_occurrences
function ip_max_occurrences($target, $date_from, $date_to)
{
global $NUM_HOSTS;
global $security_report;
global $report_type;
/* ossim framework conf */
$conf = $GLOBALS["CONF"];
$acid_link = $conf->get_conf("acid_link");
$ossim_link = $conf->get_conf("ossim_link");
$acid_prefix = $conf->get_conf("event_viewer");
$report_graph_type = $conf->get_conf("report_graph_type");
if (!strcmp($target, "ip_src")) {
if ($report_type == "alarm") {
$target = "src_ip";
}
$title = _("Attacker hosts");
} elseif (!strcmp($target, "ip_dst")) {
if ($report_type == "alarm") {
$target = "dst_ip";
}
$title = _("Attacked hosts");
}
$list = $security_report->AttackHost($security_report->ossim_conn, $target, $NUM_HOSTS, $report_type, $date_from, $date_to);
if (count($list) == 0) {
echo "<table align='center' class='nobborder'><tr><td class='nobborder'>" . _("No data available") . "</td></tr></table></body></html>";
exit(0);
}
?>
<table align="center" width="750" cellpadding="0" cellspacing="0" class="noborder">
<tr><td class="headerpr"><?php
echo _("Top");
echo " {$NUM_HOSTS} {$title}";
?>
</td></tr>
</table>
<table align="center" width="750">
<tr><td style="padding-top:15px;" valign="top" class="nobborder">
<table align="center">
<tr>
<th> <?php
echo gettext("Host");
?>
</th>
<th> <?php
echo gettext("Occurrences");
?>
</th>
</tr>
<?php
foreach ($list as $l) {
$ip = $l[0];
$occurrences = number_format($l[1], 0, ",", ".");
$hostname = Host::ip2hostname($security_report->ossim_conn, $ip);
$os_pixmap = Host_os::get_os_pixmap($security_report->ossim_conn, $ip);
if ($report_type == "alarm") {
if ($target == "src_ip") {
$link = "{$ossim_link}/control_panel/alarm_console.php?src_ip=" . $ip;
} elseif ($target == "dst_ip") {
$link = "{$ossim_link}/control_panel/alarm_console.php?dst_ip=" . $ip;
} else {
$link = "{$ossim_link}/control_panel/alarm_console.php?src_ip=" . $ip . "&dst_ip=" . $ip;
}
} else {
$link = "{$acid_link}/" . $acid_prefix . "_stat_alerts.php?&" . "num_result_rows=-1&" . "submit=Query+DB&" . "current_view=-1&" . "ip_addr[0][1]={$target}&" . "ip_addr[0][2]==&" . "ip_addr[0][3]={$ip}&" . "ip_addr_cnt=1&" . "sort_order=time_d";
}
?>
<tr>
<td><div id="<?php
echo $ip;
?>
;<?php
echo $hostname;
?>
" class="HostReportMenu" style="display:inline">
<a title="<?php
echo $ip;
?>
"
href="<?php
echo $link;
?>
"><?php
echo $hostname;
?>
</a></div>
<?php
echo $os_pixmap;
?>
</td>
<td><?php
echo $occurrences;
?>
</td>
</tr>
<?php
}
?>
</table>
</td>
<td valign="top" class="nobborder">
//.........这里部分代码省略.........
示例3: foreach
echo "ANY";
} else {
echo $port->get_port() . "<br/>";
}
}
}
?>
</td>
<!-- end dest ports -->
<!-- sensors -->
<td>
<?php
if (is_array($sensor_list = $response->get_sensors($conn))) {
foreach ($sensor_list as $sensor) {
echo Host::ip2hostname($conn, $sensor->get_host()) . "<br/>";
}
}
?>
</td>
<!-- end sensors -->
<!-- plugins -->
<td>
<?php
if (is_array($plugin_list = $response->get_plugins($conn))) {
foreach ($plugin_list as $plugin) {
if ($plugin->get_plugin_id() == 0) {
echo "ANY";
} else {
echo $plugin->get_plugin_id() . "<br/>";
示例4: foreach
echo $risk_field;
?>
<!-- sensor -->
<td class="nobborder" style="background-color:<?php
echo $bgcolor;
?>
;text-align:center">
<?php
foreach ($sensors as $sensor) {
?>
<a href="../sensor/sensor_plugins.php?hmenu=Sensors&smenu=Sensors&sensor=<?php
echo $sensor;
?>
"
><?php
echo $no_resolv ? $sensor : Host::ip2hostname($conn, $sensor);
?>
</a>
<?php
}
if (!count($sensors)) {
echo " ";
}
?>
</td>
<!-- end sensor -->
<td class="nobborder" style='background-color:<?php
echo $bgcolor;
?>
;text-align: center' width='12%'><?php
echo $s_since;
示例5: foreach
if ($plugin_list = Plugin::get_list($conn, "WHERE id = {$id}")) {
$plugin_name = $plugin_list[0]->get_name();
} else {
$plugin_name = $id;
}
echo "<tr>\n";
echo "<td>" . $plugin_name . "</td>\n";
echo "<td>" . $schedule->get_minute() . "</td>\n";
echo "<td>" . $schedule->get_hour() . "</td>\n";
echo "<td>" . $schedule->get_day_month() . "</td>\n";
echo "<td>" . $schedule->get_month() . "</td>\n";
echo "<td>" . $schedule->get_day_week() . "</td>\n";
echo "<td>";
foreach ($sensors as $sensor) {
echo "Sensor: ";
echo Host::ip2hostname($conn, $sensor->get_sensor_name()) . "<br>";
}
foreach ($netgroups as $netgroup) {
echo "NetGroups: ";
echo $netgroup->get_netgroup_name() . "<br>";
}
foreach ($hostgroups as $hostgroup) {
echo "HostGroups: ";
echo $hostgroup->get_hostgroup_name() . "<br>";
}
foreach ($nets as $net) {
echo "Nets: ";
echo $net->get_net_name() . "<br>";
}
foreach ($hosts as $host) {
echo "Host: ";
示例6: foreach
$count = RRD_anomaly::get_list_count($conn);
if ($event_list = RRD_anomaly::get_list($conn, $where_clause, "order by\nanomaly_time desc", "0", $count)) {
foreach ($event_list as $event) {
$ip = $event->get_ip();
?>
<tr>
<th>
<A HREF="<?php
echo Sensor::get_sensor_link($conn, $ip) . "/{$ip}.html";
?>
" target="_blank" title="<?php
echo $ip;
?>
">
<?php
echo Host::ip2hostname($conn, $ip);
?>
</A></th><td> <?php
echo $event->get_what();
?>
</td>
<td> <?php
echo $event->get_anomaly_time();
?>
</td>
<td> <?php
echo round($event->get_count() / $perl_interval);
echo _("h.");
?>
</td>
<td><font color="red"><?php
示例7: strtolower
$acid_link = Util::get_acid_events_link($since, $date, "time_a");
echo "\n <a href=\"{$acid_link}\">\n <font color=\"black\">{$since}</font>\n </a>\n ";
?>
</td>
<td style="padding-left:3px;padding-right:3px" class="center nobborder">
<?php
$acid_link = Util::get_acid_events_link($since, $date, "time_d");
echo "\n <a href=\"{$acid_link}\">\n <font color=\"black\">{$date}</font></a>\n ";
?>
</td>
<?php
$src_link = "../forensics/base_stat_ipaddr.php?clear_allcriteria=1&ip={$src_ip}&hmenu=Forensics&smenu=Forensics";
$dst_link = "../forensics/base_stat_ipaddr.php?clear_allcriteria=1&ip={$dst_ip}&hmenu=Forensics&smenu=Forensics";
$src_name = $no_resolv ? $src_ip : Host::ip2hostname($conn, $src_ip);
$dst_name = $no_resolv ? $dst_ip : Host::ip2hostname($conn, $dst_ip);
$src_img = Host_os::get_os_pixmap($conn, $src_ip);
$dst_img = Host_os::get_os_pixmap($conn, $dst_ip);
$src_country = strtolower(geoip_country_code_by_addr($gi, $src_ip));
$src_country_name = geoip_country_name_by_addr($gi, $src_ip);
$src_country_img = "<img src=\"/ossim/pixmaps/flags/" . $src_country . ".png\" title=\"" . $src_country_name . "\">";
$dst_country = strtolower(geoip_country_code_by_addr($gi, $dst_ip));
$dst_country_name = geoip_country_name_by_addr($gi, $dst_ip);
$dst_country_img = "<img src=\"/ossim/pixmaps/flags/" . $dst_country . ".png\" title=\"" . $dst_country_name . "\">";
?>
<!-- src & dst hosts -->
<td nowrap style="text-align:center;padding-left:3px;padding-right:3px" class="nobborder">
<div id="<?php
echo $src_ip;
?>
;<?php
示例8: explode
$sensor_where = "";
if (Session::allowedSensors() != "") {
$user_sensors = explode(",", Session::allowedSensors());
$snortsensors = Event_viewer::GetSensorSids($conn);
$sensor_str = "";
foreach ($user_sensors as $user_sensor) {
if (count($snortsensors[$user_sensor]) > 0) {
$sensor_str .= $sensor_str != "" ? "," . implode(",", $snortsensors[$user_sensor]) : implode(",", $snortsensors[$user_sensor]);
}
}
if ($sensor_str == "") {
$sensor_str = "0";
}
$sensor_where = " AND sid in (" . $sensor_str . ")";
}
$hostname = Host::ip2hostname($conn_ossim, $host);
if ($hostname != $host) {
$title = $hostname . "({$host})";
} else {
$title = $host;
}
$_SESSION['host_report'] = $host;
if (preg_match("/\\/\\d+/", $host)) {
$exp = CIDR::expand_CIDR($host, "SHORT", "IP");
$src_s_range = $exp[0];
$src_e_range = end($exp);
$ip_where = "ip_src>=INET_ATON('{$src_s_range}') AND ip_src<=INET_ATON('{$src_e_range}') and";
} elseif ($host == 'any') {
$ip_where = "";
} else {
$ip_where = "ip_src=INET_ATON('{$host}') and";
示例9: elseif
if ($type == "event" && is_array($SS_Attack) && count($SS_Attack) > 0) {
$list = $SS_Attack;
} elseif ($type == "alarm" && is_array($SA_Attack) && count($SA_Attack) > 0) {
$list = $SA_Attack;
} else {
$list = $security_report->AttackHost($security_report->ossim_conn, $target, $limit, $type, $date_from, $date_to);
}
$datax = $datay = array();
$gorientation = "h";
foreach ($list as $key => $l) {
if ($key >= 10) {
// ponemos un límite de resultados para la gráfica
//break;
$gorientation = "v";
}
$datax[] = Host::ip2hostname($security_report->ossim_conn, $l[0]);
$datay[] = $l[1];
}
require_once 'ossim_conf.inc';
$conf = $GLOBALS["CONF"];
$jpgraph = $conf->get_conf("jpgraph_path");
require_once "{$jpgraph}/jpgraph.php";
require_once "{$jpgraph}/jpgraph_bar.php";
// Setup the graph.
if ($gorientation == "v") {
$y = 30 + count($list) * 21;
} else {
$y = 250;
}
$graph = new Graph(400, $y, "auto");
$graph->img->SetMargin(60, 20, 30, 100);
示例10: elseif
}
} elseif ($ref == 'Vulnerability') {
$vulnerability_list = $incident->get_vulnerabilities($conn);
foreach ($vulnerability_list as $vulnerability_data) {
// Osvdb starting
$nessus_id = $vulnerability_data->get_nessus_id();
$osvdb_id = Osvdb::get_osvdbid_by_nessusid($conn, $nessus_id);
if ($osvdb_id) {
$nessus_id = "<a href=\"osvdb.php?id=" . $osvdb_id . "\">" . $nessus_id . "</a>";
}
// Osvdb end
// Add name and kdb link
require_once "classes/Host.inc";
require_once "classes/Repository.inc";
$txt_temp = '';
$hostname_temp = Host::ip2hostname($conn, $vulnerability_data->get_ip());
if ($hostname_temp != $vulnerability_data->get_ip()) {
$txt_temp .= $hostname_temp . ' - ';
}
if ($linkedocs = Repository::have_linked_documents($conn, $vulnerability_data->get_ip(), 'host')) {
$txt_temp .= "<a href=\"javascript:;\" onclick=\"GB_edit('../repository/repository_list.php?keyname=" . urlencode($vulnerability_data->get_ip()) . "&type=host')\" class='blue' target='main'>[" . $linkedocs . "] " . _('Knowledge DB') . "</a>";
}
if ($txt_temp != '') {
$txt_temp = ' (' . $txt_temp . ')';
}
echo "<strong>IP:</strong> " . $vulnerability_data->get_ip() . $txt_temp . "<br>";
echo "<strong>Port:</strong> " . $vulnerability_data->get_port() . "<br/>";
echo "<strong>Scanner ID:</strong> " . $nessus_id . "<br/>";
echo "<strong>Risk:</strong> " . $vulnerability_data->get_risk() . "<br/>";
echo "<strong>Description:</strong> " . Osvdb::sanity($vulnerability_data->get_description()) . "<br/>";
}
示例11: urlencode
$alarm_name = Util::translate_alarm($conn, $alarm_name, $alarm);
$alarm_name_orig = $alarm_name;
if ($backlog_id != 0) {
$events_link = "events.php?backlog_id={$backlog_id}";
$alarm_name = $events_link;
} else {
$events_link = $_SERVER["SCRIPT_NAME"];
$alarm_link = Util::get_acid_pair_link($date, $alarm->get_src_ip(), $alarm->get_dst_ip());
$alarm_name = $alarm_link;
}
$src_ip = $alarm->get_src_ip();
$dst_ip = $alarm->get_dst_ip();
$src_port = Port::port2service($conn, $alarm->get_src_port());
$dst_port = Port::port2service($conn, $alarm->get_dst_port());
$sensors = $alarm->get_sensors();
$risk = $alarm->get_risk();
$src_link = "report/index.php?host={$src_ip}§ion=events";
$dst_link = "report/index.php?host={$dst_ip}§ion=events";
$src_name = Host::ip2hostname($conn, $src_ip);
$dst_name = Host::ip2hostname($conn, $dst_ip);
$event_id = $alarm->get_event_id();
$status = $alarm->get_status();
echo "\n <entry>\n <title>\n Alarm: {$alarm_name_orig} Risk: {$risk}</title>\n <id>http://" . $_SERVER['SERVER_ADDR'] . "/" . urlencode($alarm_name) . "</id>\n <link href=\"http://" . $_SERVER['SERVER_ADDR'] . "/" . urlencode($alarm_name) . "\"/>\n <summary>{$alarm_name_orig}</summary>\n <content type=\"application/xhtml+xml\" xml:space=\"preserve\">\n <div xmlns=\"http://www.w3.org/1999/xhtml\">\n <strong>Alarm:</strong> {$alarm_name_orig}<br/>\n <strong>Risk:</strong> {$risk}<br/>\n <strong>Date:</strong> {$since}<br/>\n";
foreach ($sensors as $sensor) {
echo "\n <strong>Sensor:</strong>\n <a href=\"http://" . $_SERVER['SERVER_ADDR'] . "/ossim/sensor/sensor_plugins.php?sensor={$sensor}\" >{$sensor}</a>\n (" . Host::ip2hostname($conn, $sensor) . ")<br/>\n ";
}
echo "\n <strong>Source IP:</strong>\n <a href=\"http://" . $_SERVER['SERVER_ADDR'] . "/ossim/" . urlencode($src_link) . "\">{$src_ip}</a><br/>\n <strong>Destination IP:</strong>\n <a href=\"http://" . $_SERVER['SERVER_ADDR'] . "/ossim/" . urlencode($dst_link) . "\">{$dst_ip}</a><br/>\n </div>\n </content>\n <author>\n <name>\nOSSIM at " . $_SERVER['SERVER_ADDR'] . "\n </name>\n </author>\n <updated>" . Util::timestamp2RFC1459($alarm->get_timestamp()) . "</updated>\n </entry>\n";
}
}
echo "</feed>\n";
$db->close($conn);
示例12: getprotobynumber
<td> </td>
<td>
<A HREF="<?php
echo Sensor::get_sensor_link($conn, $anom_services_ip["ip"]) . "/" . $anom_services_ip["ip"] . ".html";
?>
" target="_blank" title="<?php
echo $anom_services_ip["ip"];
?>
">
<?php
echo Host::ip2hostname($conn, $anom_services_ip["ip"]);
?>
</A>
</td>
<td colspan="1"><?php
echo Host::ip2hostname($conn, $anom_services_ip["sensor"], true);
?>
</td>
<td colspan="1"><?php
echo $anom_services_ip["port"];
?>
</td>
<td colspan="1"><font color="red"><?php
echo $anom_services_ip["service"] . "/" . getprotobynumber($anom_services_ip["protocol"]) . " [" . $anom_services_ip["version"] . "]";
?>
</font></td>
<td colspan="1"><?php
echo $anom_services_ip["old_service"] . "/" . getprotobynumber($anom_services_ip["old_protocol"]) . " [" . $anom_services_ip["old_version"] . "]";
?>
</td>
<td colspan="1"><?php
示例13: _
echo _("Device");
?>
</th>
<th><?php
echo _("Date");
?>
</th>
<th><?php
echo _("Last SIEM Event");
?>
</th>
</tr>
<?php
}
foreach ($events as $event) {
$hostname = Host::ip2hostname($conn, $event["ip"]);
if ($event["ip"] != $hostname) {
$hostname = $event["ip"] . " [{$hostname}]";
}
$ago = TimeAgo(strtotime($event["event_date"]), time());
?>
<tr class="trc" txt="<?php
echo strtotime($event["event_date"]);
?>
">
<td class="small nobborder center" width="16px"><img src="" border="0"></td>
<td class="small nobborder"><b><?php
echo $hostname;
?>
</b> </td>
<td class="small nobborder center"><?php
示例14: while
if ($need_extradata && !array_key_exists("username", $myrow)) {
$rs_ed = $qs->ExecuteOutputQueryNoCanned("SELECT * FROM extra_data WHERE sid=" . $myrow["sid"] . " AND cid=" . $myrow["cid"], $db);
while ($row_ed = $rs_ed->baseFetchRow()) {
foreach ($row_ed as $k => $v) {
$myrow[$k] = $v;
}
}
$rs_ed->baseFreeRows();
}
//
// SID, CID, PLUGIN_*
$cell_data['SID'] = $myrow["sid"];
$cell_align['SID'] = "center";
$cell_data['SENSOR'] = $sensornames[$myrow["sid"]] != "" ? $sensornames[$myrow["sid"]] : gettext("unknown");
if (preg_match("/\\d+\\.\\d+\\.\\d+\\.\\d+/", $cell_data['SENSOR'])) {
$cell_data['SENSOR'] = '<A alt="' . $cell_data['SENSOR'] . '" title="' . $cell_data['SENSOR'] . '" HREF="base_stat_ipaddr.php?ip=' . $cell_data['SENSOR'] . '&netmask=32">' . Host::ip2hostname($_conn, $cell_data['SENSOR'], true) . '</A>';
}
$cell_align['SENSOR'] = "center";
$cell_data['CID'] = $myrow["cid"];
$cell_align['CID'] = "center";
$cell_data['PLUGIN_ID'] = $myrow["plugin_id"];
$cell_align['PLUGIN_ID'] = "center";
$cell_data['PLUGIN_SID'] = $myrow["plugin_sid"];
$cell_align['PLUGIN_SID'] = "center";
if (in_array("PLUGIN_NAME", $_SESSION['views'][$_SESSION['current_cview']]['cols']) || in_array("PLUGIN_DESC", $_SESSION['views'][$_SESSION['current_cview']]['cols'])) {
list($cell_data['PLUGIN_NAME'], $cell_data['PLUGIN_DESC']) = GetPluginNameDesc($myrow["plugin_id"], $db);
$cell_align['PLUGIN_NAME'] = $cell_align['PLUGIN_DESC'] = "left";
}
if (in_array("PLUGIN_SOURCE_TYPE", $_SESSION['views'][$_SESSION['current_cview']]['cols'])) {
$cell_data['PLUGIN_SOURCE_TYPE'] = $opensource ? _("Only in Profesional version") : GetSourceType($myrow["plugin_id"], $db);
$cell_align['PLUGIN_SOURCE_TYPE'] = "center";
示例15: _
</td>
<td width="128" style='background-color:#FFFFE3;border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px;border: 1px solid #F0E68C;'>
<?php
echo _("Info");
?>
</td></tr>
<?php
$tp = intval(count($vulns) / $maxpag);
$tp += count($vulns) % $maxpag == 0 ? 0 : 1;
$to = $pag * $maxpag;
$from = $to - $maxpag;
$ips_to_show = array();
$i = 1;
foreach ($vulns as $key => $value) {
if ($i > $from && $i <= $to) {
$name = Host::ip2hostname($dbconn, $key);
$ips_to_show[] = $key . "|" . $name;
?>
<tr>
<td style="text-align:center"><?php
echo $key;
?>
</td>
<td style="text-align:center"><?php
echo $name;
?>
</td>
<?php
$image = get_image($value[1]);
?>
<td style="text-align:center"><?php