Class: Arachni::RPC::Server::ActiveOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/arachni/rpc/server/active_options.rb

Overview

It, for the most part, forwards calls to Options and intercepts a few that need to be updated at other places throughout the framework.

Author:

Instance Method Summary collapse

Constructor Details

#initialize(framework) ⇒ ActiveOptions



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/arachni/rpc/server/active_options.rb', line 20

def initialize( framework )
    @options = framework.options

    %w( url http_request_concurrency http_request_timeout http_user_agent
        http_request_redirect_limit http_proxy_username http_proxy_password
        http_proxy_type http_proxy_host http_proxy_port authorized_by
        http_cookies http_cookie_string http_authentication_username
        http_authentication_password ).each do |m|
        m = "#{m}=".to_sym
        self.class.class_eval do
            define_method m do |v|
                @options.send( m, v )
                HTTP::Client.reset false
                v
            end
        end
    end

    (@options.public_methods( false ) - public_methods( false ) ).each do |m|
        self.class.class_eval do
            define_method m do |*args|
                @options.send( m, *args )
            end
        end
    end

end

Instance Method Details

#http_proxy=(proxy_url) ⇒ Object



55
56
57
58
59
60
61
# File 'lib/arachni/rpc/server/active_options.rb', line 55

def http_proxy=( proxy_url )
    @options.http.proxy_host, @options.http.proxy_port = proxy_url.to_s.split( ':' )
    @options.http.proxy_port = @options.http.proxy_port.to_i

    HTTP::Client.reset false
    @options.http.proxy = proxy_url
end

#set(options) ⇒ Object

See Also:



49
50
51
52
53
# File 'lib/arachni/rpc/server/active_options.rb', line 49

def set( options )
    @options.set( options )
    HTTP::Client.reset false
    true
end

#to_hObject



63
64
65
# File 'lib/arachni/rpc/server/active_options.rb', line 63

def to_h
    @options.to_rpc_data
end