Class: Arachni::UI::DispatcherMonitor

Inherits:
Object
  • Object
show all
Includes:
Output
Defined in:
lib/ui/xmlrpc/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_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) ⇒ DispatcherMonitor

Returns a new instance of DispatcherMonitor.



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
# File 'lib/ui/xmlrpc/dispatcher_monitor.rb', line 23

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

    begin
        # start the XMLRPC client
        @dispatcher = Arachni::RPC::XML::Client::Dispatcher.new( @opts, @opts.url.to_s )

        # it seems like the XMLRPC client will connect us on the first
        # call...so make sure that it *can* actually connect
        @dispatcher.jobs
    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



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

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