Module: Rex::Post::Meterpreter::PacketDispatcher

Defined in:
lib/msf-plugins/evasiondb.rb

Overview

This extends the PacketDispatcher from Rex with Logging Original Source is: lib/rex/post/meterpreter/packet_dispatcher.rb

Instance Method Summary collapse

Instance Method Details

#send_packet(packet, completion_routine = nil, completion_param = nil) ⇒ Object



344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
# File 'lib/msf-plugins/evasiondb.rb', line 344

def send_packet(packet, completion_routine = nil, completion_param = nil)
  FIDIUS::PacketLogger.log_packet(self.sock,packet.to_r,"Meterpreter")
  if (completion_routine)
    add_response_waiter(packet, completion_routine, completion_param)
  end

  bytes = 0
  raw   = packet.to_r

  if (raw)
    begin
      bytes = self.sock.write(raw)
    rescue ::Exception => e
      # Mark the session itself as dead
      self.alive = false

      # Indicate that the dispatcher should shut down too
      @finish = true

      # Reraise the error to the top-level caller
      raise e
    end
  end

  return bytes
end