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

Returns a new instance of ActiveOptions.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/arachni/rpc/server/active_options.rb', line 29

def initialize( framework )
    @opts = framework.opts

    %w( url http_req_limit http_timeout user_agent redirect_limit proxy_username
        proxy_password proxy_type proxy_host proxy_port authed_by cookies
        cookie_string http_username http_password ).each do |m|
        m = "#{m}=".to_sym
        self.class.class_eval do
            define_method m do |v|
                @opts.send( m, v )
                HTTP.reset false
                v
            end
        end
    end

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

end

Instance Method Details



78
79
80
81
# File 'lib/arachni/rpc/server/active_options.rb', line 78

def cookie_jar=( cookie_jar )
    HTTP.update_cookies( cookie_jar )
    @cookie_jar = cookie_jar
end

#proxy=(proxy_url) ⇒ Object



70
71
72
73
74
75
76
# File 'lib/arachni/rpc/server/active_options.rb', line 70

def proxy=( proxy_url )
    @opts.proxy_host, @opts.proxy_port = proxy_url.to_s.split( /:/ )
    @opts.proxy_port = @opts.proxy_port.to_i

    HTTP.reset false
    @opts.proxy = proxy_url
end

#set(options) ⇒ Object

See Also:



56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/arachni/rpc/server/active_options.rb', line 56

def set( options )
    options.each do |k, v|
        begin
            send( "#{k.to_s}=", v )
        rescue => e
            #ap e
            #ap e.backtrace
        end
    end

    HTTP.reset false
    true
end