diff --git a/beef b/beef index 4667227e2..147384898 100755 --- a/beef +++ b/beef @@ -39,6 +39,10 @@ $root_dir = File.join(File.expand_path(File.dirname(File.realpath(__FILE__))), ' $:.unshift($root_dir) $home_dir = File.expand_path("#{Dir.home}/.beef/", __FILE__).freeze +# @note Parse BeEF CLI options early (prevents Rack help from taking over) +require 'core/main/console/commandline' +BeEF::Core::Console::CommandLine.parse + # # @note Require core loader # diff --git a/core/main/console/commandline.rb b/core/main/console/commandline.rb index f4f31ecb2..5385a626d 100644 --- a/core/main/console/commandline.rb +++ b/core/main/console/commandline.rb @@ -3,6 +3,8 @@ # Browser Exploitation Framework (BeEF) - https://beefproject.com # See the file 'doc/COPYING' for copying permission # +require 'optparse' + module BeEF module Core module Console @@ -38,7 +40,7 @@ module BeEF @options[:verbose] = true end - opts.on('-a', '--ascii_art', 'Prints BeEF ascii art') do + opts.on('-a', '--ascii-art', 'Prints BeEF ascii art') do @options[:ascii_art] = true end @@ -54,14 +56,22 @@ module BeEF @options[:ws_port] = ws_port end - opts.on('-ud', '--update_disabled', 'Skips update') do + opts.on('-d', '--update-disabled', 'Skips update') do @options[:update_disabled] = true end - opts.on('-ua', '--update_auto', 'Automatic update with no prompt') do + opts.on('-u', '--update-auto', 'Automatic update with no prompt') do @options[:update_auto] = true end + opts.on('-h', '--help', 'Show this help') do + puts opts + exit 0 + end + + # opts.on('-i', '--interactive', 'Starts with the Console Shell activated') do + # @options[:interactive] = true + # end end optparse.parse!