Class: Msf::Exploit::Remote::SMB::RelayServer::SMBRelayServer
- Inherits:
-
Object
- Object
- Msf::Exploit::Remote::SMB::RelayServer::SMBRelayServer
- Includes:
- Rex::Proto
- Defined in:
- lib/msf/core/exploit/remote/smb/relay_server.rb
Instance Attribute Summary collapse
-
#listener_sock ⇒ Object
Returns the value of attribute listener_sock.
-
#listener_thread ⇒ Object
Returns the value of attribute listener_thread.
Class Method Summary collapse
-
.hardcore_alias(*args) ⇒ Object
Returns the hardcore alias for the SMB service.
- .sock_options_for(options) ⇒ Object
Instance Method Summary collapse
- #alias ⇒ Object
-
#initialize(options) ⇒ SMBRelayServer
constructor
A new instance of SMBRelayServer.
- #start ⇒ Object
- #stop ⇒ Object
-
#wait ⇒ Object
This method waits on the server listener thread.
Constructor Details
#initialize(options) ⇒ SMBRelayServer
Returns a new instance of SMBRelayServer.
36 37 38 |
# File 'lib/msf/core/exploit/remote/smb/relay_server.rb', line 36 def initialize() @options = end |
Instance Attribute Details
#listener_sock ⇒ Object
Returns the value of attribute listener_sock.
86 87 88 |
# File 'lib/msf/core/exploit/remote/smb/relay_server.rb', line 86 def listener_sock @listener_sock end |
#listener_thread ⇒ Object
Returns the value of attribute listener_thread.
86 87 88 |
# File 'lib/msf/core/exploit/remote/smb/relay_server.rb', line 86 def listener_thread @listener_thread end |
Class Method Details
.hardcore_alias(*args) ⇒ Object
Returns the hardcore alias for the SMB service
47 48 49 50 |
# File 'lib/msf/core/exploit/remote/smb/relay_server.rb', line 47 def self.hardcore_alias(*args) = (*args) "#{['LocalHost']}#{['LocalPort']}" end |
.sock_options_for(options) ⇒ Object
88 89 90 91 92 93 |
# File 'lib/msf/core/exploit/remote/smb/relay_server.rb', line 88 def self.() { 'LocalHost' => '0.0.0.0', 'LocalPort' => 445 }.merge([:socket]) end |
Instance Method Details
#alias ⇒ Object
40 41 42 |
# File 'lib/msf/core/exploit/remote/smb/relay_server.rb', line 40 def alias super || 'SMB Relay Server' end |
#start ⇒ Object
52 53 54 55 56 57 58 59 60 |
# File 'lib/msf/core/exploit/remote/smb/relay_server.rb', line 52 def start @listener_sock = Rex::Socket::TcpServer.create() @listener_server = Msf::Exploit::Remote::SMB::Relay::NTLM::Server.new(**(@listener_sock)) @listener_thread = Rex::ThreadFactory.spawn('SMBRelayServerListener', false) do @listener_server.run rescue StandardError => e elog(e) end end |
#stop ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/msf/core/exploit/remote/smb/relay_server.rb', line 62 def stop begin @listener_server.close if @server && !@server.closed? @listener_thread.kill if @listener_thread rescue StandardError => e print_error('Failed closing SMB server') elog('Failed closing SMB server', error: e) end begin @listener_sock.close if @listener_sock && !@listener_sock.closed? rescue StandardError => e print_error('Failed closing SMB server socket') elog('Failed closing SMB server socket', error: e) end end |
#wait ⇒ Object
This method waits on the server listener thread
82 83 84 |
# File 'lib/msf/core/exploit/remote/smb/relay_server.rb', line 82 def wait @listener_thread.join if listener_thread end |