} pclose($handle); $read = "Scan of {$client_ip} Complete!"; fwrite($fp_log, $read . "\n"); if ($javascript) { echo "<script type='text/javascript'>" . "document.getElementById('processing_steps').innerHTML = \"<span style='color: #000;'>" . "<div class='percentbox2'>{$read}</div><br><br>" . "</span>\";\n" . "</script>"; } else { echo "<div class='percentbox' style='z-index: 0; background-image(\"../images/white.png\"); height: 40px;'>" . " " . "</div>"; @ob_end_flush(); flush(); echo "<div class='percentbox' style='z-index: 0;'>{$read}</div>"; } @ob_end_flush(); flush(); $_nes = new Nessus($output); $output = trim($_nes->output_html('', true, true)); // Must replace newlines so javascript wont break $output = str_replace("\n", "", $output); if ($javascript) { echo "<script type='text/javascript'>" . "document.getElementById('processing_output').innerHTML = \"<span style='color: #000;'>{$output}</span>\";\n" . "</script>"; } else { echo "</div><br><br><br><br>"; echo $output; echo "</body></html>"; } @ob_end_flush(); flush(); $time = date("m-d-Y-H:i:s", time()); syslog(LOG_INFO, "ScanMeNow: Finished {$logtype} on {$client_ip} at {$time}"); fwrite($fp_log, "ScanMeNow: Finished {$logtype} on {$client_ip} at {$time}\n"); fclose($fp_log);
$content = $stmt1->result(0); if ($format == "default") { $stmt2->execute($profile_id, $username); $format = $stmt2->result(0); } if ($format == 'txt') { /** * The 'false' here means that the html or text is not embedded * so nessquik will not strip off the HTML,HEAD,BODY etc tags, * and will not replace newline (\n) chars in the text format * with <br> tags */ $output = $nes->output_text($content, false); $ext = 'txt'; } elseif ($format == 'html') { $output = $nes->output_html($content, false); $ext = 'html'; } else { if ($format == 'nbe') { $output = $nes->output_nbe($content, false); $ext = 'nbe'; } } /** * The empty field is the alternate recipients list. * The $ext value in the function call will work fine as long * as I dont changet the 'html' string above because that * is how the send_email function determines if it should * send HTML mail or text mail */ send_email($email, '', "Nessus Scan Results", $output, $ext);
if (count($machine_list) > 2) { $subject = str_replace("%m", $machine_list[0] . ',' . $ok_computers[1] . '...', $subject); } elseif (count($machine_list) > 1) { $subject = str_replace("%m", $machine_list[0] . ' and ' . $machine_list[1], $subject); } else { $subject = str_replace("%m", $machine_list[0], $subject); } $subject = str_replace("%D", $start_date, $subject); $subject = str_replace("%d", $end_date, $subject); $subject = str_replace("%T", $start_time, $subject); $subject = str_replace("%t", $end_time, $subject); if ($format == 'txt') { $output = $nes->output_text($output); } else { if ($format == 'html') { $output = $nes->output_html($output); } else { if ($format == 'nbe') { $output = $nes->output_nbe($output); } } } if (_DEBUG) { fwrite($dfh, "\nEmailing scan results"); } // If there are multiple recipients, then they need to have email sent to them if (count($recipients) > 0) { if (!$client->query('jobs.emailResults', _CLIENT_KEY, $profile_id, $recipients, $subject, $output, $format)) { die($client->getErrorCode() . ' : ' . $client->getErrorMessage()); } } else {