Class: Arachni::UI::XMLRPC
- Includes:
- Module::Utilities, Output
- Defined in:
- lib/ui/xmlrpc/xmlrpc.rb
Overview
Arachni::UI:XMLRPC class
Provides an self sufficient Arachni XML-RPC client.
It mimics the standard CLI interface’s functionality albeit in a client-server fashion.
This should be your first stop when looking into creating your own XMLRPC client. <br/> Of course you don’t need to instantiate the framework or any other Arachni related classes in your own client, this is just to provide some other info to the user.
@author: Tasos “Zapotek” Laskos
<[email protected]>
<[email protected]>
@version: 0.1.2
Instance Method Summary collapse
-
#initialize(opts) ⇒ XMLRPC
constructor
A new instance of XMLRPC.
- #run ⇒ Object
Methods included from Module::Utilities
#exception_jail, #get_path, #normalize_url, #read_file, #seed
Methods included from Output
#buffer, #debug!, #debug?, #flush_buffer, #mute!, #muted?, #only_positives!, #only_positives?, #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?, #unmute!, #verbose!, #verbose?
Constructor Details
#initialize(opts) ⇒ XMLRPC
Returns a new instance of XMLRPC.
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 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 |
# File 'lib/ui/xmlrpc/xmlrpc.rb', line 38 def initialize( opts ) @opts = opts # if we have a load profile load it and merge it with the # user supplied options if( @opts.load_profile ) load_profile( @opts.load_profile ) end debug! if @opts.debug # we don't need the framework for much, # in this case only for report generation, version number etc. @framework = Arachni::Framework.new( @opts ) # print banner message # if the user needs help, output it and exit if opts.help usage exit 0 end # if the user wants to see the available reports, output them and exit if !opts.lsrep.empty? 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 # Check for missing url if( !@opts.url && !@opts.lsmod ) print_error( "Missing url argument." ) exit 0 end begin @dispatcher = Arachni::RPC::XML::Client::Dispatcher.new( @opts, @opts.server ) # get a new instance and assign the url we're going to audit as the # 'owner' @instance = @dispatcher.dispatch( @opts.url.to_s ) instance_url = URI( @opts.server.to_s ) instance_url.port = @instance['port'] # start the XMLRPC client @server = Arachni::RPC::XML::Client::Instance.new( @opts, instance_url.to_s ) rescue Exception => e print_error( "Could not connect to server." ) print_error( "Error: #{e.to_s}." ) print_debug_backtrace( e ) exit 0 end # if the user wants to see the available reports, output them and exit if !opts.lsplug.empty? lsplug( @server.framework.lsplug ) shutdown 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? lsmod( @server.framework.lsmod ) shutdown exit end # # we could just execute pause() upon an interrupt but XMLRPC I/O # needs to be synchronized otherwise we'll get an HTTP exception # @pause = false trap( 'INT' ){ @pause = true } begin parse_opts rescue Exception => e print_error( 'Error: ' + e.to_s ) print_debug_backtrace( e ) begin shutdown rescue end exit end end |
Instance Method Details
#run ⇒ Object
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/ui/xmlrpc/xmlrpc.rb', line 141 def run exception_jail { print_status 'Running framework...' @server.framework.run print_line # grab the XMLRPC server output while a scan is running while( @server.framework.busy? ) output pause if @pause # things will get crazy if we don't block a bit I think... # we'll see... ::IO::select( nil, nil, nil, 0.3 ) end puts } report shutdown end |