Class: Metasploit::Framework::Command::Console
- Defined in:
- lib/metasploit/framework/command/console.rb
Overview
Based on pattern used for lib/rails/commands in the railties gem.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#spinner ⇒ Object
Provides an animated spinner in a seperate thread.
- #start ⇒ Object
Methods inherited from Base
#initialize, parsed_options, parsed_options_class, parsed_options_class_name, require_environment!, start
Constructor Details
This class inherits a constructor from Metasploit::Framework::Command::Base
Instance Method Details
#spinner ⇒ Object
Provides an animated spinner in a seperate thread.
See GitHub issue #4147, as this may be blocking some Windows instances, which is why Windows platforms should simply return immediately.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/metasploit/framework/command/console.rb', line 17 def spinner return if Rex::Compat.is_windows return if Rex::Compat.is_cygwin return if $msf_spinner_thread $msf_spinner_thread = Thread.new do base_line = "[*] Starting the Metasploit Framework console..." cycle = 0 loop do %q{/-\|}.each_char do |c| status = "#{base_line}#{c}\r" cycle += 1 off = cycle % base_line.length case status[off, 1] when /[a-z]/ status[off, 1] = status[off, 1].upcase when /[A-Z]/ status[off, 1] = status[off, 1].downcase end $stderr.print status ::IO.select(nil, nil, nil, 0.10) end end end end |
#start ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/metasploit/framework/command/console.rb', line 42 def start case ..subcommand when :version $stderr.puts "Framework Version: #{Metasploit::Framework::VERSION}" else spinner unless ..console.quiet driver.run end end |