Class: Arachni::Report::Base Abstract
- Includes:
- UI::Output
- Defined in:
- lib/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
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.
-
#run ⇒ Object
REQUIRED.
Methods included from UI::Output
#buffer, #debug!, #debug?, #flush_buffer, #mute!, #muted?, #only_positives!, #only_positives?, #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?, #unmute!, #verbose!, #verbose?
Class Method Details
.info ⇒ Object
REQUIRED
Do not ommit any of the info.
102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/report/base.rb', line 102 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', } 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.
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 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/report/base.rb', line 61 def format_plugin_results( 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 formatted = {} @@formatters[ancestor].each_pair { |name, formatter| plugin_results = plugins[name] next if !plugin_results || plugin_results[:results].empty? formatted[name] = formatter.new( plugin_results.deep_clone ).run } return formatted end |