Class: Arachni::Reporter::Base Abstract
- Inherits:
-
Component::Base
- Object
- Component::Base
- Arachni::Reporter::Base
- Includes:
- Arachni::Reporter
- Defined in:
- lib/arachni/reporter/base.rb
Overview
An abstract class for the reporters, all reporters must extend this.
Defined Under Namespace
Modules: PluginFormatters
Constant Summary collapse
- REPORT_FP =
Where to report false positives.
'http://github.com/Arachni/arachni/issues'
Constants included from Arachni
BANNER, Cookie, Form, Header, Link, LinkTemplate, Severity, VERSION, WEBSITE, WIKI
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#report ⇒ Object
readonly
Returns the value of attribute report.
Class Method Summary collapse
- .has_outfile? ⇒ Boolean
-
.info ⇒ Object
Do not omit any of the info.
- .outfile_option ⇒ Object
Instance Method Summary collapse
-
#format_plugin_results(run = true, &block) ⇒ Object
Runs plugin formatters for the running report and returns a hash with the prepared/formatted results.
- #has_outfile? ⇒ Boolean
-
#initialize(report, options) ⇒ Base
constructor
A new instance of Base.
- #outfile ⇒ Object
- #run ⇒ Object abstract
- #skip_responses? ⇒ Boolean
Methods inherited from Component::Base
author, description, fullname, #shortname, shortname, shortname=, version
Methods included from Component::Utilities
Methods included from Utilities
#available_port, #caller_name, #caller_path, #cookie_decode, #cookie_encode, #cookies_from_document, #cookies_from_file, #cookies_from_response, #exception_jail, #exclude_path?, #follow_protocol?, #form_decode, #form_encode, #forms_from_document, #forms_from_response, #generate_token, #get_path, #hms_to_seconds, #html_decode, #html_encode, #include_path?, #links_from_document, #links_from_response, #normalize_url, #page_from_response, #page_from_url, #parse_set_cookie, #path_in_domain?, #path_too_deep?, #port_available?, #rand_port, #random_seed, #redundant_path?, #remove_constants, #request_parse_body, #seconds_to_hms, #skip_page?, #skip_path?, #skip_resource?, #skip_response?, #to_absolute, #uri_decode, #uri_encode, #uri_parse, #uri_parse_query, #uri_parser, #uri_rewrite
Methods included from Component::Output
#depersonalize_output, #depersonalize_output?, #intercept_print_message
Methods included from UI::Output
#debug?, #debug_off, #debug_on, #disable_only_positives, #included, #mute, #muted?, #only_positives, #only_positives?, #print_bad, #print_debug, #print_debug_backtrace, #print_debug_level_1, #print_debug_level_2, #print_debug_level_3, #print_error, #print_error_backtrace, #print_exception, #print_info, #print_line, #print_ok, #print_status, #print_verbose, #reroute_to_file, #reroute_to_file?, reset_output_options, #unmute, #verbose?, #verbose_on
Methods included from Arachni
URI, jruby?, null_device, profile?, windows?
Constructor Details
#initialize(report, options) ⇒ Base
Returns a new instance of Base.
35 36 37 38 |
# File 'lib/arachni/reporter/base.rb', line 35 def initialize( report, ) @report = report @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
29 30 31 |
# File 'lib/arachni/reporter/base.rb', line 29 def @options end |
#report ⇒ Object (readonly)
Returns the value of attribute report.
30 31 32 |
# File 'lib/arachni/reporter/base.rb', line 30 def report @report end |
Class Method Details
.has_outfile? ⇒ Boolean
100 101 102 |
# File 'lib/arachni/reporter/base.rb', line 100 def self.has_outfile? !!outfile_option end |
.info ⇒ Object
REQUIRED
Do not omit any of the info.
110 111 112 113 114 115 116 117 118 |
# 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 |
Instance Method Details
#format_plugin_results(run = true, &block) ⇒ Object
Runs plugin formatters for the running report and returns a hash with the prepared/formatted results.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# 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? ⇒ Boolean
103 104 105 |
# File 'lib/arachni/reporter/base.rb', line 103 def has_outfile? self.class.has_outfile? end |
#outfile ⇒ Object
87 88 89 90 91 92 93 94 |
# File 'lib/arachni/reporter/base.rb', line 87 def outfile if File.directory?( [:outfile] ) return File. "#{[:outfile]}/" + "#{self.class.outfile_option.default}" end [:outfile] end |
#run ⇒ Object
REQUIRED
43 44 |
# File 'lib/arachni/reporter/base.rb', line 43 def run end |
#skip_responses? ⇒ Boolean
96 97 98 |
# File 'lib/arachni/reporter/base.rb', line 96 def skip_responses? !![:skip_responses] end |