Method: Rex::Proto::DCERPC::Response#initialize

Defined in:
lib/rex/proto/dcerpc/response.rb

#initialize(data) ⇒ Response

Create a new DCERPC::Response object This can be initialized in two ways: 1) Call .new() with the first 10 bytes of packet, then call parse on the rest 2) Call .new() with the full packet contents



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/rex/proto/dcerpc/response.rb', line 22

def initialize(data)

  self.ack_result = []
  self.ack_reason = []
  self.ack_xfer_syntax_uuid = []
  self.ack_xfer_syntax_vers = []

  if (! data or data.length < 10)
    raise Rex::Proto::DCERPC::Exceptions::InvalidPacket, 'DCERPC response packet is incomplete'
  end

  if (data.length == 10)
    self.frag_len = data[8,2].unpack('v')[0]
    self.raw = data
  end

  if (data.length > 10)
    self.raw = data
    self.parse
  end
end