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

Inherits:
Object
  • Object
show all
Includes:
Utilities, Output
Defined in:
lib/arachni/ui/cli/rpc/remote.rb

Overview

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

Author:

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utilities

#load_profile, #lsmod, #lsplat, #lsplug, #lsrep, #print_banner, #print_issues, #print_profile, #save_profile

Methods included from Mixins::ProgressBar

#eta, #format_time, #progress_bar

Methods included from Mixins::Terminal

#clear_screen, #flush, #move_to_home, #reprint, #reputs, #restr

Methods included from Arachni::Utilities

#available_port, #cookie_encode, #cookies_from_document, #cookies_from_file, #cookies_from_response, #exception_jail, #exclude_path?, #extract_domain, #follow_protocol?, #form_decode, #form_encode, #form_parse_request_body, #forms_from_document, #forms_from_response, #generate_token, #get_path, #html_decode, #html_encode, #include_path?, #links_from_document, #links_from_response, #normalize_url, #page_from_response, #page_from_url, #parse_query, #parse_set_cookie, #parse_url_vars, #path_in_domain?, #path_too_deep?, #port_available?, #rand_port, #redundant_path?, #remove_constants, #seed, #skip_page?, #skip_path?, #skip_resource?, #to_absolute, #uri_decode, #uri_encode, #uri_parse, #uri_parser, #url_sanitize

Methods included from Output

#debug?, #debug_off, #debug_on, #disable_only_positives, #error_logfile, #flush_buffer, #log_error, #mute, #muted?, old_reset_output_options, #only_positives, #only_positives?, #print_bad, #print_debug, #print_debug_backtrace, #print_debug_pp, #print_error, #print_error_backtrace, #print_info, #print_line, #print_ok, #print_status, #print_verbose, #reroute_to_file, #reroute_to_file?, reset_output_options, #set_buffer_cap, #set_error_logfile, #uncap_buffer, #unmute, #verbose, #verbose?

Constructor Details

#initialize(opts = Arachni::Options.instance) ⇒ Remote

Returns a new instance of Remote.



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
79
80
81
82
83
84
85
86
87
# File 'lib/arachni/ui/cli/rpc/remote.rb', line 44

def initialize( opts = Arachni::Options.instance )
    @opts = opts

    # If the user needs help, output it and exit.
    if opts.help
        print_banner
        usage
        exit 0
    end

    # Check for missing Dispatcher
    if !@opts.server
        print_banner
        print_error 'Missing server argument.'
        exit 1
    end

    begin
        dispatcher = Arachni::RPC::Client::Dispatcher.new( @opts, @opts.server )

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

    begin
        # start the RPC client
        instance = Arachni::RPC::Client::Instance.new( @opts,
                                                       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( @opts, instance ).run
end

Instance Attribute Details

#error_log_fileObject (readonly)

Returns the value of attribute error_log_file.



42
43
44
# File 'lib/arachni/ui/cli/rpc/remote.rb', line 42

def error_log_file
  @error_log_file
end

Instance Method Details

#usageObject

Outputs help/usage information.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/arachni/ui/cli/rpc/remote.rb', line 90

def usage
    super '--server host:port'

    print_line <<USAGE
Distribution -----------------

--server=<address:port>     Dispatcher server to use.
                              (Used to provide scanner Instances.)

--spawns=<integer>          How many slaves to spawn for a high-performance mult-Instance scan.
                              (When no grid mode has been specified, all slaves will all be from the same Dispatcher machine.
                                When a grid-mode has been specified, this option will be treated as a possible maximum and
                                not a hard value.)

--grid-mode=<mode>          Sets the Grid mode of operation for this scan.
                              Valid modes are:
                                * balance -- Slaves will be provided by the least burdened Grid Dispatchers.
                                * aggregate -- In addition to balancing, slaves will all be from Dispatchers
                                    with unique bandwidth Pipe-IDs to result in application-level line-aggregation.

--grid                      Shorthand for '--grid-mode=balance'.


SSL --------------------------
(Do *not* use encrypted keys!)

--ssl-pkey=<file>           Location of the SSL private key (.pem)
                              (Used to verify the the client to the servers.)

--ssl-cert=<file>           Location of the SSL certificate (.pem)
                              (Used to verify the the client to the servers.)

--ssl-ca=<file>             Location of the CA certificate (.pem)
                              (Used to verify the servers to the client.)


USAGE
end