本文整理汇总了PHP中Av_sensor::get_object方法的典型用法代码示例。如果您正苦于以下问题:PHP Av_sensor::get_object方法的具体用法?PHP Av_sensor::get_object怎么用?PHP Av_sensor::get_object使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Av_sensor
的用法示例。
在下文中一共展示了Av_sensor::get_object方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
示例2: explode
echo $xml_file;
?>
', 500, 640);return false;"><img src="../pixmaps/plus-small.png" border="0"/></a></td><?php
}
?>
<td class="nobborder">
<?php
if ($rule->sensor == "ANY") {
echo $rule->sensor;
} else {
$sensor_list = explode(",", $rule->sensor);
$final_list = array();
foreach ($sensor_list as $sensor) {
$sensor = preg_replace("/(........)-(....)-(....)-(....)-(............)/", "\\1\\2\\3\\4\\5", strtoupper($sensor));
if (preg_match("/^[A-Z0-9]{32}\$/", $sensor)) {
$sensor_obj = Av_sensor::get_object($conn, $sensor);
if ($sensor_obj) {
$final_list[] = $sensor_obj->get_name() . " ";
}
} else {
$final_list[] = $sensor;
}
}
echo count($final_list) > 0 ? implode("<br>", $final_list) : "<i>" . _("External Sensors") . "</i>";
}
?>
</td>
</tr>
</table>
</td>
<?php
示例3: array_unique
$selected = FALSE;
// reorder sensors with load
if (!valid_hex32($scan_server)) {
$sensors = Av_sensor::reorder_vs_by_load($conn, $sensors);
array_unique($sensors);
} else {
// User has selected a sensor
$sensor_obj = Av_sensor::get_object($conn, $scan_server);
$sensors = array($scan_server => $sensor_obj->get_vs_load($conn));
}
// info per each related sensor
$ttargets[$target]['perm'] = $perm;
if (!empty($sensors) && preg_match("/[\\da-f]{32}/i", key($sensors))) {
foreach ($sensors as $sid => $sload) {
$withnmap = in_array($sid, $ids) || $unresolved;
$sensor_object = Av_sensor::get_object($conn, $sid);
$has_vuln_scanner = 0;
if ($sensor_object !== NULL) {
$load[] = $sload;
$sensor_ip = $sensor_object->get_ip();
$has_vuln_scanner = $sensor_object->get_property('has_vuln_scanner');
$sensor_name = $sensor_ip . ' [' . $sensor_object->get_name() . ']';
$sclass = 'class="sensor_' . md5($sensor_ip) . '"';
// Sensor allowed for Selenium tests
$vsclass = 'class="vs_' . md5($sensor_ip) . '"';
// Vuln scanner for Selenium tests
$nmsclass = 'class="nms_' . md5($sensor_ip) . '"';
// Nmap Scan for Selenium tests
} else {
$load[] = 'N/A';
$sensor_name = $all_sensors[strtoupper($sid)];
示例4: _
case 'scan_status':
$av_scan = Av_scan::get_object_from_file($scan_file);
if (!is_object($av_scan) || empty($av_scan)) {
$scan_running = FALSE;
$scan_message = _('No asset scan running');
$scan_status = array('code' => 0, 'descr' => Av_scan::ST_IDLE);
$scan_status = array('message' => $scan_message, 'status' => $scan_status, 'progress' => array('percent' => 0, 'current' => 0, 'total' => 0, 'time' => 0));
} else {
//Getting scan status
$status = $av_scan->get_status();
//Getting general information
$targets = $av_scan->get_targets('scan_format');
$targets_txt = Av_scan::targets_to_string($targets);
//Database connection
list($db, $conn) = Ossim_db::get_conn_db();
$sensor = Av_sensor::get_object($conn, $av_scan->get_sensor());
$sensor_txt = $sensor->get_name() . ' [' . $sensor->get_ip() . ']';
$db->close();
$scan_status['message'] = sprintf(_('Scanning target/s: <strong>%s</strong> with sensor <strong>%s</strong>, please wait...'), $targets_txt, $sensor_txt);
$scan_status['status'] = $status['status'];
$scan_status['progress']['percent'] = round($status['scanned_targets'] / $status['number_of_targets'] * 100);
$scan_status['progress']['current'] = $status['scanned_targets'];
$scan_status['progress']['total'] = $status['number_of_targets'];
if (intval($status['remaining_time']) < 0) {
$scan_status['progress']['time'] = _('Calculating Remaining Time');
} else {
$scan_status['progress']['time'] = Welcome_wizard::format_time($status['remaining_time']) . ' ' . _('remaining');
}
}
$data['status'] = 'success';
$data['data'] = $scan_status;