Skip to content

Commit 85d8d78

Browse files
committed
add help command
1 parent dca4415 commit 85d8d78

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

beef

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ $root_dir = File.join(File.expand_path(File.dirname(File.realpath(__FILE__))), '
3939
$:.unshift($root_dir)
4040
$home_dir = File.expand_path("#{Dir.home}/.beef/", __FILE__).freeze
4141

42+
# @note Parse BeEF CLI options early (prevents Rack help from taking over)
43+
require 'core/main/console/commandline'
44+
BeEF::Core::Console::CommandLine.parse
45+
4246
#
4347
# @note Require core loader
4448
#

core/main/console/commandline.rb

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# Browser Exploitation Framework (BeEF) - https://beefproject.com
44
# See the file 'doc/COPYING' for copying permission
55
#
6+
require 'optparse'
7+
68
module BeEF
79
module Core
810
module Console
@@ -38,7 +40,7 @@ def self.parse
3840
@options[:verbose] = true
3941
end
4042

41-
opts.on('-a', '--ascii_art', 'Prints BeEF ascii art') do
43+
opts.on('-a', '--ascii-art', 'Prints BeEF ascii art') do
4244
@options[:ascii_art] = true
4345
end
4446

@@ -54,14 +56,22 @@ def self.parse
5456
@options[:ws_port] = ws_port
5557
end
5658

57-
opts.on('-ud', '--update_disabled', 'Skips update') do
59+
opts.on('-d', '--update-disabled', 'Skips update') do
5860
@options[:update_disabled] = true
5961
end
6062

61-
opts.on('-ua', '--update_auto', 'Automatic update with no prompt') do
63+
opts.on('-u', '--update-auto', 'Automatic update with no prompt') do
6264
@options[:update_auto] = true
6365
end
6466

67+
opts.on('-h', '--help', 'Show this help') do
68+
puts opts
69+
exit 0
70+
end
71+
72+
# opts.on('-i', '--interactive', 'Starts with the Console Shell activated') do
73+
# @options[:interactive] = true
74+
# end
6575
end
6676

6777
optparse.parse!

0 commit comments

Comments
 (0)