Module: Msf::Util::DotNetDeserialization::Formatters::LosFormatter

Defined in:
lib/msf/util/dot_net_deserialization/formatters/los_formatter.rb

Defined Under Namespace

Classes: ObjectStateFormatter

Constant Summary collapse

TOKEN_BINARY_SERIALIZED =
50

Class Method Summary collapse

Class Method Details

.generate(stream) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/msf/util/dot_net_deserialization/formatters/los_formatter.rb', line 23

def self.generate(stream)
  unless stream.is_a?(Types::SerializedStream)
    raise ::NotImplementedError, 'Stream is not supported by this formatter'
  end

  stream = stream.to_binary_s
  formatted  = ObjectStateFormatter.new(token: TOKEN_BINARY_SERIALIZED).to_binary_s
  formatted << DotNetDeserialization.encode_7bit_int(stream.length)
  formatted << stream
end