本文整理汇总了PHP中Protocol::get_list方法的典型用法代码示例。如果您正苦于以下问题:PHP Protocol::get_list方法的具体用法?PHP Protocol::get_list怎么用?PHP Protocol::get_list使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Protocol
的用法示例。
在下文中一共展示了Protocol::get_list方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$hosts = array();
}
foreach ($hosts as $host) {
$_ip = $host['ips'];
$_hostname = $host['name'];
if (Session::hostAllowed($conn, $_ip)) {
//Load available hosts (Autocompleted)
if ($_hostname != $_ip) {
$h_list .= '{ txt:"' . $_hostname . ' [Host:' . $_ip . ']", id: "' . Asset_host_ips::ip2ulong($_ip) . '" },';
} else {
$h_list .= '{ txt:"' . $_ip . '", id: "' . Asset_host_ips::ip2ulong($_ip) . '" },';
}
}
}
// Protocol list
if ($protocol_list = Protocol::get_list()) {
echo "var protocols = new Array(" . count($protocol_list) . ")\n";
foreach ($protocol_list as $proto) {
//$_SESSION[$id] = $plugin->get_name();
echo "protocols['proto_" . $proto['id'] . "'] = '" . $proto['name'] . "'\n";
//Load available protocols (Autocompleted)
$p_list .= '{ txt: "Protocol:' . $proto['name'] . '", id: "' . $proto['id'] . '" },';
}
}
//Port list (Autocompleted)
if ($port_list = Port::get_list($conn, " AND protocol_name='tcp'")) {
foreach ($port_list as $port) {
$prt_list .= '{ txt:"' . $port->get_port_number() . " - " . $port->get_service() . '", id: "' . $port->get_port_number() . '" },';
}
}
// Plugin list
示例2: service_list
function service_list($conn, $page, $search)
{
$return['error'] = TRUE;
$return['msg'] = '';
$filters = array();
$filters['limit'] = get_query_limits($page);
$filters['order_by'] = 'port';
if ($search != '') {
$search = utf8_decode($search);
$search = escape_sql($search, $conn);
$filters['where'] = " (s.port LIKE '%{$search}%' OR s.service LIKE '%{$search}%'";
//Filter by protocol name
$protocol_list = Protocol::get_list($search);
$protocol_list = array_keys($protocol_list);
$protocol_list = implode(',', $protocol_list);
if (!empty($protocol_list)) {
$filters['where'] .= " OR s.protocol IN ({$protocol_list})";
}
$filters['where'] .= ")";
}
try {
list($services, $total) = Asset_host_services::get_services_available($conn, $filters, TRUE);
} catch (Exception $e) {
$return['error'] = TRUE;
$return['msg'] = $e->getMessage();
return $return;
}
if ($total > 0) {
$selected = get_selected_values(10);
}
$list = array();
//Going through the list to format the elements properly:
foreach ($services as $service) {
$_serv = array();
$id = $service['port'] . ';' . $service['protocol'] . ';' . $service['service'];
$md5 = md5($id);
$name = $service['port'] . '/' . $service['prot_name'] . ' (' . $service['service'] . ')';
$_chk = $selected[$md5] != '' ? TRUE : FALSE;
$_serv = array('id' => $id, 'name' => Util::utf8_encode2($name), 'checked' => $_chk);
$list[$md5] = $_serv;
}
$data['total'] = intval($total);
$data['list'] = $list;
$return['error'] = FALSE;
$return['data'] = $data;
return $return;
}
示例3: ossim_valid
ossim_valid($to_date, OSS_DIGIT, OSS_SCORE, OSS_NULLABLE, 'illegal:' . _("to_date"));
ossim_valid($name, OSS_DIGIT, OSS_ALPHA, OSS_SPACE, OSS_SCORE, OSS_NULLABLE, OSS_PUNC_EXT, '\\<\\>', 'illegal:' . _("name"));
ossim_valid($hide_closed, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("hide_closed"));
ossim_valid($top, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("top"));
ossim_valid($from, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("from"));
ossim_valid($group_id, OSS_DIGIT, OSS_ALPHA, OSS_NULLABLE, 'illegal:' . _("group_id"));
if (ossim_error()) {
die(ossim_error());
}
$host_list = Host::get_list($conn);
$assets = array();
foreach ($host_list as $host) {
$assets[$host->get_ip()] = $host->get_asset();
}
list($list, $num_rows) = AlarmGroups::get_alarms($conn, "", "", $hide_closed, "ORDER BY a.timestamp DESC", $from, $top, $from_date, $to_date, $name);
$ports = Protocol::get_list($conn);
?>
<table width="100%" class="transparent">
<?php
if ($from < 1) {
?>
<tr>
<td class="nobborder"></td>
<td class="nobborder"></td>
<td style='text-align: center; background-color:#9DD131;font-weight:bold'><?php
echo gettext("Alarm Name");
?>
</td>
<td style='text-align: center; background-color:#9DD131;font-weight:bold'><?php
echo gettext("Risk");
?>
示例4: sleep
?>
<script type="text/javascript">document.getElementById('progress').innerHTML = "<?php
echo $found[1];
?>
%";</script><?php
}
}
sleep(3);
}
}
if ($reload && file_exists("/tmp/nmap_scan_{$ip}.log")) {
$db = new ossim_db();
$conn = $db->connect();
// load protocol ids
$protocol_ids = array();
if ($protocol_list = Protocol::get_list($conn)) {
foreach ($protocol_list as $protocol_data) {
$protocol_ids[$protocol_data->get_name()] = $protocol_data->get_id();
}
}
$lines = file("/tmp/nmap_scan_{$ip}.log");
foreach ($lines as $line) {
preg_match('/(\\S+)\\s+open\\s+([\\w\\-\\_\\?]+)(\\s+)?(.*)$/', $line, $regs);
if (isset($regs[0])) {
list($port, $protocol) = explode("/", $regs[1]);
$protocol = $protocol_ids[strtolower(trim($protocol))] != "" ? $protocol_ids[strtolower(trim($protocol))] : "0";
$service = $regs[2];
$service_type = $regs[2];
$version = $regs[4];
$origin = 1;
$date = strftime("%Y-%m-%d %H:%M:%S");
示例5: update_db
function update_db($global_info, $scan)
{
$db = new ossim_db();
$conn = $db->connect();
$array_os = array("win" => "1", "linux" => "2", "cisco" => "3", "freebsd" => "5", "netbsd" => "6", "openbsd" => "7", "hp-ux" => "8", "solaris" => "9", "macos" => "10", "plan9" => "11", "sco" => "12", "aix" => "13", "unix" => "14");
$ips = $global_info["ips"];
$sensors = $global_info["sboxs"];
$nagios = $global_info['nagios'];
// load protocol ids
$protocol_ids = array();
if ($protocol_list = Protocol::get_list($conn)) {
foreach ($protocol_list as $protocol_data) {
$protocol_ids[$protocol_data->get_name()] = $protocol_data->get_id();
}
}
for ($i = 0; $i < $ips; $i++) {
$ip = $global_info["ip_{$i}"];
if (!empty($ip)) {
$hosts[] = $ip;
//gethostbyaddr($ip);
$os = $scan[$ip]["os"];
$os_id = 0;
foreach ($array_os as $k => $v) {
if (preg_match("/{$k}/i", $os)) {
$os_id = $v;
break;
}
}
if (Host::in_host($conn, $ip)) {
echo "* " . gettext("Updating") . " {$ip}..<br/>";
Host::update($conn, $ip, gethostbyaddr($ip), $global_info["asset"], $global_info["threshold_c"], $global_info["threshold_a"], $global_info["rrd_profile"], 0, 0, $global_info["nat"], $sensors, $global_info["descr"], $scan["{$ip}"]["os"], $scan["{$ip}"]["mac"], $scan["{$ip}"]["mac_vendor"]);
Host_scan::delete($conn, $ip, 3001);
//if (isset($global_info["nessus"])) { Host_scan::insert($conn, $ip, 3001, 0); }
} else {
echo "<span style='color='blue'>\n";
echo "* " . gettext("Inserting") . " {$ip}..<br/>\n";
echo "</span>\n";
Host::insert($conn, $ip, gethostbyaddr($ip), $global_info["asset"], $global_info["threshold_c"], $global_info["threshold_a"], $global_info["rrd_profile"], 0, 0, $global_info["nat"], $sensors, $global_info["descr"], $scan[$ip]["os"], $scan[$ip]["mac"], $scan[$ip]["mac_vendor"]);
// if (isset($global_info["nessus"])) { Host_scan::insert($conn, $ip, 3001, 0); }
}
if ($os_id != 0) {
Host_plugin_sid::delete($conn, $ip, 5001);
Host_plugin_sid::insert($conn, $ip, 5001, $os_id);
}
if (!empty($nagios)) {
if (!Host_scan::in_host_scan($conn, $ip, 2007)) {
Host_scan::insert($conn, $ip, 2007, "", $ip, $sensors, "");
}
} else {
if (Host_scan::in_host_scan($conn, $ip, 2007)) {
Host_scan::delete($conn, $ip, 2007);
}
}
/* Services */
Host_plugin_sid::delete($conn, $ip, 5002);
foreach ($scan[$ip]["services"] as $port_proto => $service) {
$service["proto"] = $protocol_ids[strtolower(trim($service["proto"]))];
Host_services::insert($conn, $ip, $service["port"], strftime("%Y-%m-%d %H:%M:%S"), $_SERVER["SERVER_ADDR"], $service["proto"], $service["service"], $service["service"], $service["version"], 1);
Host_plugin_sid::insert($conn, $ip, 5002, $service["port"]);
}
flush();
}
}
// Insert group name
$groupname = $global_info["groupname"];
if (!empty($groupname) && !empty($hosts)) {
$exists_hosts = count(Host_group::get_list($conn, " AND g.name='{$groupname}'")) > 0;
if ($exists_hosts) {
echo "<br/>" . _("The group name already exists") . "<br/>";
} else {
Host_group::insert($conn, $groupname, $global_info["threshold_c"], $global_info["threshold_a"], $global_info["rrd_profile"], $sensors, $hosts, $global_info["descr"]);
}
//if (isset($global_info["nessus"])) { Host_group_scan::insert($conn, $groupname, 3001, 0); }
if (!empty($nagios)) {
Host_group_scan::insert($conn, $groupname, 2007, 0);
}
}
$db->close($conn);
}