Skip to content

Instantly share code, notes, and snippets.

@vanhecke
Last active June 19, 2017 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vanhecke/f2b7b03f611c35114f17282b6418467f to your computer and use it in GitHub Desktop.
Save vanhecke/f2b7b03f611c35114f17282b6418467f to your computer and use it in GitHub Desktop.
Convert .nessus file(s) to a CSV using mephux/ruby-nessus.
require 'rubygems'
require 'nessus'
require 'csv'
csv = CSV.open("results.csv", "w", force_quotes: true)
csv << ['Plugin ID','CVE','CVSS','Risk','Host','Protocol','Port','Name','Synopsis','Description','Solution','See Also','Plugin Output']
Dir.glob('/PATH_TO_FILE(S)/*.nessus').each do |nessus_file|
Nessus::Parse.new(nessus_file) do |scan|
puts "#{scan.title} (#{scan.host_count})"
scan.each_host do |host|
next if host.event_count.zero? # Skip if zero vulnerabilities.
puts host.ip
host.each_event do |event|
csv << [
event.id,
event.cve,
event.cvss_base_score,
event.risk,
host.ip,
event.port.protocol,
event.port.number,
event.plugin_name,
event.synopsis,
event.description,
event.solution,
event.see_also,
event.output
]
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment