From 77fae28cd44596dc60d6f32028be6afe38863032 Mon Sep 17 00:00:00 2001 From: William Vu Date: Wed, 7 Oct 2015 01:50:36 -0500 Subject: [PATCH] Add -q option to msfd to disable banner --- external/zsh/_msfconsole | 2 +- lib/metasploit/framework/parsed_options/console.rb | 2 +- msfd | 3 +++ plugins/msfd.rb | 3 ++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/external/zsh/_msfconsole b/external/zsh/_msfconsole index 060d943dc9..1a012fb62c 100644 --- a/external/zsh/_msfconsole +++ b/external/zsh/_msfconsole @@ -32,7 +32,7 @@ _arguments \ {-n,--no-database}"[Disable database support]" \ {-o,--output}"[Output to the specified file]:output file" \ {-p,--plugin}"[Load a plugin on startup]:plugin file:_files" \ - {-q,--quiet}"[Do not print the banner on start up]" \ + {-q,--quiet}"[Do not print the banner on startup]" \ {-r,--resource}"[Execute the specified resource file (- for stdin)]:resource file:_files" \ {-v,--version}"[Show version]" \ {-x,--execute-command}"[Execute the specified string as console commands]:commands" \ diff --git a/lib/metasploit/framework/parsed_options/console.rb b/lib/metasploit/framework/parsed_options/console.rb index 4bdf78b924..66052a00d6 100644 --- a/lib/metasploit/framework/parsed_options/console.rb +++ b/lib/metasploit/framework/parsed_options/console.rb @@ -56,7 +56,7 @@ class Metasploit::Framework::ParsedOptions::Console < Metasploit::Framework::Par options.console.plugins << plugin end - option_parser.on('-q', '--quiet', 'Do not print the banner on start up') do + option_parser.on('-q', '--quiet', 'Do not print the banner on startup') do options.console.quiet = true end diff --git a/msfd b/msfd index 8afe16c852..ad79d59b01 100755 --- a/msfd +++ b/msfd @@ -34,6 +34,7 @@ arguments = Rex::Parser::Arguments.new( "-f" => [ false, "Run the daemon in the foreground" ], "-A" => [ true, "Specify list of hosts allowed to connect" ], "-D" => [ true, "Specify list of hosts not allowed to connect" ], + "-q" => [ false, "Do not print the banner on startup" ], "-h" => [ false, "Help banner" ]) opts = { 'RunInForeground' => true } @@ -68,6 +69,8 @@ arguments.parse(ARGV) { |opt, idx, val| $stderr.puts "Bad argument for -D: #{$!}" exit end + when "-q" + opts['DisableBanner'] = true when "-h" print( "\nUsage: #{File.basename(__FILE__)} \n" + diff --git a/plugins/msfd.rb b/plugins/msfd.rb index 3f7e27f4fd..7d964d10ff 100644 --- a/plugins/msfd.rb +++ b/plugins/msfd.rb @@ -127,7 +127,8 @@ class Plugin::Msfd < Msf::Plugin 'Framework' => framework, 'LocalInput' => Rex::Ui::Text::Input::Socket.new(cli), 'LocalOutput' => Rex::Ui::Text::Output::Socket.new(cli), - 'AllowCommandPassthru' => false).run + 'AllowCommandPassthru' => false, + 'DisableBanner' => opts['DisableBanner'] ? true : false).run rescue elog("Msfd: Client error: #{$!}\n\n#{$@.join("\n")}", 'core') ensure