Class: Arachni::UI::DispatcherMonitor

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

Overview

@author: Tasos “Zapotek” Laskos

<[email protected]>
<[email protected]>

@version: 0.1.2

Instance Method Summary collapse

Methods included from Output

#buffer, #debug!, #debug?, #flush_buffer, #mute!, #muted?, #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?, #uncap_buffer!, #unmute!, #verbose!, #verbose?

Constructor Details

#initialize(opts) ⇒ DispatcherMonitor

Returns a new instance of DispatcherMonitor.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/arachni/ui/rpc/dispatcher_monitor.rb', line 21

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 0
    end

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

    begin
        # start the RPC client
        @dispatcher = Arachni::RPC::Client::Dispatcher.new( @opts, @opts.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

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

end

Instance Method Details

#runObject



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/arachni/ui/rpc/dispatcher_monitor.rb', line 59

def run

    print_line

    # grab the XMLRPC server output while a scan is running
    while( 1 )
        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