class Arachni::Plugin::Base
An abstract class which all plugins must extend.
@author Tasos “Zapotek” Laskos <tasos.laskos@arachni-scanner.com> @abstract
Attributes
@return [Framework]
@return [Hash]
Plugin options.
Public Class Methods
Should the plug-in be distributed across all instances or only run by the master prior to any distributed operations?
# File lib/arachni/plugin/base.rb, line 127 def self.distributable @distributable = true end
@note 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`.
# File lib/arachni/plugin/base.rb, line 121 def self.distributable? @distributable ||= false end
Should return an array of plugin related gem dependencies.
@return [Array]
# File lib/arachni/plugin/base.rb, line 148 def self.gems [] end
REQUIRED
@return [Hash] @abstract
# File lib/arachni/plugin/base.rb, line 156 def self.info { name: 'Abstract plugin class', description: %q{Abstract plugin class.}, author: 'Tasos "Zapotek" Laskos <tasos.laskos@arachni-scanner.com>', 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
Should the plug-in be distributed across all instances or only run by the master prior to any distributed operations?
# File lib/arachni/plugin/base.rb, line 133 def self.is_distributable distributable end
@note REQUIRED if {.distributable?} returns ‘true` and the plugin
{#register_results registers results}.
Merges an array of results as gathered by the plug-in when ran by multiple instances.
# File lib/arachni/plugin/base.rb, line 142 def self.merge( results ) end
@param [Framework] framework @param [Hash] options
Options to pass to the plugin.
# File lib/arachni/plugin/base.rb, line 32 def initialize( framework, options ) @framework = framework @options = options end
Public Instance Methods
# File lib/arachni/plugin/base.rb, line 188 def browser_cluster framework.browser_cluster end
@note OPTIONAL
Gets called right after {#run} and is used for generic clean-up.
@abstract
# File lib/arachni/plugin/base.rb, line 78 def clean_up end
Aborts the {#framework}.
# File lib/arachni/plugin/base.rb, line 99 def framework_abort Thread.new do framework.abort end end
Pauses the {#framework}.
# File lib/arachni/plugin/base.rb, line 94 def framework_pause @pause_id ||= framework.pause( false ) end
Resumes the {#framework}.
# File lib/arachni/plugin/base.rb, line 106 def framework_resume return if !@pause_id framework.resume @pause_id end
# File lib/arachni/plugin/base.rb, line 184 def http framework.http end
# File lib/arachni/plugin/base.rb, line 176 def info self.class.info end
@note OPTIONAL
Gets called right after the plugin is initialized and is used to prepare its data or setup hooks.
This method should not block as the system will wait for it to return prior to progressing.
@abstract
# File lib/arachni/plugin/base.rb, line 46 def prepare end
Registers the plugin’s results to {Data::Plugins}.
@param [Object] results
# File lib/arachni/plugin/base.rb, line 199 def register_results( results ) Data.plugins.store( self, results ) end
@note REQUIRED
Gets called right after {#prepare} and delivers the plugin payload.
This method will be ran in its own thread, in parallel to any other system operation. However, once its job is done, the system will wait for this method to return prior to exiting.
@abstract
# File lib/arachni/plugin/base.rb, line 70 def run end
# File lib/arachni/plugin/base.rb, line 180 def session framework.session end
Will block until the scan finishes.
# File lib/arachni/plugin/base.rb, line 204 def wait_while_framework_running sleep 0.1 while framework.running? end
# File lib/arachni/plugin/base.rb, line 192 def with_browser( &block ) browser_cluster.with_browser( &block ) end