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.


24
25
26
27
# File 'plugins/socket_logger.rb', line 24

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

Instance Method Details

#on_before_socket_create(comm, param) ⇒ Object


29
30
# File 'plugins/socket_logger.rb', line 29

def on_before_socket_create(comm, param)
end

#on_socket_created(comm, sock, param) ⇒ Object


32
33
34
35
36
37
38
39
40
# File 'plugins/socket_logger.rb', line 32

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