MCPcopy
hub / github.com/mitmproxy/mitmproxy / unpack

Method unpack

mitmproxy/dns.py:370–375  ·  view source on GitHub ↗

Converts the entire given buffer into a DNS message.

(cls, buffer: bytes, timestamp: float | None = None)

Source from the content-addressed store, hash-verified

368
369 @classmethod
370 def unpack(cls, buffer: bytes, timestamp: float | None = None) -> DNSMessage:
371 """Converts the entire given buffer into a DNS message."""
372 length, msg = cls.unpack_from(buffer, 0, timestamp)
373 if length != len(buffer):
374 raise struct.error(f"unpack requires a buffer of {length} bytes")
375 return msg
376
377 @classmethod
378 def unpack_from(

Callers 15

testMethod · 0.80
assert_eqMethod · 0.80
test_packingMethod · 0.80
test_unpackFunction · 0.80
test_unpackMethod · 0.80
test_fuzz_unpackMethod · 0.80
test_dnsFunction · 0.80
domain_nameMethod · 0.80
https_alpnMethod · 0.80
https_echMethod · 0.80
_data_jsonMethod · 0.80
unpack_messageMethod · 0.80

Calls 2

unpack_fromMethod · 0.80
errorMethod · 0.45

Tested by 7

testMethod · 0.64
assert_eqMethod · 0.64
test_packingMethod · 0.64
test_unpackFunction · 0.64
test_unpackMethod · 0.64
test_fuzz_unpackMethod · 0.64
test_dnsFunction · 0.64