Class: Arachni::Report::Base Abstract
- Includes:
- Module::Utilities, UI::Output
- Defined in:
- lib/arachni/report/base.rb
Overview
Arachni::Report::Base class
An abstract class for the reports.<br/> All reports must extend this.
@author: Tasos “Zapotek” Laskos
<[email protected]>
<[email protected]>
@version: 0.1.1
Defined Under Namespace
Modules: PluginFormatters
Constant Summary collapse
- REPORT_FP =
where to report false positives <br/> info about this should be included in all templates
'http://github.com/Zapotek/arachni/issues'
Class Method Summary collapse
-
.info ⇒ Object
REQUIRED.
Instance Method Summary collapse
-
#format_plugin_results(plugins) ⇒ Object
Runs plugin formatters for the running report and returns a hash with the prepared/formatted results.
-
#initialize(audit_store, options) ⇒ Base
constructor
A new instance of Base.
-
#run ⇒ Object
REQUIRED.
Methods included from Module::Utilities
#exception_jail, #get_path, #hash_keys_to_str, #normalize_url, #read_file, #seed, #uri_decode, #uri_encode, #uri_parse, #uri_parser, #url_sanitize
Methods included from UI::Output
#buffer, #debug!, #debug?, #flush_buffer, #mute!, #muted?, #only_positives!, #only_positives?, #print_bad, #print_debug, #print_debug_backtrace, #print_debug_pp, #print_error, #print_error_backtrace, #print_info, #print_line, #print_ok, #print_status, #print_verbose, #reroute_to_file, #reroute_to_file?, #uncap_buffer!, #unmute!, #verbose!, #verbose?
Constructor Details
#initialize(audit_store, options) ⇒ Base
Returns a new instance of Base.
84 85 86 87 |
# File 'lib/arachni/report/base.rb', line 84 def initialize( audit_store, ) @audit_store = audit_store @options = end |
Class Method Details
.info ⇒ Object
REQUIRED
Do not ommit any of the info.
146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/arachni/report/base.rb', line 146 def self.info { :name => 'Report abstract class.', :options => [ # option name required? description default # Arachni::OptBool.new( 'html', [ false, 'Include the HTML responses in the report?', true ] ), # Arachni::OptBool.new( 'headers', [ false, 'Include the headers in the report?', true ] ), ], :description => %q{This class should be extended by all reports.}, :author => 'zapotek', :version => '0.1.1', } end |
Instance Method Details
#format_plugin_results(plugins) ⇒ Object
Runs plugin formatters for the running report and returns a hash with the prepared/formatted results.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/arachni/report/base.rb', line 102 def format_plugin_results( plugins ) formatted = {} return formatted if !plugins # get the object that extends this class (i.e. the running report) ancestor = self.class.ancestors[0] # add the PluginFormatters module to the report eval( "class " + ancestor.to_s + "\n module PluginFormatters end \n end" ) # get the path to the report file # this is a very bad way to do it... report_path = ::Kernel.caller[0].match( /^(.+?):(\d+)(?::in `(.*)')?/ )[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[ancestor] ||= FormatterManager.new( lib, ancestor.const_get( 'PluginFormatters' ) ) # load all the formatters @@formatters[ancestor].load( ['*'] ) if @@formatters[ancestor].empty? # run the formatters and gather the formatted data they return @@formatters[ancestor].each_pair { |name, formatter| plugin_results = plugins[name] next if !plugin_results || plugin_results[:results].empty? exception_jail( false ) { formatted[name] = formatter.new( plugin_results.deep_clone ).run } } return formatted end |