Generating vulnerability reports in NSE scripts
NSE is perfect for detecting vulnerabilities, and for this reason, there are already several exploitation scripts included with Nmap. Not too long ago, each developer used their criteria for what output to include when reporting these vulnerabilities. To address this issue and unify the output format and the amount of information provided, a new NSE library was introduced.
This recipe will teach you how to generate vulnerability reports in your NSE scripts with the vulns library.
How to do it...
The correct way to report vulnerabilities in NSE is through the vulns library. Let's review the process of reporting a vulnerability:
- Load the
vulnslibrary in your script:local vulns = require 'vulns'
- Create a
vulnobject table. Pay special attention to thestatefield:local vuln = { title = '<TITLE GOES HERE>', state = vulns.STATE.NOT_VULN, references = {'<URL1>', &apos...