MCPcopy
hub / github.com/knownsec/pocsuite3 / decode

Method decode

pocsuite3/lib/helper/java/serialization.py:764–775  ·  view source on GitHub ↗
(self, io)

Source from the content-addressed store, hash-verified

762 self.length = len(contents)
763
764 def decode(self, io):
765 raw_length = io.read(2)
766 if not raw_length or len(raw_length) != 2:
767 raise Exception('Failed to unserialize Utf')
768 self.length = struct.unpack('>H', raw_length)[0]
769 if self.length == 0:
770 self.contents = ""
771 else:
772 self.contents = io.read(self.length)
773 if not self.contents or len(self.contents) != self.length:
774 raise Exception('Failed to unserialize Utf')
775 return self
776
777 def encode(self):
778 encoded = struct.pack('>H', self.length)

Callers 15

decodeMethod · 0.95
decodeMethod · 0.95
decodeMethod · 0.95
decode_contentFunction · 0.95
test_cmd_runMethod · 0.45
test_cmd_runMethod · 0.45
searchMethod · 0.45
searchMethod · 0.45
read_untilFunction · 0.45
read_resultsFunction · 0.45
searchMethod · 0.45
__init__Method · 0.45

Calls 1

readMethod · 0.80

Tested by 2

test_cmd_runMethod · 0.36
test_cmd_runMethod · 0.36