Skip to content

Instantly share code, notes, and snippets.

@vanhecke

vanhecke/convert.rb

Last active Jun 19, 2017
Embed
What would you like to do?
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