Class: Arachni::Plugin::Base Abstract
- Inherits:
-
Component::Base
- Object
- Component::Base
- Arachni::Plugin::Base
- Includes:
- Component, MonitorMixin
- 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, LinkTemplate, Severity, VERSION, WEBSITE, WIKI
Instance Attribute Summary collapse
- #framework ⇒ Framework readonly
-
#options ⇒ Hash
readonly
Plugin 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
Only used when in Grid mode.
-
.gems ⇒ Array
Should return an array of plugin related gem dependencies.
-
.info ⇒ Hash
abstract
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
Merges an array of results as gathered by the plug-in when ran by multiple instances.
Instance Method Summary collapse
-
#clean_up ⇒ Object
abstract
Gets called right after #run and is used for generic clean-up.
-
#framework_abort ⇒ Object
Aborts the #framework.
-
#framework_pause ⇒ Object
Pauses the #framework.
-
#framework_resume ⇒ Object
Resumes the #framework.
- #http ⇒ Object
- #info ⇒ Object
-
#initialize(framework, options) ⇒ Base
constructor
A new instance of Base.
-
#prepare ⇒ Object
abstract
Gets called right after the plugin is initialized and it used to prepare its data.
-
#register_results(results) ⇒ Object
Registers the plugin’s results to Data::Plugins.
-
#restore(state = nil) ⇒ Object
abstract
Gets called instead of #prepare when restoring a suspended plugin.
-
#run ⇒ Object
abstract
Gets called right after #prepare and delivers the plugin payload.
- #session ⇒ Object
- #suspend ⇒ Object abstract
-
#wait_while_framework_running ⇒ Object
Will block until the scan finishes.
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(framework, options) ⇒ Base
Returns a new instance of Base.
32 33 34 35 |
# File 'lib/arachni/plugin/base.rb', line 32 def initialize( framework, ) @framework = framework @options = end |
Instance Attribute Details
#framework ⇒ Framework (readonly)
27 28 29 |
# File 'lib/arachni/plugin/base.rb', line 27 def framework @framework end |
#options ⇒ Hash (readonly)
Returns Plugin options.
24 25 26 |
# File 'lib/arachni/plugin/base.rb', line 24 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?
120 121 122 |
# File 'lib/arachni/plugin/base.rb', line 120 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`.
114 115 116 |
# File 'lib/arachni/plugin/base.rb', line 114 def self.distributable? @distributable ||= false end |
.gems ⇒ Array
Should return an array of plugin related gem dependencies.
141 142 143 |
# File 'lib/arachni/plugin/base.rb', line 141 def self.gems [] end |
.info ⇒ Hash
REQUIRED
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/arachni/plugin/base.rb', line 149 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?
126 127 128 |
# File 'lib/arachni/plugin/base.rb', line 126 def self.is_distributable distributable end |
.merge(results) ⇒ Object
REQUIRED if distributable? returns ‘true` and the plugin registers results.
Merges an array of results as gathered by the plug-in when ran by multiple instances.
135 136 |
# File 'lib/arachni/plugin/base.rb', line 135 def self.merge( results ) end |
Instance Method Details
#clean_up ⇒ Object
OPTIONAL
Gets called right after #run and is used for generic clean-up.
71 72 |
# File 'lib/arachni/plugin/base.rb', line 71 def clean_up end |
#framework_abort ⇒ Object
Aborts the #framework.
92 93 94 95 96 |
# File 'lib/arachni/plugin/base.rb', line 92 def framework_abort Thread.new do framework.abort end end |
#framework_pause ⇒ Object
Pauses the #framework.
87 88 89 |
# File 'lib/arachni/plugin/base.rb', line 87 def framework_pause @pause_id ||= framework.pause end |
#framework_resume ⇒ Object
Resumes the #framework.
99 100 101 102 |
# File 'lib/arachni/plugin/base.rb', line 99 def framework_resume return if !@pause_id framework.resume @pause_id end |
#http ⇒ Object
177 178 179 |
# File 'lib/arachni/plugin/base.rb', line 177 def http framework.http end |
#info ⇒ Object
169 170 171 |
# File 'lib/arachni/plugin/base.rb', line 169 def info self.class.info end |
#prepare ⇒ Object
OPTIONAL
Gets called right after the plugin is initialized and it used to prepare its data.
43 44 |
# File 'lib/arachni/plugin/base.rb', line 43 def prepare end |
#register_results(results) ⇒ Object
Registers the plugin’s results to Data::Plugins.
184 185 186 |
# File 'lib/arachni/plugin/base.rb', line 184 def register_results( results ) Data.plugins.store( self, results ) end |
#restore(state = nil) ⇒ Object
55 56 |
# File 'lib/arachni/plugin/base.rb', line 55 def restore( state = nil ) end |
#run ⇒ Object
REQUIRED
Gets called right after #prepare and delivers the plugin payload.
63 64 |
# File 'lib/arachni/plugin/base.rb', line 63 def run end |
#session ⇒ Object
173 174 175 |
# File 'lib/arachni/plugin/base.rb', line 173 def session framework.session end |
#wait_while_framework_running ⇒ Object
Will block until the scan finishes.
189 190 191 |
# File 'lib/arachni/plugin/base.rb', line 189 def wait_while_framework_running sleep 1 while framework.running? end |