2005-12-17 06:46:23 +00:00
|
|
|
#!/usr/bin/env ruby
|
2005-11-28 21:38:48 +00:00
|
|
|
#
|
|
|
|
# This user interface provides users with a web-based interface to the
|
|
|
|
# framework that can be shared.
|
|
|
|
#
|
2005-11-22 03:20:09 +00:00
|
|
|
|
2005-12-06 03:34:58 +00:00
|
|
|
$:.unshift(File.join(File.dirname(__FILE__), 'lib'))
|
2005-11-22 03:20:09 +00:00
|
|
|
|
|
|
|
require 'rex'
|
|
|
|
require 'msf/ui'
|
|
|
|
|
|
|
|
# Declare the argument parser for msfweb
|
|
|
|
arguments = Rex::Parser::Arguments.new(
|
|
|
|
"-a" => [ true, "Bind to this IP address instead of loopback" ],
|
|
|
|
"-p" => [ true, "Bind to this port instead of 55555" ],
|
|
|
|
"-v" => [ true, "A number between 0 and 3 that controls log verbosity" ],
|
2005-12-09 00:03:52 +00:00
|
|
|
"-d" => [ false, "Daemonize the web server" ],
|
2005-11-22 03:20:09 +00:00
|
|
|
"-h" => [ false, "Help banner" ])
|
|
|
|
|
|
|
|
opts = {}
|
2005-12-09 00:03:52 +00:00
|
|
|
background = false
|
2005-11-22 03:20:09 +00:00
|
|
|
|
|
|
|
# Parse command line arguments.
|
|
|
|
arguments.parse(ARGV) { |opt, idx, val|
|
|
|
|
case opt
|
|
|
|
when "-a"
|
|
|
|
opts['ServerHost'] = val
|
|
|
|
when "-p"
|
|
|
|
opts['ServerPort'] = val
|
|
|
|
when "-v"
|
|
|
|
opts['LogLevel'] = val
|
2005-12-09 00:03:52 +00:00
|
|
|
when "-d"
|
|
|
|
background = true
|
2005-11-22 03:20:09 +00:00
|
|
|
when "-h"
|
|
|
|
print(
|
|
|
|
"\nUsage: msfweb <options>\n" +
|
|
|
|
arguments.usage)
|
|
|
|
exit
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
2005-12-09 00:03:52 +00:00
|
|
|
exit if (Process.fork()) unless background == false
|
|
|
|
|
2005-11-24 03:31:23 +00:00
|
|
|
# Create the driver instance and run it.
|
|
|
|
Msf::Ui::Web::Driver.new(opts).run
|