Class: Rex::Post::Meterpreter::PacketParser
- Inherits:
-
Object
- Object
- Rex::Post::Meterpreter::PacketParser
- Defined in:
- lib/rex/post/meterpreter/packet_parser.rb
Overview
This class is responsible for reading in and decrypting meterpreter packets that arrive on a socket
Instance Attribute Summary collapse
-
#cipher ⇒ Object
protected
:nodoc:.
-
#packet ⇒ Object
protected
:nodoc:.
Instance Method Summary collapse
-
#initialize ⇒ PacketParser
constructor
Initializes the packet parser context.
-
#recv(sock) ⇒ Object
Reads data from the socket and parses as much of the packet as possible.
-
#reset ⇒ Object
Resets the parser state so that a new packet can begin being parsed.
Constructor Details
#initialize ⇒ PacketParser
Initializes the packet parser context.
18 19 20 |
# File 'lib/rex/post/meterpreter/packet_parser.rb', line 18 def initialize reset end |
Instance Attribute Details
#cipher ⇒ Object (protected)
:nodoc:
55 56 57 |
# File 'lib/rex/post/meterpreter/packet_parser.rb', line 55 def cipher @cipher end |
#packet ⇒ Object (protected)
:nodoc:
55 56 57 |
# File 'lib/rex/post/meterpreter/packet_parser.rb', line 55 def packet @packet end |
Instance Method Details
#recv(sock) ⇒ Object
Reads data from the socket and parses as much of the packet as possible.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/rex/post/meterpreter/packet_parser.rb', line 32 def recv(sock) raw = nil if self.packet.raw_bytes_required > 0 while (raw = sock.read(self.packet.raw_bytes_required)) self.packet.add_raw(raw) break if self.packet.raw_bytes_required == 0 end end if self.packet.raw_bytes_required > 0 if raw == nil raise EOFError else return nil end end packet = self.packet reset packet end |