class Arachni::Reporter::Base
An abstract class for the reporters, all reporters must extend this.
@author Tasos “Zapotek” Laskos <tasos.laskos@arachni-scanner.com>
@abstract
Constants
- REPORT_FP
Where to report false positives.
Attributes
options[R]
report[R]
Public Class Methods
has_outfile?()
click to toggle source
# File lib/arachni/reporter/base.rb, line 100 def self.has_outfile? !!outfile_option end
info()
click to toggle source
@note REQUIRED
Do not omit any of the info.
# File lib/arachni/reporter/base.rb, line 110 def self.info { name: 'Reporter abstract class.', options: [], description: %q{This class should be extended by all reports.}, author: 'zapotek', version: '0.1.1', } end
new( report, options )
click to toggle source
@param [Report] report @param [Hash] options
Options to pass to the report.
# File lib/arachni/reporter/base.rb, line 35 def initialize( report, options ) @report = report @options = options end
outfile_option()
click to toggle source
# File lib/arachni/reporter/base.rb, line 120 def self.outfile_option (info[:options] || {}).find { |opt| opt.name == Options.outfile.name } end
Public Instance Methods
format_plugin_results( run = true, &block )
click to toggle source
Runs plugin formatters for the running report and returns a hash with the prepared/formatted results.
# File lib/arachni/reporter/base.rb, line 48 def format_plugin_results( run = true, &block ) # Add the PluginFormatters module to the report. eval "class #{self.class}; module PluginFormatters end; end" # Get the path to the report file, we're assuming it's the one who # called us. report_path = caller_path(1) # Prepare the directory of the formatters for the running report. lib = File.dirname( report_path ) + '/plugin_formatters/' + File.basename( report_path, '.rb' ) + '/' @@formatters ||= {} # Initialize a new component manager to handle the plugin formatters. @@formatters[shortname] ||= FormatterManager.new( lib, self.class.const_get( :PluginFormatters ) ) @@formatters[shortname].load_all if @@formatters[shortname].empty? formatted = {} @@formatters[shortname].each do |name, formatter_klass| name = name.to_sym results = report.plugins[name] next if !results || results[:results].empty? formatter = formatter_klass.new( self, report, results ) block.call( name, formatter ) if block_given? next if !run formatted[name] = formatter.run end formatted end
has_outfile?()
click to toggle source
# File lib/arachni/reporter/base.rb, line 103 def has_outfile? self.class.has_outfile? end
outfile()
click to toggle source
# File lib/arachni/reporter/base.rb, line 87 def outfile if File.directory?( options[:outfile] ) return File.expand_path "#{options[:outfile]}/" + "#{self.class.outfile_option.default}" end options[:outfile] end
run()
click to toggle source
@note REQUIRED
@abstract
# File lib/arachni/reporter/base.rb, line 43 def run end
skip_responses?()
click to toggle source
# File lib/arachni/reporter/base.rb, line 96 def skip_responses? !!options[:skip_responses] end