Class: Arachni::Plugin::Base Abstract
- Includes:
- Arachni, Component, Module::Output, Module::Utilities
- Defined in:
- lib/arachni/plugin/base.rb
Overview
An abstract class which all plugins must extend.
Constant Summary
Constants included from Arachni
BANNER, Cookie, Form, Header, Link, Severity, VERSION, WEBSITE, WIKI
Instance Attribute Summary collapse
-
#framework ⇒ Object
readonly
Returns the value of attribute framework.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
-
.distributable ⇒ Object
Should the plug-in be distributed across all instances or only run by the master prior to any distributed operations?.
-
.distributable? ⇒ Boolean
OPTIONAL.
-
.gems ⇒ Array
Should return an array of plugin related gem dependencies.
-
.info ⇒ Object
REQUIRED.
-
.is_distributable ⇒ Object
Should the plug-in be distributed across all instances or only run by the master prior to any distributed operations?.
-
.merge(results) ⇒ Object
REQUIRED IF self.distributable? returns ‘true’ and the plugins stores results.
-
.synchronize(&block) ⇒ Object
Provides plugin-wide synchronization.
Instance Method Summary collapse
-
#clean_up ⇒ Object
OPTIONAL.
- #http ⇒ Object
-
#http_run ⇒ Object
Provides a thread-safe way to run the queued HTTP requests.
-
#initialize(framework, options) ⇒ Base
constructor
A new instance of Base.
-
#prepare ⇒ Object
OPTIONAL.
-
#register_results(results) ⇒ Object
Registers the plugin’s results with the framework.
-
#run ⇒ Object
REQUIRED.
- #session ⇒ Object
- #spider ⇒ Object
- #synchronize(&block) ⇒ Object
-
#wait_while_framework_running ⇒ Object
Will block until the scan finishes.
Methods included from Module::Utilities
Methods included from Utilities
#available_port, #cookie_encode, #cookies_from_document, #cookies_from_file, #cookies_from_response, #exception_jail, #exclude_path?, #extract_domain, #follow_protocol?, #form_decode, #form_encode, #form_parse_request_body, #forms_from_document, #forms_from_response, #generate_token, #get_path, #html_decode, #html_encode, #include_path?, #links_from_document, #links_from_response, #normalize_url, #page_from_response, #page_from_url, #parse_query, #parse_set_cookie, #parse_url_vars, #path_in_domain?, #path_too_deep?, #port_available?, #rand_port, #redundant_path?, #remove_constants, #seed, #skip_page?, #skip_path?, #skip_resource?, #to_absolute, #uri_decode, #uri_encode, #uri_parse, #uri_parser, #url_sanitize
Methods included from Module::Output
#fancy_name, #print_bad, #print_debug, #print_error, #print_info, #print_line, #print_ok, #print_status, #print_verbose
Methods included from UI::Output
#debug?, #debug_off, #debug_on, #disable_only_positives, #error_logfile, #flush_buffer, #log_error, #mute, #muted?, old_reset_output_options, #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?, reset_output_options, #set_buffer_cap, #set_error_logfile, #uncap_buffer, #unmute, #verbose, #verbose?
Methods included from Arachni
Constructor Details
#initialize(framework, options) ⇒ Base
Returns a new instance of Base.
69 70 71 72 |
# File 'lib/arachni/plugin/base.rb', line 69 def initialize( framework, ) @framework = framework @options = end |
Instance Attribute Details
#framework ⇒ Object (readonly)
Returns the value of attribute framework.
63 64 65 |
# File 'lib/arachni/plugin/base.rb', line 63 def framework @framework end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
62 63 64 |
# File 'lib/arachni/plugin/base.rb', line 62 def @options end |
Class Method Details
.distributable ⇒ Object
Should the plug-in be distributed across all instances or only run by the master prior to any distributed operations?
112 113 114 |
# File 'lib/arachni/plugin/base.rb', line 112 def self.distributable @distributable = true end |
.distributable? ⇒ Boolean
OPTIONAL
Only used when in Grid mode.
Should the plug-in be distributed across all instances or only run by the master prior to any distributed operations?
For example, if a plug-in dynamically modifies the framework options in any way and wants these changes to be identical across instances this method should return ‘false’.
105 106 107 |
# File 'lib/arachni/plugin/base.rb', line 105 def self.distributable? @distributable ||= false end |
.gems ⇒ Array
Should return an array of plugin related gem dependencies.
138 139 140 |
# File 'lib/arachni/plugin/base.rb', line 138 def self.gems [] end |
.info ⇒ Object
REQUIRED
Do not omit any of the info.
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/arachni/plugin/base.rb', line 147 def self.info { name: 'Abstract plugin class', description: %q{Abstract plugin class.}, author: 'Tasos "Zapotek" Laskos <[email protected]>', version: '0.1', options: [ # option name required? description default # Options::Bool.new( 'print_framework', [ false, 'Do you want to print the framework?', false ] ), # Options::String.new( 'my_name_is', [ false, 'What\'s you name?', 'Tasos' ] ), ], # specify an execution priority group # plug-ins will be separated in groups based on this number # and lowest will be first # # if this option is omitted the plug-in will be run last # priority: 0 } end |
.is_distributable ⇒ Object
Should the plug-in be distributed across all instances or only run by the master prior to any distributed operations?
118 119 120 |
# File 'lib/arachni/plugin/base.rb', line 118 def self.is_distributable distributable end |
.merge(results) ⇒ Object
REQUIRED IF self.distributable? returns ‘true’ and the plugins stores results.
Only used when in Grid mode.
Merges an array of results as gathered by the plug-in when run by multiple instances.
130 131 |
# File 'lib/arachni/plugin/base.rb', line 130 def self.merge( results ) end |
.synchronize(&block) ⇒ Object
Provides plugin-wide synchronization.
190 191 192 |
# File 'lib/arachni/plugin/base.rb', line 190 def self.synchronize( &block ) (@mutex ||= Mutex.new).synchronize( &block ) end |
Instance Method Details
#http ⇒ Object
176 177 178 |
# File 'lib/arachni/plugin/base.rb', line 176 def http framework.http end |
#http_run ⇒ Object
Provides a thread-safe way to run the queued HTTP requests.
183 184 185 |
# File 'lib/arachni/plugin/base.rb', line 183 def http_run synchronize { http.run } end |
#register_results(results) ⇒ Object
Registers the plugin’s results with the framework.
202 203 204 |
# File 'lib/arachni/plugin/base.rb', line 202 def register_results( results ) framework.plugins.register_results( self, results ) end |
#session ⇒ Object
172 173 174 |
# File 'lib/arachni/plugin/base.rb', line 172 def session framework.session end |
#spider ⇒ Object
168 169 170 |
# File 'lib/arachni/plugin/base.rb', line 168 def spider framework.spider end |
#synchronize(&block) ⇒ Object
193 194 195 |
# File 'lib/arachni/plugin/base.rb', line 193 def synchronize( &block ) self.class.synchronize( &block ) end |