Class: Arachni::RPC::Server::Instance
- Includes:
- UI::Output, Utilities
- Defined in:
- lib/arachni/rpc/server/instance.rb
Overview
RPC Server class
Provides an RPC server to assist with general integration and UI development.
Only instantiated by the Dispatcher to provide support for multiple and concurrent RPC clients/scans.
Instance Method Summary collapse
- #alive? ⇒ Boolean
-
#initialize(opts, token) ⇒ Instance
constructor
Initializes the RPC interface, the HTTP(S) server and the framework.
-
#output(&block) ⇒ Array<Hash>
Flushes the output buffer and returns all pending system messages.
-
#shutdown ⇒ Object
(also: #shutdown!)
Makes the server go bye-bye…Lights out!.
Methods included from Utilities
#cookie_encode, #cookies_from_document, #cookies_from_file, #cookies_from_response, #exception_jail, #exclude_path?, #extract_domain, #form_decode, #form_encode, #form_parse_request_body, #forms_from_document, #forms_from_response, #get_path, #hash_keys_to_str, #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?, #remove_constants, #seed, #skip_path?, #to_absolute, #uri_decode, #uri_encode, #uri_parse, #uri_parser, #url_sanitize
Methods included from UI::Output
#debug?, #debug_off, #debug_on, #disable_only_positives, #flush_buffer, #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, #uncap_buffer, #unmute, #verbose, #verbose?
Constructor Details
#initialize(opts, token) ⇒ Instance
Initializes the RPC interface, the HTTP(S) server and the framework.
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 'lib/arachni/rpc/server/instance.rb', line 48 def initialize( opts, token ) prep_framework @opts = opts @token = token @server = Base.new( @opts, token ) @server.logger.level = @opts.datastore[:log_level] if @opts.datastore[:log_level] @opts.datastore[:token] = token debug if @opts.debug if @opts.reroute_to_logfile reroute_to_file( @opts.dir['logs'] + "/Instance - #{Process.pid}-#{@opts.rpc_port}.log" ) else reroute_to_file( false ) end set_handlers # trap interrupts and exit cleanly when required %w(QUIT INT).each do |signal| trap( signal ){ shutdown } if Signal.list.has_key?( signal ) end run end |
Instance Method Details
#alive? ⇒ Boolean
111 112 113 |
# File 'lib/arachni/rpc/server/instance.rb', line 111 def alive? @server.alive? end |
#output(&block) ⇒ Array<Hash>
Flushes the output buffer and returns all pending system messages.
All messages are classified based on their type.
87 88 89 |
# File 'lib/arachni/rpc/server/instance.rb', line 87 def output( &block ) @framework.output( &block ) end |
#shutdown ⇒ Object Also known as: shutdown!
Makes the server go bye-bye…Lights out!
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/arachni/rpc/server/instance.rb', line 94 def shutdown print_status( 'Shutting down...' ) t = [] @framework.instance_eval { @instances.each do |instance| # Don't know why but this works better than EM's stuff t << Thread.new { connect_to_instance( instance ).service.shutdown! } end } t.join @server.shutdown true end |