Sha256: e6d891635fd56c8292cdc95e12b2d8e894213aa9093692d20dde7f09f3d6ae3b

Contents?: true

Size: 1.99 KB

Versions: 7

Compression:

Stored size: 1.99 KB

Contents

=begin
    Copyright 2010-2014 Tasos Laskos <tasos.laskos@arachni-scanner.com>

    This file is part of the Arachni Framework project and is subject to
    redistribution and commercial restrictions. Please see the Arachni Framework
    web site for more information on licensing and terms of use.
=end

module Arachni
module RPC
class Server

# It, for the most part, forwards calls to {Arachni::Options} and intercepts
# a few that need to be updated at other places throughout the framework.
#
# @private
# @author Tasos "Zapotek" Laskos <tasos.laskos@arachni-scanner.com>
class ActiveOptions

    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

    # @see Arachni::Options#set
    def set( options )
        @options.set( options )
        HTTP::Client.reset false
        true
    end

    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

    def to_h
        @options.to_rpc_data
    end

end

end
end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
arachni-1.0.6 lib/arachni/rpc/server/active_options.rb
arachni-1.0.5 lib/arachni/rpc/server/active_options.rb
arachni-1.0.4 lib/arachni/rpc/server/active_options.rb
arachni-1.0.3 lib/arachni/rpc/server/active_options.rb
arachni-1.0.2 lib/arachni/rpc/server/active_options.rb
arachni-1.0.1 lib/arachni/rpc/server/active_options.rb
arachni-1.0 lib/arachni/rpc/server/active_options.rb