MCPcopy Create free account
hub / github.com/secdev/scapy / h2i

Method h2i

scapy/layers/dns.py:346–359  ·  view source on GitHub ↗
(self, pkt, x)

Source from the content-addressed store, hash-verified

344 return super(DNSStrField, self).any2i(pkt, x)
345
346 def h2i(self, pkt, x):
347 # Setting a DNSStrField manually (h2i) means any current compression will break
348 if (
349 pkt and
350 isinstance(pkt.parent, DNSCompressedPacket) and
351 pkt.parent.raw_packet_cache
352 ):
353 pkt.parent.clear_cache()
354 if not x:
355 return b"."
356 x = bytes_encode(x)
357 if x[-1:] != b"." and not _is_ptr(x):
358 return x + b"."
359 return x
360
361 def i2m(self, pkt, x):
362 return dns_encode(x, check_built=True)

Callers 2

any2iMethod · 0.95
addfieldMethod · 0.45

Calls 3

bytes_encodeFunction · 0.90
_is_ptrFunction · 0.85
clear_cacheMethod · 0.45

Tested by

no test coverage detected