Class: Msf::Plugin::SocketLogger::MySocketEventHandler

Inherits:
Object
  • Object
show all
Includes:
Rex::Socket::Comm::Events
Defined in:
plugins/socket_logger.rb

Overview

This class implements a socket communication logger

Instance Method Summary collapse

Constructor Details

#initialize(path, prefix) ⇒ MySocketEventHandler

Returns a new instance of MySocketEventHandler.



18
19
20
21
# File 'plugins/socket_logger.rb', line 18

def initialize(path, prefix)
  @path = path
  @prefix = prefix
end

Instance Method Details

#on_before_socket_create(comm, param) ⇒ Object



23
# File 'plugins/socket_logger.rb', line 23

def on_before_socket_create(comm, param); end

#on_socket_created(_comm, sock, param) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'plugins/socket_logger.rb', line 25

def on_socket_created(_comm, sock, param)
  # Sockets created by the exploit have MsfExploit set and MsfPayload not set
  if param.context && param.context['MsfExploit'] && !param.context['MsfPayload']
    sock.extend(SocketLogger::SocketTracer)
    sock.context = param.context
    sock.params = param
    sock.initlog(@path, @prefix)
  end
end