1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-11-05 14:57:30 +01:00
metasploit-framework/msfconsole
HD Moore 3aa45638df Added -c, -r, -v options to msfconsole
git-svn-id: file:///home/svn/incoming/trunk@3584 4d416f70-5f16-0410-b530-b9f4589650da
2006-04-02 16:28:02 +00:00

69 lines
1.3 KiB
Ruby
Executable File

#!/usr/bin/env ruby
#
# This user interface provides users with a command console interface to the
# framework.
#
$:.unshift(File.join(File.dirname(__FILE__), 'lib'))
require 'rex'
require 'msf/ui'
require 'optparse'
class OptsConsole
#
# Return a hash describing the options.
#
def self.parse(args)
options = {}
opts = OptionParser.new do |opts|
opts.banner = "Usage: msfconsole [options]"
opts.separator ""
opts.separator "Specific options:"
opts.on("-r", "-r <filename>", "Execute the specified resource file") do |r|
options['Resource'] = r
end
opts.on("-c", "-c <filename>", "Load the specified configuration file") do |c|
options['Config'] = c
end
# Boolean switch.
opts.on("-v", "--version", "Show version") do |v|
options['Version'] = true
end
opts.separator ""
opts.separator "Common options:"
opts.on_tail("-h", "--help", "Show this message") do
puts opts
exit
end
end
opts.parse!(args)
options
end
end
options = OptsConsole.parse(ARGV)
if (options['Version'])
$stderr.puts 'Framework Version: ' + Msf::Framework::Version
exit
end
begin
Msf::Ui::Console::Driver.new(
Msf::Ui::Console::Driver::DefaultPrompt,
Msf::Ui::Console::Driver::DefaultPromptChar,
options
).run
rescue Interrupt
end