MCPcopy Index your code
hub / github.com/secdev/scapy / getfield

Method getfield

scapy/fields.py:2222–2237  ·  view source on GitHub ↗
(self,
                 pkt,  # type: Packet
                 s,  # type: bytes
                 )

Source from the content-addressed store, hash-verified

2220 return s + self.i2m(pkt, val) + self.DELIMITER
2221
2222 def getfield(self,
2223 pkt, # type: Packet
2224 s, # type: bytes
2225 ):
2226 # type: (...) -> Tuple[bytes, bytes]
2227 len_str = 0
2228 while True:
2229 len_str = s.find(self.DELIMITER, len_str)
2230 if len_str < 0:
2231 # DELIMITER not found: return empty
2232 return b"", s
2233 if len_str % len(self.DELIMITER):
2234 len_str += 1
2235 else:
2236 break
2237 return s[len_str + len(self.DELIMITER):], self.m2i(pkt, s[:len_str])
2238
2239 def randval(self):
2240 # type: () -> RandTermString

Callers

nothing calls this directly

Calls 2

findMethod · 0.80
m2iMethod · 0.45

Tested by

no test coverage detected