Add an animation to comfort the user

Sometimes msfconsole takes a little while to start.

This adds a fairly common ASCII spinner to the startup sequence.

I haven't spec'ed it, and the code organization isn't great, so consider
this PR more of a cry for help than something immediately landable.

That said, it works for me.
bug/bundler_fix
Tod Beardsley 2014-10-14 14:54:45 -05:00
parent 8e58efbf4f
commit bf0a5d038e
No known key found for this signature in database
GPG Key ID: 1EFFB682ADB9F193
3 changed files with 21 additions and 0 deletions

View File

@ -7,11 +7,25 @@ require 'metasploit/framework/command/base'
# Based on pattern used for lib/rails/commands in the railties gem.
class Metasploit::Framework::Command::Console < Metasploit::Framework::Command::Base
def spinner(bool=true)
return if $msf_spinner_thread
$msf_spinner_thread = Thread.new do
loop do
%q{/-\|}.each_char do |c|
$stdout.print c
$stdout.print "\b"
end
end
end
end
def start
case parsed_options.options.subcommand
when :version
$stderr.puts "Framework Version: #{Metasploit::Framework::VERSION}"
else
spinner
driver.run
end
end

View File

@ -535,6 +535,11 @@ class Driver < Msf::Ui::Driver
framework.events.on_ui_start(Msf::Framework::Revision)
if $msf_spinner_thread
$msf_spinner_thread.kill
$stdout.print "\n"
end
run_single("banner") unless opts['DisableBanner']
opts["Plugins"].each do |plug|

View File

@ -45,4 +45,6 @@ end
require Pathname.new(__FILE__).realpath.expand_path.parent.join('config', 'boot')
require 'metasploit/framework/command/console'
$stdout.print "[*] Starting the Metasploit Framework console..."
Metasploit::Framework::Command::Console.start
$stdout.puts "[*] Metasploit Framework console session ended"