I recently needed to implement automated email reporting for Nessus , the popular vulnerability scanner from Tenable. I figured that I would just log into the nessus server and click the little check box that says "Enable Nessus email reporting" and then proceed to fill in the email addresses and the type of reports I wanted it to email. Unfortunately Nessus does not currently have this feature in their product. Perhaps I am expecting too much from them, but it seems to me that email reporting would be a very obvious feature that many of their customers would need. They recently updated their interface and, in my opinion, the new interface is much better at clearly communicating risk, but I believe that automated email reporting would be a very beneficial feature to their product as a whole. Here is my reasoning:
From what I can tell, a good security product(or any type of product for that matter) once implemented in an environment, can easily be forgotten about if that particular product does not stay visible. People get busy and new cool products come out all the time, so a company that is trying to stay on top of the latest trends is constantly put in a place of modifying and updating products and software. I would imagine for most companies, one of the first things each employee does in the mornings is check their email. It is a centralized location for daily communication within the business. An automated email report that is delivered to your inbox whenever a Nessus scan has been completed would be an excellent way for that product to stay visible to all employees who are even remotely associated with it. Even if simply for the purpose of reminding employees to take a closer look at the scans.
Eventually I quit complaining and viewed this as another great opportunity to work on scripting. I would just have to write a script that would automatically generate reports based on scans and email them to the person(s) of my choosing. As I have been writing a fair amount of Bash shell scripts(and given that I am pretty sure just about anything on the web can be automated with some combination of cURL, sed, and grep), I figured I might as well use a shell script to do the job.
After some initial research, I found out that a reasonable amount of other Nessus users ran into the same problem I had. One such user posted this spirited comment on the Nessus forum:
"We are a feed customer and need an emailed-report feature. Otherwise
someone has to log in manually to check the reports and we'll remember
that annoyance at renewal time rather than the other great features
Nessus provides."
To give Tenable credit, their lead developer posted a reply saying "Development is in progress".
Let me be clear. I am not a software architect, nor do I know what it takes to run a software company, nor am I an expert programmer. I simply was in need of a feature that, in my humble opinion, seemed like an obvious one to have given the type of product that Nessus is.
I relied heavily on this awesome article to become familiar with the XMLRPC interface used to communicate with the Nessus server.
This is the script I ended up with. It is nothing special, and is probably not nearly as efficient as it could be, but it was my quick and dirty solution to what I needed. Throw this in a cron job to run on the days that your scans run and you will have basic email reporting. You can check it out here.
Your script has a hardcoded Ip address in it:
ReplyDeletewget --quiet --post-data "report=$cleanreportid&chapters=vuln_by_plugin&format=html&token=$key" --no-check-certificate https://172.16.88.33/chapter? -O - > test.html
Thanks for the heads up! It has been changed.
DeleteThis comment has been removed by the author.
ReplyDeleteline 41 > sed "s%url=%url=https://$i%g" test.html > test2.html
Deleteit should be $1%g
thanks for sharing your script
Thanks for catching that. It has been changed to $1.
Delete