mirror of
https://github.com/rapid7/metasploit-framework
synced 2024-11-12 11:52:01 +01:00
514e760b96
git-svn-id: file:///home/svn/incoming/trunk@3151 4d416f70-5f16-0410-b530-b9f4589650da
48 lines
1.4 KiB
Ruby
Executable File
48 lines
1.4 KiB
Ruby
Executable File
#!/usr/bin/ruby
|
|
#
|
|
# This user interface listens on a port and provides clients that connect to
|
|
# it with an msfconsole instance. The nice thing about this interface is that
|
|
# it allows multiple clients to share one framework instance and thus makes it
|
|
# possible for sessions to to be shared from a single vantage point.
|
|
#
|
|
|
|
$:.unshift(File.join(File.dirname(__FILE__), '../lib'))
|
|
|
|
require 'msf/base'
|
|
require 'msf/ui'
|
|
|
|
# Declare the argument parser for msfd
|
|
arguments = Rex::Parser::Arguments.new(
|
|
"-a" => [ true, "Bind to this IP address instead of loopback" ],
|
|
"-p" => [ true, "Bind to this port instead of 55554" ],
|
|
"-f" => [ false, "Run the daemon in the foreground" ],
|
|
"-h" => [ false, "Help banner" ])
|
|
|
|
opts = { 'RunInForeground' => true }
|
|
foreground = false
|
|
|
|
# Parse command line arguments.
|
|
arguments.parse(ARGV) { |opt, idx, val|
|
|
case opt
|
|
when "-a"
|
|
opts['ServerHost'] = val
|
|
when "-p"
|
|
opts['ServerPort'] = val
|
|
when "-f"
|
|
foreground = true
|
|
when "-h"
|
|
print(
|
|
"\nUsage: #{File.basename(__FILE__)} <options>\n" +
|
|
arguments.usage)
|
|
exit
|
|
end
|
|
}
|
|
|
|
# Create an instance of the framework
|
|
$framework = Msf::Simple::Framework.create
|
|
|
|
exit if (Process.fork()) unless foreground
|
|
|
|
# Run the plugin instance in the foreground.
|
|
$framework.plugins.load('msfd', opts).run
|