Changeset 6089
- Timestamp:
- 01/07/09 21:04:26 (6 months ago)
- Location:
- framework3/trunk
- Files:
-
- 2 modified
-
msfd (modified) (3 diffs)
-
plugins/msfd.rb (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
framework3/trunk/msfd
r6027 r6089 20 20 "-s" => [ false, "Use SSL" ], 21 21 "-f" => [ false, "Run the daemon in the foreground" ], 22 "-A" => [ true, "Specify list of hosts allowed to connect" ], 23 "-D" => [ true, "Specify list of hosts not allowed to connect" ], 22 24 "-h" => [ false, "Help banner" ]) 23 25 … … 36 38 when "-s" 37 39 opts['SSL'] = true 40 when "-A" 41 begin 42 opts['HostsAllowed'] = val.split(',').map { |a| 43 Rex::Socket.resolv_nbo(a) 44 } 45 rescue 46 $stderr.puts "Bad argument for -A: #{$!}" 47 exit 48 end 49 when "-D" 50 begin 51 opts['HostsDenied'] = val.split(',').map { |a| 52 Rex::Socket.resolv_nbo(a) 53 } 54 rescue 55 $stderr.puts "Bad argument for -D: #{$!}" 56 exit 57 end 38 58 when "-h" 39 59 print( … … 57 77 58 78 # Run the plugin instance in the foreground. 59 $framework.plugins.load('msfd', opts).run 79 $framework.plugins.load('msfd', opts).run(opts) -
framework3/trunk/plugins/msfd.rb
r6027 r6089 50 50 # ``run'' method. 51 51 # 52 # HostsAllowed 53 # 54 # List of hosts (in NBO) allowed to use msfd 55 # 56 # HostsDenied 57 # 58 # List of hosts (in NBO) not allowed to use msfd 59 # 52 60 def initialize(framework, opts) 53 61 super … … 63 71 if (opts['RunInForeground'] != true) 64 72 Thread.new { 65 run 73 run(opts) 66 74 } 67 75 end … … 86 94 # threads to handle the console interface for each client. 87 95 # 88 def run 96 def run(opts={}) 89 97 begin 90 98 client = server.accept 99 100 addr = Rex::Socket.resolv_nbo(client.getpeername[1]) 101 102 if opts['HostsAllowed'] and 103 not opts['HostsAllowed'].find { |x| x == addr } 104 client.close 105 next 106 end 107 108 if opts['HostsDenied'] and 109 opts['HostsDenied'].find { |x| x == addr } 110 client.close 111 next 112 end 91 113 92 114 # Spawn a thread for the client connection
