From 11c09b9f278bd04bb719b06d73c3bf64baffaa47 Mon Sep 17 00:00:00 2001 From: Spencer McIntyre Date: Fri, 8 Sep 2023 11:33:29 -0400 Subject: [PATCH] Show the tip while MSF is loading Give the users something to read while things are loading instead of waiting until everything is ready to go. --- lib/metasploit/framework/command/console.rb | 10 ++++++++-- lib/msf/ui/console/command_dispatcher/core.rb | 1 - 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/metasploit/framework/command/console.rb b/lib/metasploit/framework/command/console.rb index fb29f78bb360..3c476574289c 100644 --- a/lib/metasploit/framework/command/console.rb +++ b/lib/metasploit/framework/command/console.rb @@ -4,11 +4,12 @@ require 'metasploit/framework/command' require 'metasploit/framework/command/base' +require 'rex/text' # Based on pattern used for lib/rails/commands in the railties gem. class Metasploit::Framework::Command::Console < Metasploit::Framework::Command::Base - # Provides an animated spinner in a seperate thread. + # 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 @@ -44,7 +45,12 @@ def start when :version $stderr.puts "Framework Version: #{Metasploit::Framework::VERSION}" else - spinner unless parsed_options.options.console.quiet + unless parsed_options.options.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 diff --git a/lib/msf/ui/console/command_dispatcher/core.rb b/lib/msf/ui/console/command_dispatcher/core.rb index 95d32bb7dbeb..c3f5f99feb1f 100644 --- a/lib/msf/ui/console/command_dispatcher/core.rb +++ b/lib/msf/ui/console/command_dispatcher/core.rb @@ -260,7 +260,6 @@ def cmd_banner(*args) banner << ("+ -- --=[ %-#{padding}s]\n" % eva) banner << "\n" - banner << Rex::Text.wordwrap("Metasploit tip: #{Tip.sample}\n", indent = 0, cols = 60) banner << Rex::Text.wordwrap('Metasploit Documentation: https://docs.metasploit.com/', indent = 0, cols = 60) # Display the banner