Module: PWN::Reports::CSV
- Defined in:
- lib/pwn/reports/csv.rb
Overview
Generic CSV report writer for pentest / findings payloads.
Class Method Summary collapse
Class Method Details
.authors ⇒ Object
29 30 31 |
# File 'lib/pwn/reports/csv.rb', line 29 public_class_method def self. "AUTHOR(S):\n 0day Inc. <[email protected]>\n" end |
.generate(opts = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/pwn/reports/csv.rb', line 9 public_class_method def self.generate(opts = {}) out = PWN::Reports.resolve_path(opts.merge(ext: 'csv')) payload = PWN::Reports.report_payload(opts) rows = payload[:findings] headers = %w[id title severity cvss epss description poc impact recommendation] extra = rows.flat_map(&:keys).uniq - headers cols = (headers + extra).uniq ::CSV.open(out, 'w') do |csv| csv << cols if rows.empty? csv << cols.map { |col| col == 'title' ? payload[:title] : nil } else rows.each do |row| csv << cols.map { |col| row[col] } end end end out end |
.help ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/pwn/reports/csv.rb', line 33 public_class_method def self.help puts "USAGE: # Run generate and return its result #{self}.generate # Print the AUTHOR(S) string for this module. #{self}.authors " constants.sort end |