Here is the script I use. It may or may not be helpful to you. You'll need to change the email addresses, servername and login name and password for your Nessusd
#!/bin/bash # Contact Chris <[EMAIL PROTECTED]> for support with this file. # Generates a nessus scan and emails the report. echo "Getting the date" DATE=`/bin/date +%G%m%d` # Run the scan. echo "Running the scan" /usr/local/bin/nessus -T nsr -q nessusserver 1241 loginname password /usr/local/etc/nessus/nessusd.targets /root/nessus-scans/results.$DATE.nsr # Generate HTML reports from output echo "Generating the report" /usr/local/bin/nessus -T html -i /root/nessus-scans/results.$DATE.nsr -o /var/www/html/nessus-scans/$DATE.html echo "Generating the graph" /usr/local/bin/nessus -T html_graph -i /root/nessus-scans/results.$DATE.nsr -o /var/www/html/nessus-scans/$DATE.graph # Fix permissions echo "Fixing permissions on the report" chmod 755 /var/www/html/nessus-scans/$DATE.graph # Create Outbound Email. echo "Creating outbound email" echo "To: Me <[EMAIL PROTECTED]>" > /tmp/$DATE.email echo "Subject: Weekly Nessus Scan for $DATE" >> /tmp/$DATE.email echo "Content-Type: text/html; charset=\"us-ascii\"" >> /tmp/$DATE.email echo "" >> /tmp/$DATE.email cat /var/www/html/nessus-scans/$DATE.html >> /tmp/$DATE.email # Mail the report. echo "Mailing report" /usr/sbin/sendmail [EMAIL PROTECTED] < /tmp/$DATE.email -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kaplan, Andrew H. Sent: Thursday, January 20, 2005 10:33 AM To: [email protected] Subject: Setting Up Automated Scans Is there a way to set up non-interactive, or automated scans of multiple hosts? If so, how is it done? Thanks. _______________________________________________ Nessus mailing list [email protected] http://mail.nessus.org/mailman/listinfo/nessus _______________________________________________ Nessus mailing list [email protected] http://mail.nessus.org/mailman/listinfo/nessus
