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

Method post_build

scapy/layers/dcerpc.py:931–956  ·  view source on GitHub ↗
(self, pkt, pay)

Source from the content-addressed store, hash-verified

929 return s[:pay_len], s[pay_len:]
930
931 def post_build(self, pkt, pay):
932 if (
933 self.auth_verifier
934 and self.auth_padding is None
935 and self.auth_verifier.auth_pad_length is None
936 ):
937 # Compute auth_len and add padding
938 auth_len = self.get_field("auth_len").getfield(self, pkt[10:12])[1] + 8
939 auth_verifier, pay = pay[-auth_len:], pay[:-auth_len]
940 pdu_len = len(pay)
941 if self.payload:
942 pdu_len -= len(self.payload.self_build())
943 padlen = (-pdu_len) % _COMMON_AUTH_PAD
944 auth_verifier = (
945 auth_verifier[:2] + struct.pack("B", padlen) + auth_verifier[3:]
946 )
947 pay = pay + (padlen * b"\x00") + auth_verifier
948 if self.frag_len is None:
949 # Compute frag_len
950 length = len(pkt) + len(pay)
951 pkt = (
952 pkt[:8]
953 + self.get_field("frag_len").addfield(self, b"", length)
954 + pkt[10:]
955 )
956 return pkt + pay
957
958 def answers(self, pkt):
959 return isinstance(pkt, DceRpc5) and pkt[DceRpc5].call_id == self.call_id

Callers

nothing calls this directly

Calls 4

get_fieldMethod · 0.80
getfieldMethod · 0.45
self_buildMethod · 0.45
addfieldMethod · 0.45

Tested by

no test coverage detected