Class: Arachni::UI::Web::InstanceManager
- Includes:
- Utilities
- Defined in:
- lib/arachni/ui/web/instance_manager.rb
Overview
Provides methods for instance management.
@author: Tasos “Zapotek” Laskos
<[email protected]>
<[email protected]>
@version: 0.1
Instance Method Summary collapse
-
#connect(url, session = nil, token = nil) ⇒ Arachni::RPC::Client::Instance
Provides an easy way to connect to an instance.
-
#initialize(opts, settings) ⇒ InstanceManager
constructor
A new instance of InstanceManager.
Methods included from Utilities
#escape, #escape_hash, #parse_datetime, #port_to_url, #remove_proto, #unescape, #unescape_hash
Constructor Details
#initialize(opts, settings) ⇒ InstanceManager
Returns a new instance of InstanceManager.
31 32 33 34 |
# File 'lib/arachni/ui/web/instance_manager.rb', line 31 def initialize( opts, settings ) @opts = opts @settings = settings end |
Instance Method Details
#connect(url, session = nil, token = nil) ⇒ Arachni::RPC::Client::Instance
Provides an easy way to connect to an instance
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/arachni/ui/web/instance_manager.rb', line 45 def connect( url, session = nil, token = nil ) # # Sync up the session authentication tokens with the ones in the # class variables. # # This will allow users to still connect to instances even if they # shutdown the WebUI or remove their cookies. # @@tokens ||= {} session['tokens'] ||= {} if session @@tokens[url] = token if token session['tokens'].merge!( @@tokens ) if session @@tokens.merge!( session['tokens'] ) if session session['tokens'].merge!( @@tokens ) if session tmp_token = session ? session['tokens'][url] : @@tokens[url] Arachni::RPC::Client::Instance.new( @opts, url, tmp_token ) end |