Class: Arachni::UI::CLI
- Includes:
- Mixins::ProgressBar, Mixins::Terminal, Module::Utilities, Output
- Defined in:
- lib/arachni/ui/cli/cli.rb
Overview
Arachni::UI:CLI class
Provides a command line interface for the Arachni Framework.<br/> Most of the logic is in the Framework class however profiles can only<br/> be loaded and saved at this level.
@author: Tasos “Zapotek” Laskos
<[email protected]>
<[email protected]>
@version: 0.1.9
Instance Attribute Summary collapse
-
#opts ⇒ Options
readonly
Instance options.
Instance Method Summary collapse
-
#initialize(opts) ⇒ CLI
constructor
Initializes the command line interface and the framework.
-
#run ⇒ Object
Runs Arachni.
Methods included from Module::Utilities
#exception_jail, #get_path, #hash_keys_to_str, #normalize_url, #read_file, #seed, #uri_decode, #uri_encode, #uri_parse, #uri_parser, #url_sanitize
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?
Methods included from Mixins::ProgressBar
#eta, #format_time, #progress_bar
Methods included from Mixins::Terminal
#clear_screen!, #flush!, #move_to_home!, #reprint, #reputs, #restr
Constructor Details
#initialize(opts) ⇒ CLI
Initializes the command line interface and the framework
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 |
# File 'lib/arachni/ui/cli/cli.rb', line 54 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 # # the stdout report is the default one for the CLI, # each UI should have it's own default # # always load the stdout report unless the user requested # to see a list of the available reports # # *do not* forget this check, otherwise the reports registry # will desync # if( @opts.reports.empty? && @opts.lsrep.empty? ) @opts.reports['stdout'] = {} end # instantiate the big-boy! @arachni = Arachni::Framework.new( @opts ) # echo the banner ( ) # work on the user supplied arguments parse_opts( ) @interrupt_handler = nil # trap Ctrl+C interrupts trap( 'INT' ) { handle_interrupt( ) } end |
Instance Attribute Details
#opts ⇒ Options (readonly)
Instance options
43 44 45 |
# File 'lib/arachni/ui/cli/cli.rb', line 43 def opts @opts end |
Instance Method Details
#run ⇒ Object
Runs Arachni
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 |
# File 'lib/arachni/ui/cli/cli.rb', line 97 def run( ) print_status( 'Initing...' ) begin # we may need to kill the audit so put it in a thread @audit = Thread.new { # start the show! @arachni.run { kill_interrupt_handler clear_screen! } print_stats } @audit.join # if the user requested to exit the scan wait until the # Thread that takes care of the clean up to finish @exit_handler.join if @exit_handler rescue Arachni::Exceptions::NoMods => e print_error( e.to_s ) print_info( "Run arachni with the '-h' parameter for help or " ) print_info( "with the '--lsmod' parameter to see all available modules." ) print_line exit 0 rescue Arachni::Exceptions => e print_error( e.to_s ) print_info( "Run arachni with the '-h' parameter for help." ) print_line exit 0 rescue Exception => e exception_jail{ raise e } exit 0 end end |