Class: Arachni::UI::CLI::RPC::Client::Remote

Inherits:
Object
  • Object
show all
Includes:
Output
Defined in:
ui/cli/rpc/client/remote.rb,
ui/cli/rpc/client/remote/option_parser.rb

Overview

Provides a command-line RPC client and uses a Server::Dispatcher to provide an RPC::Server::Instance in order to perform a scan.

Author:

Defined Under Namespace

Classes: OptionParser

Instance Method Summary collapse

Methods included from Output

#caller_location, #debug?, #debug_level, #debug_level_1?, #debug_level_2?, #debug_level_3?, #debug_level_4?, #debug_off, #debug_on, #disable_only_positives, #error_buffer, #error_log_fd, #error_logfile, #has_error_log?, #included, #log_error, #mute, #muted?, #only_positives, #only_positives?, #print_bad, #print_debug, #print_debug_backtrace, #print_debug_exception, #print_debug_level_1, #print_debug_level_2, #print_debug_level_3, #print_debug_level_4, #print_error, #print_error_backtrace, #print_exception, #print_info, #print_line, #print_ok, #print_status, #print_verbose, #reroute_to_file, #reroute_to_file?, reset_output_options, #set_error_logfile, #unmute, #verbose?, #verbose_off, #verbose_on

Constructor Details

#initializeRemote

Returns a new instance of Remote.



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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'ui/cli/rpc/client/remote.rb', line 29

def initialize
    parser = Remote::OptionParser.new
    parser.authorized_by
    parser.scope
    parser.audit
    parser.input
    parser.http
    parser.checks
    parser.plugins
    parser.platforms
    parser.session
    parser.profiles
    parser.browser_cluster
    parser.distribution
    parser.ssl
    parser.report
    parser.timeout
    parser.parse

    options = parser.options

    Arachni::Reactor.global.run_in_thread

    begin
        dispatcher = Arachni::RPC::Client::Dispatcher.new( options, options.dispatcher.url )

        # Get a new instance and assign the url we're going to audit as the 'owner'.
        instance_info = dispatcher.dispatch( options.url )
    rescue Arachni::RPC::Exceptions::ConnectionError => e
        print_error "Could not connect to Dispatcher at '#{options.dispatcher.url}'."
        print_debug "Error: #{e.to_s}."
        print_debug_backtrace e
        exit 1
    end

    instance = nil
    begin
        instance = Arachni::RPC::Client::Instance.new( options,
                                                        instance_info['url'],
                                                        instance_info['token'] )
    rescue Arachni::RPC::Exceptions::ConnectionError => e
        print_error 'Could not connect to Instance.'
        print_debug "Error: #{e.to_s}."
        print_debug_backtrace e
        exit 1
    end

    # Let the Instance UI manage the Instance from now on.
    Instance.new( Arachni::Options.instance, instance, parser.get_timeout ).run
end