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 separate 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 separate thread.
See GitHub issue #4147, as this may be blocking some Windows instances, which is why Windows platforms should simply return immediately.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/metasploit/framework/command/console.rb', line 18 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
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/metasploit/framework/command/console.rb', line 43 def start case ..subcommand when :version $stderr.puts "Framework Version: #{Metasploit::Framework::VERSION}" else unless ..console.quiet colorizor = Struct.new(:supports_color?).new(false).extend(Rex::Text::Color) $stdout.print colorizor.substitute_colors(Rex::Text.wordwrap("Metasploit tip: #{Msf::Ui::Tip.sample}\n", indent = 0, cols = 80)) spinner end driver.run end end |