Class: Arachni::UI::CLI::RPC::Instance
- Includes:
- Mixins::ProgressBar, Mixins::Terminal, Utilities, Output
- Defined in:
- lib/arachni/ui/cli/rpc/instance.rb
Overview
Provides a command-line RPC client/interface for an RPC::Server::Instance.
This interface should be your first stop when looking into using/creating your own RPC client.
Of course, you don’t need to have access to the framework or any other Arachni class for your own client, this is used here just to provide some other info to the user.
However, in contrast with everywhere else in the system (where RPC operations are asynchronous), this interface operates in blocking mode as its simplicity does not warrant the extra complexity of asynchronous calls.
Instance Attribute Summary collapse
-
#error_log_file ⇒ Object
readonly
Returns the value of attribute error_log_file.
Instance Method Summary collapse
-
#initialize(opts, instance) ⇒ Instance
constructor
A new instance of Instance.
- #run ⇒ Object
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 Utilities
#load_profile, #lsmod, #lsplat, #lsplug, #lsrep, #print_banner, #print_profile, #save_profile, #usage
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, instance) ⇒ Instance
Returns a new instance of Instance.
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 88 89 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 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/arachni/ui/cli/rpc/instance.rb', line 62 def initialize( opts, instance ) @opts = opts @instance = instance clear_screen move_to_home # If we have a profile option load it and merge it with the user supplied # options. load_profile( @opts.load_profile ) if @opts.load_profile # We don't need the framework for much, in this case only for report # generation, version number etc. @framework = Arachni::Framework.new( @opts ) # If the user wants to see the available reports, output them and exit. if !opts.lsrep.empty? lsrep @framework.lsrep exit end if opts.show_profile print_profile exit 0 end if opts.save_profile exception_jail{ save_profile( opts.save_profile ) } exit 0 end if @opts.platforms.any? begin Platform::Manager.new( @opts.platforms ) rescue Platform::Error::Invalid => e @opts.platforms.clear print_error e print_info 'Available platforms are:' print_info Platform::Manager.new.valid.to_a.join( ', ' ) print_line print_info 'Use the \'--lsplat\' parameter to see a detailed list of all available platforms.' exit 1 end end if opts.lsplat platforms = @instance.framework.lsplat shutdown lsplat platforms exit end # If the user wants to see the available plugins grab them from the # server, output them, exit and shutdown the server. if !opts.lsplug.empty? plugins = @instance.framework.lsplug shutdown lsplug plugins exit end # If the user wants to see the available modules grab them from the # server, output them, exit and shutdown the server. if !opts.lsmod.empty? modules = @instance.framework.lsmod shutdown lsmod modules exit end # Check for missing url if !@opts.url print_error 'Missing url argument.' exit 1 end @issues ||= [] end |
Instance Attribute Details
#error_log_file ⇒ Object (readonly)
Returns the value of attribute error_log_file.
58 59 60 |
# File 'lib/arachni/ui/cli/rpc/instance.rb', line 58 def error_log_file @error_log_file end |
Instance Method Details
#run ⇒ Object
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/arachni/ui/cli/rpc/instance.rb', line 146 def run begin # Start the show! @instance.service.scan while busy? print_progress sleep 5 refresh_progress end rescue Interrupt rescue => e print_error e print_error_backtrace e end report_and_shutdown end |