$text = _("No reports found"); $to_text = sprintf("\n\t%s\n\n", $text); echo $to_text; exit; } $db->close($conn); echo "\n\n"; Util::execute_command("rm -f /var/tmp/logscheduler_err"); foreach ($scheduled_reports as $value) { $id_sched = $value['id']; $output = null; $to_text = null; // Login $user = $value['user']; $conn = $db->connect(); $pass = getUserWeb($conn, $value['user']); $pass_sha = $pass; // Don't know if pass is in md5 or sha256, external_login will try both $passEncript = getKeyEncript($conn); $login = base64_encode(Util::encrypt($user . '####' . $pass . '####' . $pass_sha, $passEncript)); $uuid = Session::get_secure_id($user); $db->close($conn); $cmd_login = '******'; $params_login = array('AV Report Scheduler [' . $id_sched . ']', $cookieName, 'login='******'/index.php'); $cmd_logout = 'wget -U ? -t 1 --timeout=43200 --no-check-certificate --cookies=on --keep-session-cookies --load-cookies=? ? -O /dev/null 2>> /var/tmp/logscheduler_err'; $params_logout = array('AV Report Scheduler [' . $id_sched . ']', $cookieName, $server . '/session/login.php?action=logout'); $output = Util::execute_command($cmd_login, $params_login, 'array'); $result = searchString($output, $info_text[0]); if ($result == true) { $to_text = sprintf("\n%-15s\n\n", _('ERROR: Wrong User & Password')); echo $to_text;
return false; } return $next_launch; } // end functions // Get database connection $db = new ossim_db(); $conn = $db->connect(); //Errors text $info_text = array(_('Wrong User & Password'), _('Invalid address'), _('No assets found')); $server = trim(`grep ^framework_ip= /etc/ossim/ossim_setup.conf | cut -f 2 -d "="`); $https = trim(`grep ^framework_https= /etc/ossim/ossim_setup.conf | cut -f 2 -d "="`); $urlPdf = '/usr/share/ossim/www/tmp/scheduler'; $server = 'http' . ($https == "yes" ? "s" : "") . '://' . $server . '/ossim'; $user = '******'; $pass = base64_encode(getUserWeb($conn)); $cookieName = date('YmdHis') . rand() . '.txt'; system("clear"); $to_text .= "\n\n" . _('Date (UTC)') . ': ' . gmdate("Y-m-d H:i:s") . "\n\n"; $to_text .= _('Starting Report Scheduler') . "...\n\n"; $uuid = get_report_uuid($conn, $user); // Run reports $report_list = getScheduler($conn); $scheduled_reports = array(); $text = _('Searching scheduled reports') . "...\n"; $to_text .= sprintf("\n%s", $text); echo $to_text; $i = 0; foreach ($report_list as $k => $value) { $run = checkTimeExecute($value['next_launch']); if ($run) {