Class: Arachni::UI::DispatcherMonitor

Inherits:
Object
  • Object
show all
Includes:
Output
Defined in:
lib/arachni/ui/rpc/dispatcher_monitor.rb

Overview

Provides an simplistic Dispatcher monitoring user interface.

Version:

  • 0.1.3

Instance Method Summary collapse

Methods included from 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) ⇒ DispatcherMonitor

Returns a new instance of DispatcherMonitor.



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
# File 'lib/arachni/ui/rpc/dispatcher_monitor.rb', line 36

def initialize( opts )
    @opts = opts

    debug if @opts.debug

    # print banner message
    banner

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

    if !@opts.url
        print_error "No server specified."
        print_line
        usage
        exit
    end

    begin
        # start the RPC client
        @dispatcher = Arachni::RPC::Client::Dispatcher.new( @opts, @opts.url.to_s )
        @dispatcher.alive?
    rescue RPC::Exceptions::ConnectionError => e
        print_error "Could not connect to server '#{@opts.url}'."
        print_error "Error: #{e.to_s}."
        print_debug_backtrace e
        exit
    end

    # trap interupts and exit cleanly when required
    trap( 'HUP' ) { exit }
    trap( 'INT' ) { exit }
end

Instance Method Details

#runObject



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/arachni/ui/rpc/dispatcher_monitor.rb', line 73

def run
    print_line

    # grab the XMLRPC server output while a scan is running
    loop do
        stats        = @dispatcher.stats
        running_jobs = stats['running_jobs']
        clear_screen

        banner
        print_stats( stats )

        print_line

        print_job_table( running_jobs )

        # things will get crazy if we don't block a bit I think...
        # we'll see...
        ::IO::select( nil, nil, nil, 1 )
    end

end