本文整理汇总了PHP中Av_sensor类的典型用法代码示例。如果您正苦于以下问题:PHP Av_sensor类的具体用法?PHP Av_sensor怎么用?PHP Av_sensor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Av_sensor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ossim_db
$nt->show();
Util::make_form("POST", "newsensorform.php?id={$sensor_id}&ip={$ip}&sname={$sname}");
exit;
}
$db = new ossim_db();
$conn = $db->connect();
$newcontext = POST('newcontext') != '' ? POST('newcontext') : $sname;
if (POST('isolated') == 1 && $newcontext != '') {
// Isolated sensor. Creating a new context first
$new_context_uuid = Session::clone_default_ctx($conn, $newcontext);
$entities = array($new_context_uuid);
// Refresh current permissions
$_SESSION['_user_vision'] = Acl::get_user_vision($conn);
} elseif (POST('isolated') == 0 && preg_match("/[a-f\\d]{32}/i", POST('neighborsensor'))) {
// Use selected sensor context
$entities = array_keys(Av_sensor::get_ctx_by_id($conn, POST('neighborsensor')));
}
try {
$old = new Av_Sensor($sensor_id);
$old->load_from_db($conn);
$cproperties = $old->get_properties();
$new = new Av_Sensor($sensor_id);
$new->set_properties($cproperties);
$new->set_name($sname);
$new->set_ip($ip);
$new->set_priority($priority);
$new->set_port($port);
$new->set_tzone($tzone);
$new->set_descr($descr);
$new->set_rpass($rpass);
foreach ($entities as $ctx) {
示例2: POST
*
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
require_once 'av_init.php';
Session::logcheck('configuration-menu', 'PolicySensors');
$sensor_id = POST('sensor_id');
$nagios_user = POST('user');
$nagios_pass = POST('pass');
ossim_valid($sensor_id, OSS_HEX, 'illegal:' . _('Sensor ID'));
ossim_valid($nagios_user, OSS_ALPHA, OSS_PUNC, OSS_SPACE, OSS_NULLABLE, 'illegal:' . _('Nagios User'));
ossim_valid($nagios_pass, OSS_PASSWORD, OSS_NULLABLE, 'illegal:' . _('Nagios Password'));
if (ossim_error()) {
die(ossim_error());
}
$db = new ossim_db();
$conn = $db->connect();
$sensor = Av_sensor::get_object($conn, $sensor_id);
if (Util::is_fake_pass($nagios_pass)) {
$nagios_options = $sensor->get_nagios_credentials($conn);
$nagios_pass = $nagios_options['password'];
}
try {
$url = $sensor->get_nagios_url($nagios_user, $nagios_pass);
if ($url != '') {
echo "<img src='../pixmaps/tick.png'/>";
}
} catch (Exception $e) {
echo preg_replace("/\\:.*/", '', $e->getMessage());
}
$db->close();
示例3: get_host_alive_attributes
// load the default values for the form
if ($action == 'create_scan') {
$conf = $GLOBALS['CONF'];
$scan_locally = $conf->get_conf('nessus_pre_scan_locally');
$timeout = 28800;
$hosts_alive = 1;
}
$hosts_alive_data = get_host_alive_attributes($hosts_alive, $targets);
$scan_locally_checked = $scan_locally == 1 ? 'checked="checked"' : '';
$resolve_names_checked = $not_resolve == 1 ? 'checked="checked"' : '';
$email_notification = array();
$email_notification['no'] = $send_email == 0 ? 'checked="checked"' : '';
$email_notification['yes'] = $send_email == 1 ? 'checked="checked"' : '';
// load sensors
$filters = array('where' => 'sensor_properties.has_vuln_scanner = 1');
list($all_sensors, $s_total) = Av_sensor::get_list($conn);
foreach ($all_sensors as $_sensor_id => $sensor_data) {
$all_sensors[$_sensor_id]['selected'] = $_sensor_id == $SVRid ? 'selected="selected"' : '';
}
// load profiles
$args = '';
if (!Session::am_i_admin()) {
list($owners, $sqlowners) = Vulnerabilities::get_users_and_entities_filter($conn);
$owners[] = '0';
$sql_perms .= " OR owner IN('" . implode("', '", $owners) . "')";
$args = "WHERE name='Default' OR name='Deep' OR name='Ultimate' " . $sql_perms;
}
$query = "SELECT id, name, description, owner, type FROM vuln_nessus_settings {$args} ORDER BY name";
$conn->SetFetchMode(ADODB_FETCH_BOTH);
$result = $conn->execute($query);
while (!$result->EOF) {
示例4: ob_flush
?>
...</span>
</div>
</div>
<?php
ob_flush();
$conf = $GLOBALS['CONF'];
$acid_link = $conf->get_conf('acid_link');
$acid_prefix = $conf->get_conf('event_viewer');
$acid_main_link = str_replace('//', '/', $conf->get_conf('acid_link') . '/' . $acid_prefix . "_qry_main.php?clear_allcriteria=1&search=1&bsf=Query+DB&ossim_risk_a=+");
$db_sensor_list = array();
$list_no_active = array();
$aux_sensor_list = Av_sensor::get_basic_list($conn);
if (is_array($aux_sensor_list)) {
foreach ($aux_sensor_list as $aux_s_data) {
$db_sensor_list[] = $aux_s_data['ip'];
$db_sensor_rel[$aux_s_data['ip']] = $aux_s_data['name'];
$list_no_active[$aux_s_data['ip']] = $aux_s_data['name'];
}
}
list($sensor_list, $err) = server_get_sensors();
if ($err != '') {
$info_error[] = $err;
}
if (!$sensor_list && empty($ip_get)) {
$info_error[] = _("There aren't any sensors connected to OSSIM server");
}
$ossim_conf = $GLOBALS['CONF'];
示例5: get_notifications
function get_notifications($conn)
{
$notifications = array();
if (Session::menu_perms('configuration-menu', 'PolicySensors')) {
$new_sensors = Av_sensor::get_unregistered($conn);
if (count($new_sensors) > 0) {
$notif['msg'] = count($new_sensors) > 1 ? _('New Sensors Detected') : _('New Sensor Detected');
$notif['class'] = 'nl_sensors';
$notifications[$notif['class']] = $notif;
}
}
if (Session::am_i_admin()) {
$trial_days = calc_days_to_expire();
if ($trial_days !== FALSE) {
$notif['msg'] = $trial_days == 0 ? _('Trial Version expired') : $trial_days . ' ' . _('Days Left of Free Trial');
$notif['class'] = 'nl_trial';
$notifications[$notif['class']] = $notif;
}
$new_updates = get_only_updates();
if ($new_updates == TRUE) {
$notif['msg'] = _('New Updates Available');
$notif['class'] = 'nl_updates';
$notifications[$notif['class']] = $notif;
}
$unread = get_status_messages();
if ($unread) {
$notif['msg'] = _('New Warnings & Errors');
$notif['class'] = 'nl_messages';
$notifications[$notif['class']] = $notif;
}
$otx = calc_otx_notif();
if ($otx === TRUE) {
$notif['msg'] = _('Contribute to AlienVault OTX');
$notif['class'] = 'nl_otx';
$notifications[$notif['class']] = $notif;
}
$devices = calc_devices_total($conn);
$max_dev = intval($_SESSION["_max_devices"]);
//This val is loaded when the users log in. (session.inc)
if ($max_dev > 0 && $devices > $max_dev) {
$over = $devices - $max_dev;
$notif['msg'] = _("License Violation - {$over} Assets Over");
$notif['class'] = 'nl_device_exceed';
$notifications[$notif['class']] = $notif;
}
}
$return['error'] = FALSE;
$return['output'] = $notifications;
return $return;
}
示例6: while
$res = $conn->query("SELECT id,name,value FROM acl_perm WHERE type='MENU'");
while ($rw = $res->fetchRow()) {
$ret[$rw['name']][$rw['value']] = $rw['id'];
}
return $ret;
}
ini_set("include_path", ".:/usr/share/ossim/include:/usr/share/phpgacl");
$force_gacl = true;
require_once 'av_init.php';
$gacl = $GLOBALS['ACL'];
/* connect to db */
$db = new ossim_db();
$conn = $db->connect();
try {
$net_list = Asset_net::get_all($conn);
$sensor_list = Av_sensor::get_all($conn);
} catch (Exception $e) {
print $e->getMessage();
exit;
}
$permids = get_permids($conn);
$users = Session::get_list($conn);
foreach ($users as $user) {
$nets = "";
$sensors = "";
$perms = array();
$login = $user->get_login();
if ($user->get_is_admin() || $login == ACL_DEFAULT_OSSIM_ADMIN) {
continue;
}
// Skip admin user
示例7: set_include_path
*
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
/*******************************************************************************/
/* */
/* This script is called from nfsen packages to translate sensors uuid to name */
/* */
/*******************************************************************************/
set_include_path('/usr/share/ossim/include');
error_reporting(0);
ini_set("display_errors", "0");
//This is used to avoid an error when there is not connection to mysql
if (!isset($GLOBALS["CONF"])) {
$GLOBALS["CONF"] = array();
require_once 'ossim_db.inc';
$db = new ossim_db();
unset($GLOBALS["CONF"]);
} else {
require_once 'ossim_db.inc';
$db = new ossim_db();
}
$uuid = $argv[1];
if (@$db->test_connect()) {
$conn = $db->connect();
$name = Av_sensor::get_nfsen_channel_name($conn, $uuid);
$db->close();
} else {
$name = empty($uuid) ? 'Unknown' : $uuid;
}
echo $name;
示例8: ossim_valid
ossim_valid($destination, OSS_IP_CIDR, 'illegal:' . _('Destination cidr'));
$destination_type = 'net';
}
}
if (ossim_error()) {
$info_error[] = ossim_get_error();
ossim_clean_error();
} else {
$tdestinations[] = $destination;
}
}
} else {
$tdestinations = array();
}
// Launch scan
$info_sensor = $sensors_status[Av_sensor::get_name_by_ip($dbconn, $sensor_ip)];
if ($sensor_ip != '' && $sensor_interface != '' && intval($timeout) > 0 && count($info_error) == 0 && ($info_sensor[0] == 0 || $info_sensor[0] == -1)) {
$rlaunch_scan = $scan->launch_scan($tsources, $tdestinations, $sensor_ip, $sensor_interface, $timeout, $cap_size, $raw_filter);
if ($rlaunch_scan["status"] === true) {
$content = _('Launching capture... wait a few seconds');
$type = 'nf_success';
} else {
$content = $rlaunch_scan['message'];
$type = 'nf_warning';
}
$jtimeout = 4000;
} else {
if ($info_sensor[0] != -1 && ($info_sensor[0] == 1 || $info_sensor[0] == 2)) {
$content = _('The sensor is busy');
$type = 'nf_warning';
}
示例9: 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();
示例10: DisplayProcessing
//.........这里部分代码省略.........
#print "<pre>\n";
$patterns = array();
$replacements = array();
$patterns[0] = '/(\\s*)([^\\s]+)/';
$replacements[0] = "\$1<a href='#null' onClick='lookup(\"\$2\", this, event)' title='lookup \$2'>\$2</a>";
// gets HAP4NfSens plugin id. returns -1 if HAP4NfSen is not installed.
function getHAP4NfSenId()
{
$plugins = GetPlugins();
for ($i = 0; $i < count($plugins); $i++) {
$plugin = $plugins[$i];
if ($plugin == "HAP4NfSen") {
return $i;
}
}
return -1;
}
ClearMessages();
$cmd_opts['args'] = "-T {$run}";
$cmd_opts['filter'] = $filter;
$titcol = get_tit_col($run);
$cmd_out = nfsend_query("run-nfdump", $cmd_opts);
if (!is_array($cmd_out)) {
ShowMessages();
} else {
$conf = $GLOBALS["CONF"];
$solera = $conf->get_conf("solera_enable", FALSE) ? true : false;
$db = new ossim_db();
$conn = $db->connect();
$sensors = $hosts = $ossim_servers = array();
$tz = Util::get_timezone();
list($hosts, $host_ids) = Asset_host::get_basic_list($conn, array(), TRUE);
$entities = Session::get_all_entities($conn);
$_sensors = Av_sensor::get_basic_list($conn);
foreach ($_sensors as $s_id => $s) {
$sensors[$s['ip']] = $s['name'];
}
/*$hap4nfsen_id = getHAP4NfSenId();
if ($hap4nfsen_id >= 0) {
// ICMP "port" filter are no currently supported by the HAP4NfSen plugin
function isChecked(&$form, $name) { // helper function used to find out, if an option is checked
return $form[$name]=="checked";
}
$ip_and_port_columns = preg_match('/(flow records)/i', $IPStatOption[$process_form['stattype']]) &&
((isChecked($process_form,'aggr_srcip') && isChecked($process_form,'aggr_srcport')) ||
(isChecked($process_form,'aggr_dstip') && isChecked($process_form,'aggr_dstport')));
$ip_contains_port = $_SESSION["process_form"]["modeselect"]=='0' || !preg_match('/[ip|flow_records]/i', $IPStatOption[$process_form['stattype']]) ||
(preg_match('/(flow records)/i', $IPStatOption[$process_form['stattype']]) && !( // no boxes checked
isChecked($process_form,'aggr_srcip') || isChecked($process_form,'aggr_srcport') ||
isChecked($process_form,'aggr_dstip') || isChecked($process_form,'aggr_dstport')));
$_SESSION["plugin"][$hap4nfsen_id]["cmd_opts"] = $cmd_opts;
$hap_pic = "<img src=\"plugins/HAP4NfSen/graphviz.png\" valign=\"middle\" border=\"0\" alt=\"HAP\" />";
$default_pattern = array_pop($patterns);
$default_replacement = array_pop($replacements);
if ($ip_contains_port) { // matches cases like ip:port
$max_prot_length = 5; // max. port length = 5 chars(highest port number = 65535)
for ($i=$max_prot_length;$i>=1;$i--) {
$diff = ($max_prot_length-$i); // difference between actual and max port length
$ip_port_pattern_icmp = "/(\s*)([^\s|^:]+)(:)(0\s{4}|\d\.\d\s{2}|\d{2}\.\d\|\d\.\d{2}\s|\d{2}\.\d{2})/";
$ip_port_pattern_normal = "/(\s*)([^\s|^:]+)(:)([\d|\.]{{$i}})(\s{{$diff}})/";
$spaces = '';
for ($k=0;$k<$diff;$k++) {$spaces = $spaces . ' ';} // spaces required to align hap viewer icons
array_push($patterns, $ip_port_pattern_icmp);
array_push($replacements, $default_replacement .
"$3$4 <a href=\"nfsen.php?tab=5&sub_tab=" . $hap4nfsen_id . "&ip=$2&mode=new\" title='HAP graphlet for $2'>$hap_pic</a> ");
array_push($patterns, $ip_port_pattern_normal);
示例11: schedule_scan
function schedule_scan($conn, $wizard, $data)
{
$step = intval($wizard->get_step_data('scan_step'));
$nets = $wizard->get_step_data('scan_nets');
if ($step != 3 || count($nets) < 1) {
$response['error'] = TRUE;
$response['msg'] = _('Asset Scan not valid to schedule');
return $response;
}
$sched = $data['sch_opt'];
ossim_valid($sched, OSS_DIGIT, 'illegal:' . _("Schedule Option"));
if (ossim_error()) {
$response['error'] = TRUE;
$response['msg'] = ossim_get_error();
ossim_clean_error();
$wizard->set_step_data('scan_nets', -1);
return $response;
}
if ($sched == 1) {
$period = 86400;
} elseif ($sched == 2) {
$period = 604800;
} else {
$period = 2419200;
}
$sensor_id = Av_sensor::get_default_sensor($conn);
$name = _('Default_wizard_scan');
$type = 5;
$targets = array();
foreach ($nets as $cidrs) {
$cidrs = explode(' ', $cidrs);
foreach ($cidrs as $cidr) {
$targets[$cidr] = $cidr;
}
}
$targets = implode(' ', $targets);
$params = $targets . '#-T3 -A -sS -F';
Inventory::insert($conn, $sensor_id, $name, $type, $period, $params, $targets);
$response['error'] = FALSE;
$response['data'] = array();
return $response;
}
示例12: session_write_close
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
require_once 'av_init.php';
Session::logcheck('environment-menu', 'PolicyHosts');
session_write_close();
/****************************************************
********************* Tooltips *********************
****************************************************/
$t_location = '<div>' . _("You can type any location (address, country, city, ...)") . '</div>';
//Database connection
$db = new ossim_db();
$conn = $db->connect();
//Getting all sensors
$filters = array('order_by' => "priority DESC");
list($all_sensors, $s_total) = Av_sensor::get_list($conn, $filters, FALSE, TRUE);
//Common Context
$ctx = Asset_host::get_common_ctx($conn);
//Closing database connection
$db->close();
?>
<div id="bk_tg_container">
<div id='tg_av_info'></div>
<div class="legend">
<?php
echo _('Only filled values will be updated');
?>
</div>
示例13: ossim_db
$dbo = new ossim_db();
// Multiple Database Server selector
$conn = $dbo->connect();
$database_servers = Databases::get_list($conn);
$dbo->close();
//
if (is_array($_SESSION["server"]) && $_SESSION["server"][0] != "") {
$dbo->enable_cache();
$conn = $dbo->custom_connect($_SESSION["server"][0], $_SESSION["server"][2], $_SESSION["server"][3]);
} else {
$dbo->enable_cache();
$conn = $dbo->connect();
}
include_once "{$BASE_path}/base_common.php";
$sensors = $hosts = $ossim_servers = array();
$sensors = Av_sensor::get_basic_list($conn, array(), TRUE);
list($hosts, $host_ids) = Asset_host::get_basic_list($conn, array(), TRUE);
$entities = Session::get_all_entities($conn);
$rep_activities = Reputation::get_reputation_activities($conn, "ORDER BY descr", $db_memcache);
$rep_severities = array("ANY", "High", "Medium", "Low");
//
// added default home host/lan to SESSION[ip_addr]
//
if ($_GET["addhomeips"] == "src" || $_GET["addhomeips"] == "dst") {
$_nets = Asset_net::get_all($conn, TRUE);
// adding all not external lans
$local_ips = array();
$total_ips = 0;
foreach ($_nets as $current_net) {
$cirds = explode(",", $current_net['ips']);
foreach ($cirds as $cidr) {
示例14: sensor_list
function sensor_list($conn, $page, $search)
{
$filters = array();
$filters['limit'] = get_query_limits($page);
if ($search != '') {
$search = utf8_decode($search);
$search = escape_sql($search, $conn);
$filters['where'] = " name LIKE '%{$search}%' OR inet6_ntoa(ip) LIKE '%{$search}%'";
}
$filters['order_by'] = 'name ASC';
try {
list($sensors, $total) = Av_sensor::get_list($conn, $filters, TRUE, TRUE);
} catch (Exception $e) {
$return['error'] = TRUE;
$return['msg'] = $e->getMessage();
return $return;
}
//If we have at least one element...
if ($total > 0) {
//Getting the nets already selected in the filter.
$selected = get_selected_values(14);
}
$list = array();
//Going through the list to format the elements properly:
foreach ($sensors as $id => $sensor) {
$_chk = $selected[$id] != '' ? TRUE : FALSE;
$_sensor = array('id' => $id, 'name' => $sensor['name'], 'extra' => $sensor['ip'], 'checked' => $_chk);
$list[$id] = $_sensor;
}
$data['total'] = intval($total);
$data['list'] = $list;
$return['error'] = FALSE;
$return['data'] = $data;
return $return;
}
示例15: 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)) {