Reorder argument processing, based on a patch and suggestion by Jun Koi <junkoi2004[at]gmail.com>
git-svn-id: file:///home/svn/framework3/trunk@6309 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
73ae8dabfb
commit
cf446dd7d9
38
msfcli
38
msfcli
|
@ -26,16 +26,6 @@ if(RUBY_PLATFORM =~ /mswin32/)
|
|||
$stderr.puts " Cygwin or Linux in VMWare.\n\n"
|
||||
end
|
||||
|
||||
# Initialize the simplified framework instance.
|
||||
$framework = Msf::Simple::Framework.create
|
||||
|
||||
if ($framework.modules.failed.length > 0)
|
||||
print("Warning: The following modules could not be loaded!\n\n")
|
||||
$framework.modules.failed.each_pair do |file, err|
|
||||
print("\t#{file}: #{err}\n\n")
|
||||
end
|
||||
end
|
||||
|
||||
def usage (str = nil, extra = nil)
|
||||
tbl = Rex::Ui::Text::Table.new(
|
||||
'Header' => "Usage: #{$0} <exploit_name> <option=value> [mode]",
|
||||
|
@ -61,6 +51,26 @@ def usage (str = nil, extra = nil)
|
|||
exit
|
||||
end
|
||||
|
||||
# Handle the help option before loading modules
|
||||
exploit_name = ARGV.shift
|
||||
exploit = nil
|
||||
module_class = "exploit"
|
||||
|
||||
if(exploit_name == "-h")
|
||||
usage()
|
||||
end
|
||||
|
||||
# Initialize the simplified framework instance.
|
||||
$stderr.puts "[*] Please wait while we load the module tree..."
|
||||
$framework = Msf::Simple::Framework.create
|
||||
|
||||
if ($framework.modules.failed.length > 0)
|
||||
print("Warning: The following modules could not be loaded!\n\n")
|
||||
$framework.modules.failed.each_pair do |file, err|
|
||||
print("\t#{file}: #{err}\n\n")
|
||||
end
|
||||
end
|
||||
|
||||
if (ARGV.length < 1)
|
||||
ext = ''
|
||||
|
||||
|
@ -88,14 +98,6 @@ if (ARGV.length < 1)
|
|||
usage(nil, ext)
|
||||
end
|
||||
|
||||
# Get the module name we'll be using
|
||||
exploit_name = ARGV.shift
|
||||
exploit = nil
|
||||
module_class = "exploit"
|
||||
|
||||
if(exploit_name == "-h")
|
||||
usage()
|
||||
end
|
||||
|
||||
# Process special var/val pairs...
|
||||
Msf::Ui::Common.process_cli_arguments($framework, ARGV)
|
||||
|
|
Loading…
Reference in New Issue