root/framework3/trunk/msfd

Revision 5392, 1.6 kB (checked in by hdm, 8 months ago)

Merged revisions 5386-5391 via svnmerge from
svn+ssh://metasploit.com/home/svn/framework3/branches/framework-3.1

........

r5391 | hdm | 2008-02-02 15:26:48 -0600 (Sat, 02 Feb 2008) | 3 lines


Prepend a library directory to the search path, if MSF_LOCAL_LIB is set. This lets folks maintain a set of modified libraries that will be used instead of the official ones. Documentation updates as well.

........

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1 #!/usr/bin/env ruby
2 #
3 # This user interface listens on a port and provides clients that connect to
4 # it with an msfconsole instance.  The nice thing about this interface is that
5 # it allows multiple clients to share one framework instance and thus makes it
6 # possible for sessions to to be shared from a single vantage point.
7 #
8
9 msfbase = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
10 $:.unshift(File.join(File.dirname(msfbase), 'lib'))
11 $:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
12
13 require 'msf/base'
14 require 'msf/ui'
15
16 # Declare the argument parser for msfd
17 arguments = Rex::Parser::Arguments.new(
18         "-a" => [ true,  "Bind to this IP address instead of loopback"          ],
19         "-p" => [ true,  "Bind to this port instead of 55554"                   ],
20         "-f" => [ false, "Run the daemon in the foreground"                     ],
21         "-h" => [ false, "Help banner"                                          ])
22
23 opts = { 'RunInForeground' => true }
24 foreground = false
25
26 # Parse command line arguments.
27 arguments.parse(ARGV) { |opt, idx, val|
28         case opt
29                 when "-a"
30                         opts['ServerHost'] = val
31                 when "-p"
32                         opts['ServerPort'] = val
33                 when "-f"
34                         foreground = true
35                 when "-h"
36                         print(
37                                 "\nUsage: #{File.basename(__FILE__)} <options>\n" +
38                                 arguments.usage)
39                         exit
40         end
41 }
42
43 # Create an instance of the framework
44 $framework = Msf::Simple::Framework.create
45
46 # Fork into the background if requested
47 begin
48         if (not foreground)
49                 exit(0) if Process.fork()
50         end
51 rescue ::NotImplementedError
52         $stderr.puts "[*] Background mode is not available on this platform"
53 end
54
55 # Run the plugin instance in the foreground.
56 $framework.plugins.load('msfd', opts).run
Note: See TracBrowser for help on using the browser.