Class: Prenus::Output::Xlsout
Instance Method Summary collapse
-
#initialize(events, hosts, options) ⇒ Object
constructor
Initialises the Xlsout class into an object.
-
#run ⇒ Object
Run the Xmlout class - this will generate HTML file called .xls to the target folder.
Constructor Details
#initialize(events, hosts, options) ⇒ Object
Initialises the Xlsout class into an object
20 21 22 |
# File 'lib/output/xlsout.rb', line 20 def initialize(events,hosts,) super end |
Instance Method Details
#run ⇒ Object
Run the Xmlout class - this will generate HTML file called .xls to the target folder
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/output/xlsout.rb', line 33 def run # File.open(@options[:outputdir] + "/out.xls", 'w') do |f| @oFile.syswrite "<table border=1>\n" @oFile.syswrite "<tr><th>Nessus Plugin ID</th><th>Severity</th><th>Plugin Name</th><th>Synopsis</th><th>Description</th><th>Solution</th><th>Hosts</th></tr>\n" @events.each do |k,v| @oFile.syswrite "<tr><td>" + k.to_s + "</td><td>" + v[:severity].to_s + "</td><td>" + v[:plugin_name] + "</td><td>" + v[:synopsis] + "</td><td>" + v[:description] + "</td><td>" + v[:solution].to_s + "</td>" @oFile.syswrite "<td>" impacted_hosts = [] v[:ports].each {|k,v| v[:hosts].each do |h,w| impacted_hosts << h end } impacted_hosts.uniq.each do |host| @oFile.syswrite @hosts[host][:ip] + "\n" end @oFile.syswrite "</td></tr>\n" end @oFile.syswrite "</table>\n" # end end |