本文整理汇总了PHP中Av_sensor::get_name_by_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Av_sensor::get_name_by_id方法的具体用法?PHP Av_sensor::get_name_by_id怎么用?PHP Av_sensor::get_name_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Av_sensor
的用法示例。
在下文中一共展示了Av_sensor::get_name_by_id方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main_page
//.........这里部分代码省略.........
<table style='margin-top:20px;' class='w100 transparent'><tr><td class='sec_title'>{$schedulejobs}</td></tr></table>
<table summary="Job Schedules" class='w100 table_list'>
EOT;
if ($sortdir == "ASC") {
$sortdir = "DESC";
} else {
$sortdir = "ASC";
}
$arr = array("name" => "Name", "schedule_type" => "Schedule Type", "time" => "Time", "next_CHECK" => "Next Scan", "enabled" => "Status");
// modified by hsh to return all scan schedules
if (empty($arruser)) {
$query = "SELECT t2.name as profile, t1.meth_TARGET, t1.id, t1.name, t1.schedule_type, t1.meth_VSET, t1.meth_TIMEOUT, t1.username, t1.enabled, t1.next_CHECK, t1.email\n FROM vuln_job_schedule t1 LEFT JOIN vuln_nessus_settings t2 ON t1.meth_VSET=t2.id ";
} else {
$query = "SELECT t2.name as profile, t1.meth_TARGET, t1.id, t1.name, t1.schedule_type, t1.meth_VSET, t1.meth_TIMEOUT, t1.username, t1.enabled, t1.next_CHECK, t1.email\n FROM vuln_job_schedule t1 LEFT JOIN vuln_nessus_settings t2 ON t1.meth_VSET=t2.id WHERE username in ({$user}) ";
}
$query .= $sql_order;
$result = $dbconn->execute($query);
if ($result->EOF) {
echo "<tr><td class='empty_results' height='20' style='text-align:center;'>" . _("No Scheduled Jobs") . "</td></tr>";
}
if (!$result->EOF) {
echo "<tr>";
foreach ($arr as $order_by => $value) {
echo "<th><a href=\"manage_jobs.php?sortby={$order_by}&sortdir={$sortdir}\">" . _($value) . "</a></th>";
}
if (Session::menu_perms("environment-menu", "EventsVulnerabilitiesScan")) {
echo "<th>" . _("Action") . "</th></tr>";
}
}
$colors = array("#FFFFFF", "#EEEEEE");
$color = 0;
while (!$result->EOF) {
list($profile, $targets, $schedid, $schedname, $schedtype, $sid, $timeout, $user, $schedstatus, $nextscan, $servers) = $result->fields;
$name = Av_sensor::get_name_by_id($dbconn, $servers);
$servers = $name != '' ? $name : "unknown";
$targets_to_resolve = explode("\n", $targets);
$ttargets = array();
foreach ($targets_to_resolve as $id_ip) {
if (preg_match("/^([a-f\\d]{32})#\\d+\\.\\d+\\.\\d+\\.\\d+\\/\\d{1,2}/i", $id_ip, $found) && Asset_net::is_in_db($dbconn, $found[1])) {
$ttargets[] = preg_replace("/^([a-f\\d]{32})#/i", "", $id_ip) . " (" . Asset_net::get_name_by_id($dbconn, $found[1]) . ")";
} else {
if (preg_match("/^([a-f\\d]{32})#\\d+\\.\\d+\\.\\d+\\.\\d+/i", $id_ip, $found) && Asset_host::is_in_db($dbconn, $found[1])) {
$ttargets[] = preg_replace("/^([a-f\\d]{32})#/i", "", $id_ip) . " (" . Asset_host::get_name_by_id($dbconn, $found[1]) . ")";
} else {
$ttargets[] = preg_replace("/[a-f\\d]{32}/i", "", $id_ip);
}
}
}
$targets = implode("<BR/>", $ttargets);
$tz = intval($tz);
$nextscan = gmdate("Y-m-d H:i:s", Util::get_utc_unixtime($nextscan) + 3600 * $tz);
preg_match("/\\d+\\-\\d+\\-\\d+\\s(\\d+:\\d+:\\d+)/", $nextscan, $found);
$time = $found[1];
switch ($schedtype) {
case "N":
$stt = _("Once (Now)");
break;
case "O":
$stt = _("Once");
break;
case "D":
$stt = _("Daily");
break;
case "W":
$stt = _("Weekly");
break;
示例2: _
$flag_events = false;
}
}
if ($flag_events) {
$event_types = "<b>" . _('DS Groups') . ":</b><br>" . $plugingroups;
} else {
$event_types = "<b>" . _('Taxonomy') . ":</b><br>" . $taxonomy;
}
$xml .= "<cell><![CDATA[" . $event_types . "]]></cell>";
if ($engine != 'engine') {
$sensors = "";
$sensor_exist = $policy->exist_sensors($conn);
if ($sensor_list = $policy->get_sensors($conn)) {
foreach ($sensor_list as $sensor) {
if (!check_any($sensor->get_sensor_id())) {
$sensors .= ($sensors == "" ? "" : "<br/>") . Av_sensor::get_name_by_id($conn, $sensor->get_sensor_id());
if ($sensor_exist[$sensor->get_sensor_id()] == 'false') {
$sensors = '<div title="' . _('sensor non-existent') . '">' . $sensors;
$sensors .= '<a href="newpolicyform.php?id=' . $id . '&sensorNoExist=true#tabs-5"><img style="vertical-align: middle" src="../pixmaps/tables/cross-small-circle.png" /></a></div>';
}
}
}
}
if (empty($sensors)) {
$sensors = "<font color='#AAAAAA'><b>ANY</b></font>";
}
$xml .= "<cell><![CDATA[" . $sensors . "]]></cell>";
}
if ($policy_time = $policy->get_time($conn)) {
$tzone = $policy_time->get_timezone();
$begin_range = "";
示例3: file_get_contents
//Validating icon format and size
$icon = '';
if (is_uploaded_file($_FILES['icon']['tmp_name'])) {
$icon = file_get_contents($_FILES['icon']['tmp_name']);
}
if ($icon != '') {
$image = @imagecreatefromstring($icon);
if (!$image || imagesx($image) > 400 || imagesy($image) > 400) {
$validation_errors['icon'] = _('Image format is not allowed');
}
}
//Validating Sensors
if (is_array($sensors) && !empty($sensors)) {
foreach ($sensors as $sensor) {
if (!Av_sensor::is_allowed($conn, $sensor)) {
$validation_errors['sboxs[]'] .= sprintf(_("Error! Sensor %s cannot be assigned to this asset"), Av_sensor::get_name_by_id($conn, $sensor)) . "<br/>";
}
}
}
$db->close();
}
$data['status'] = 'OK';
$data['data'] = $validation_errors;
if (POST('ajax_validation_all') == TRUE) {
if (is_array($validation_errors) && !empty($validation_errors)) {
$data['status'] = 'error';
}
echo json_encode($data);
exit;
} else {
if (is_array($validation_errors) && !empty($validation_errors)) {
示例4: empty
$ips = $_ips->get_ips();
//Checking HIDS Sensor
$cnd_1 = Ossec_utilities::is_sensor_allowed($conn, $sensor_id) == FALSE;
$asset_sensors = Asset_host_sensors::get_sensors_by_id($conn, $asset_id);
$cnd_2 = empty($asset_sensors[$sensor_id]);
if ($cnd_1 || $cnd_2) {
$validation_errors['sensor_id'] = sprintf(_("Sensor %s not allowed. Please check with your account admin for more information"), Av_sensor::get_name_by_id($conn, $sensor_id));
} else {
$system_ids = Av_center::get_system_id_by_component($conn, $sensor_id);
$res = Av_center::get_system_info_by_id($conn, $system_ids['non-canonical']);
if ($res['status'] == 'success') {
//We use this function to calculate sensor name because in HA environments there are two systems for one Sensor ID
if (empty($res['data']['ha_ip'])) {
$sensor_name = $res['data']['name'];
} else {
$sensor_name = Av_sensor::get_name_by_id($conn, $sensor_id);
}
$sensor_ip = $res['data']['current_ip'];
if (Ossec_utilities::get_default_sensor_id() == $sensor_id && empty($res['data']['ha_ip'])) {
$sensor_ip = $res['data']['admin_ip'];
}
$sensor_ip_txt = $sensor_ip . ' [' . $sensor_name . ']';
}
//Getting Agent information
$_aux_agent = Asset_host::get_related_hids_agents($conn, $asset_id, $sensor_id);
$agent_key = md5(strtoupper($sensor_id) . '#' . $agent_id);
$agent = $_aux_agent[$agent_key];
if (empty($agent)) {
$validation_errors['agent_id'] = _('Error! Agent information cannot be retrieved from system');
} else {
$agent_descr = $agent['name'] . ' (' . $agent['ip_cidr'] . ')';
示例5: dirname
* On Debian GNU/Linux systems, the complete text of the GNU General
* Public License can be found in `/usr/share/common-licenses/GPL-2'.
*
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
require_once dirname(__FILE__) . '/../../conf/config.inc';
Session::logcheck('environment-menu', 'EventsHidsConfig');
$sensor_id = REQUEST('sensor_id');
ossim_valid($sensor_id, OSS_HEX, 'illegal:' . _('Sensor ID'));
if (!ossim_error()) {
$db = new ossim_db();
$conn = $db->connect();
if (!Ossec_utilities::is_sensor_allowed($conn, $sensor_id)) {
$db->close();
$error_msg = sprintf(_("Sensor %s not allowed. Please check with your account admin for more information"), Av_sensor::get_name_by_id($conn, $sensor_id));
echo ossim_error($error_msg);
exit;
}
$db->close();
}
//Current sensor
$_SESSION['ossec_sensor'] = $sensor_id;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php
echo _('OSSIM Framework');
?>
示例6: foreach
if ($taxonomy_list = $policy->get_taxonomy_conditions($conn)) {
foreach ($taxonomy_list as $tax) {
$tax_id = $tax->get_product_type_id() . "@" . $tax->get_category_id() . "@" . $tax->get_subcategory_id();
$tax_val = $filter['ptype'][$tax->get_product_type_id()] . " | " . $filter['cat'][$tax->get_category_id()] . " | " . $filter['subcat'][$tax->get_subcategory_id()];
$tax_filters[$tax_id] = $tax_val;
$flag_events = false;
}
}
}
//SENSOR
$sensor_exist = $policy->exist_sensors($conn);
if ($sensor_list = $policy->get_sensors($conn)) {
foreach ($sensor_list as $sensor) {
if (!check_any($sensor->get_sensor_id())) {
if ($sensor_exist[$sensor->get_sensor_id()] != 'false') {
$sensors['sensor_' . $sensor->get_sensor_id()] = Av_sensor::get_name_by_id($conn, $sensor->get_sensor_id());
$flag_sensors = false;
}
} else {
$sensors[$sensor->get_sensor_id()] = _('ANY');
}
}
}
//Time Filters
$policy_time = $policy->get_time($conn);
$time_begin[0] = $policy_time->get_month_start();
$time_begin[1] = $policy_time->get_month_day_start();
$time_begin[2] = $policy_time->get_week_day_start();
$time_begin[3] = $policy_time->get_hour_start();
$time_begin[4] = $policy_time->get_minute_start();
$time_end[0] = $policy_time->get_month_end();
示例7: get_indicator_asset_name
function get_indicator_asset_name($conn, $type, $asset_id)
{
$name = '';
switch ($type) {
case 'host':
$name = Asset_host::get_name_by_id($conn, $asset_id);
break;
case 'net':
$name = Asset_net::get_name_by_id($conn, $asset_id);
break;
case 'hostgroup':
case 'host_group':
$name = Asset_group::get_name_by_id($conn, $asset_id);
break;
case 'net_group':
case 'netgroup':
$name = Net_group::get_name_by_id($conn, $asset_id);
break;
case 'sensor':
$name = Av_sensor::get_name_by_id($conn, $asset_id);
break;
}
$name = empty($name) ? _('Unknown') : $name;
return $name;
}
示例8: _
$e_message = _('You do not have the correct permissions to see this page. Please contact system administrator with any questions');
Util::response_bad_request($e_message);
}
// Logcheck by s_type
if ($s_type == 'ocs') {
Session::logcheck_ajax('configuration-menu', 'AlienVaultInventory');
} else {
Session::logcheck_ajax('environment-menu', 'AlienVaultInventory');
}
$data = array();
try {
$db = new ossim_db();
$conn = $db->connect();
$task_list = Inventory::get_list($conn, '', $scan_types[$s_type]);
foreach ($task_list as $task) {
$sensor_name = Av_sensor::get_name_by_id($conn, $task['task_sensor']);
if ($sensor_name == '') {
$sensor_name = _('Unknown');
}
if ($s_type == 'wmi') {
preg_match('/wmipass:(.*)/', $task['task_params'], $matches);
if ($matches[1] != '') {
$task['task_params'] = preg_replace('/wmipass:(.*)/', '', $task['task_params']);
$task['task_params'] = $task['task_params'] . 'wmipass:' . preg_replace('/./', '*', $matches[1]);
}
} elseif ($s_type == 'nmap') {
$task['task_params'] = str_replace(' ', ', ', preg_replace("/#.*/", "", $task['task_params']));
}
$s_data = array("DT_RowId" => $task['task_id'], "DT_RowData" => array('s_type' => $s_type, 'sensor_id' => $task['task_sensor'], 'params' => $task['task_params'], 'frecuency' => $task['task_period'], 'enabled' => $task['task_enable']), $task['task_name'], $sensor_name, $task['task_params'], $frequencies[$task['task_period']], $task['task_enable'], '');
$data[] = $s_data;
}