Module: Msf::Exploit::Remote::SMB::Server::ServiceMixin
- Defined in:
- lib/msf/core/exploit/remote/smb/server.rb
Instance Attribute Summary collapse
-
#listener_thread ⇒ Object
Returns the value of attribute listener_thread.
-
#on_client_connect_proc ⇒ Object
Returns the value of attribute on_client_connect_proc.
Instance Method Summary collapse
Instance Attribute Details
#listener_thread ⇒ Object
Returns the value of attribute listener_thread.
39 40 41 |
# File 'lib/msf/core/exploit/remote/smb/server.rb', line 39 def listener_thread @listener_thread end |
#on_client_connect_proc ⇒ Object
Returns the value of attribute on_client_connect_proc.
39 40 41 |
# File 'lib/msf/core/exploit/remote/smb/server.rb', line 39 def on_client_connect_proc @on_client_connect_proc end |
Instance Method Details
#start ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/msf/core/exploit/remote/smb/server.rb', line 11 def start if Rex::Socket.is_ipv6?(@socket.localhost) localinfo = "[#{@socket.localhost}]:#{@socket.localport}" else localinfo = "#{@socket.localhost}:#{@socket.localport}" end self.listener_thread = Rex::ThreadFactory.spawn("SMBServerListener(#{localinfo})", false) do begin run do |server_client| on_client_connect_proc.call(server_client) if on_client_connect_proc true end rescue IOError => e # this 'IOError: stream closed in another thread' is expected, so disregard it wlog("#{e.class}: #{e.}") end end end |
#stop ⇒ Object
31 32 33 |
# File 'lib/msf/core/exploit/remote/smb/server.rb', line 31 def stop @socket.close end |
#wait ⇒ Object
35 36 37 |
# File 'lib/msf/core/exploit/remote/smb/server.rb', line 35 def wait listener_thread.join if listener_thread end |