function check_parameters($report_id, $parameters, $section) { $res['error'] = FALSE; $res['error_msg'] = NULL; $d_reports = $section == 'forensics' ? get_freport_data($report_id) : get_report_data($report_id); if (empty($d_reports)) { $res['error'] = TRUE; $res['error_msg'][] = _('The report has been removed'); return $res; } if (!empty($d_reports['parameters'])) { foreach ($d_reports['parameters'] as $data_p) { $type = $data_p['type']; $data = $type == 'asset' ? 'h_' . $parameters[$data_p['id']] : $parameters[$data_p['id']]; $val = validate_parameter($type, $data); if ($val !== TRUE) { $res['error'] = TRUE; $res['error_msg'][] = $data_p['name'] . ': ' . $val; } } } return $res; }
echo "error###<div style='padding-left: 15px; text-align:left;'>" . _('We found the followings errors') . ':</div>'; echo "<div style='padding-left: 15px; text-align:left;'>"; echo "<div style='padding-left: 30px;'>" . implode('</div><div style="padding-left: 30px;">', $chk_parameters['error_msg']) . "</div>"; echo "</div>"; exit; } Session::logcheck('report-menu', 'ReportsReportServer'); $TBackground = "#7B7B7B"; $TForeground = "#FFFFFF"; $SBackground = "#8CC221"; $SForeground = "#FFFFFF"; // Load css $styleCss = array('Title' => array('Background' => $TBackground, 'Foreground' => $TForeground), 'Subtitle' => array('Background' => $SBackground, 'Foreground' => $SForeground)); // Make header - footer with replacements $footerContent = array('left' => 'User: '******' / [[date_y]]-[[date_m]]-[[date_d]] [[date_h]]:[[date_i]]:[[date_s]]', 'right' => 'Page [[page_cu]] / [[page_nb]]'); $report_data = $section == 'forensics' ? get_freport_data($report_id) : get_report_data($report_id); // Init PDF Report $pdfReport = new Pdf_report($report_id, 'P', 'A4', NULL, FALSE); // Init html2pdf document //$header = ucwords(str_replace('_',' ',$pdfReport->getName())); $htmlPdfReport = new Pdf_html($report_id, $report_data['report_name'], Session::is_pro() ? 'default.png' : 'ossim.png', '', $styleCss, $footerContent); // Include php per each sub-report $runorder = 1; // Close session to stop() feature $dDB['_shared'] = new DBA_shared($report_id); $dDB['_shared']->truncate(); session_write_close(); foreach ($report_data['subreports'] as $r_key => $r_data) { //PDF Report with hidden modules if (!isset($_POST['sr_' . $r_data['id']]) && $report_id == $r_data["id"] && file_exists($r_data['report_file'])) { $subreport_id = $r_data['id'];
* * * 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 'av_init.php'; require_once 'os_report_common.php'; Session::logcheck('report-menu', 'ReportsReportServer'); $_DEBUG = FALSE; // Connect BD $db = new ossim_db(); $conn = $db->connect(); $d_reports = get_report_data(); //Load available nets, hosts and netgroups $autocomplete_keys = array('hosts', 'host_groups', 'nets'); $assets = Autocomplete::get_autocomplete($conn, $autocomplete_keys); $db->close(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title> <?php echo _('OSSIM Framework'); ?> </title> <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/> <meta http-equiv="Pragma" content="no-cache"/>
function insertMultipeReports() { // This creates multiple reports and saves them global $tool, $form, $report_types; $from = $_POST['date1']; $to = $_POST['date2']; $name = $_POST['name']; if ($name == '') { $form->warning("Invalid Name, can not be empty"); return false; } // Check From date if (is_numeric($from) && date($from)) { $start_stamp = date($from); } elseif ($from != '' && strtotime($from)) { $start_stamp = strtotime($from); } else { $form->warning("Invalid start date {$from}"); return false; } // Check To date if (is_numeric($to) && date($to)) { $end_stamp = date($to); } elseif ($to != '' && strtotime($to)) { $end_stamp = strtotime($to); } else { $form->warning("Invalid End date {$to}"); return false; } flush(); $i = 1; $total = count($_POST[profile_id]); print "<p><b>Creating {$total} reports for {$name}, please be patient as this may take a few minutes<br></p></b>"; flush(); foreach ($_POST[profile_id] as $profile_id) { $profile = new CheckReportProfile($profile_id); print "creating report {$i} of {$total}: " . $profile->get_name() . " Type (" . $profile->get_report_type() . ").<br>"; flush(); $report_checks = array(); foreach ($profile->get_checks() as $check_id => $check_name) { array_push($report_checks, $check_id); } $report_type = $profile->get_report_type(); $timers = get_report_data($start_stamp, $end_stamp, $report_type, $report_checks); $report = new Report(); $report->set_name($name); $report->set_profile_id($profile_id); $report->set_report_type($profile->get_report_type()); $report->set_start_time($from); $report->set_end_time($to); $report->set_ok_secs($timers[ok]); $report->set_warning_secs($timers[warning]); $report->set_critical_secs($timers[critical]); $report->set_unknown_secs($timers[unknown]); $report->set_other_secs($timers[other]); $report->set_no_data_secs($timers[no_data]); $new_id = $report->insert(); if (is_numeric($new_id)) { //print "new is is $new_id<br>"; } else { print "insert failed! reason: " . $report->get_error() . "<br>"; } $i++; } print "<br><br>Done! You're reports are available here: <a href='" . $_SERVER['PHP_SELF'] . "?action=display_reports_by_name&name={$name}'> Availability Report {$name}</a><br>"; }
function render_msr_report($start_date, $end_date) { global $reporting_framework_render; global $parameters; foreach ($parameters as $parameter) { global ${$parameter}; } $content = ""; if (!isset($start_date) || !isset($end_date) || $start_date == NULL || $end_date == NULL) { $report = get_report_data(); } else { $report = get_msr_report($start_date, $end_date); } $reporting_list = new Template(); $reporting_list->load('report_msr_list'); $reporting_list_render['report_rows'] = ''; $report_row = new Template(); $report_row->load('report_msr_row'); $report_row_render['name'] = ''; $report_row_render['amount'] = ''; if ($report != null) { foreach ($report as $name => $amount) { $report_row_render['name'] = $name; $report_row_render['amount'] = $amount; $report_row->set_vars($report_row_render); $report_row->parse(); $content .= $report_row->final; } } $reporting_list_render['report_rows'] = $content; $reporting_list->set_vars($reporting_list_render); $reporting_list->parse(); $reporting_framework_render['content'] = $reporting_list->final; render_all(); }