# frozen_string_literal: true require 'json' module PWN module Reports # This plugin generates Fuzz results from PWN::Plugins::Fuzz. # Two files are created, a JSON file containing all of the # Fuzz results and an HTML file which is essentially the UI # for the JSON file. module Fuzz # Supported Method Parameters:: # PWN::Reports::Fuzz.generate( # dir_path: dir_path, # results_hash: results_hash, # char_encoding: 'optional - character encoding returned by PWN::Plugins::Char.list_encoders (defaults to UTF-8)' # ) public_class_method def self.generate(opts = {}) dir_path = opts[:dir_path].to_s if File.directory?(opts[:dir_path].to_s) raise "PWN Error: Invalid Directory #{dir_path}" if dir_path.nil? results_hash = opts[:results_hash] report_name = results_hash[:report_name] opts[:char_encoding].nil? ? char_encoding = 'UTF-8' : char_encoding = opts[:char_encoding].to_s # JSON object Completion File.open("#{dir_path}/#{report_name}.json", "w:#{char_encoding}") do |f| f.print( JSON.pretty_generate(results_hash).force_encoding(char_encoding) ) end # Report All the Bugs!!! \o/ html_report = %q{
# | Timestamp | Request | Request Encoding | Request Length | Response | Response Length |
---|