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

Method getfield

scapy/layers/dcerpc.py:1953–1969  ·  view source on GitHub ↗
(self, pkt, x)

Source from the content-addressed store, hash-verified

1951 NDRConstructedType.__init__(self, pkt_cls.fields_desc)
1952
1953 def getfield(self, pkt, x):
1954 # Handle deformed conformants max_count here
1955 if self.DEPORTED_CONFORMANTS:
1956 # C706 14.3.2: "In other words, the size information precedes the
1957 # structure and is aligned independently of the structure alignment."
1958 fld = NDRInt3264Field("", 0)
1959 max_counts = []
1960 for _ in self.DEPORTED_CONFORMANTS:
1961 x, max_count = fld.getfield(pkt, x)
1962 max_counts.append(max_count)
1963 res, val = super(NDRPacketField, self).getfield(pkt, x)
1964 if len(max_counts) == 1:
1965 val.max_count = max_counts[0]
1966 else:
1967 val.max_counts = max_counts
1968 return res, val
1969 return super(NDRPacketField, self).getfield(pkt, x)
1970
1971 def addfield(self, pkt, s, x):
1972 # Handle deformed conformants max_count here

Callers

nothing calls this directly

Calls 4

getfieldMethod · 0.95
NDRInt3264FieldClass · 0.85
appendMethod · 0.45
getfieldMethod · 0.45

Tested by

no test coverage detected