示例#1
0
    def post_build(self, pkt, pay):
        # calculating checksum if requested
        pdu = pkt + pay
        checksumInfo = self[1].checksum_info(self.hdrlen)

        if checksumInfo is not None:
            (cbegin, cpos) = checksumInfo
            checkbytes = fletcher16_checkbytes(pdu[cbegin:], (cpos - cbegin))
            pdu = pdu[:cpos] + checkbytes + pdu[cpos + 2:]

        return pdu
示例#2
0
文件: isis.py 项目: secdev/scapy
    def post_build(self, pkt, pay):
        # calculating checksum if requested
        pdu = pkt + pay
        checksumInfo = self[1].checksum_info(self.hdrlen)

        if checksumInfo is not None:
            (cbegin, cpos) = checksumInfo
            checkbytes = fletcher16_checkbytes(pdu[cbegin:], (cpos - cbegin))
            pdu = pdu[:cpos] + checkbytes + pdu[cpos+2:]

        return pdu
示例#3
0
def ospf_lsa_checksum(lsa):
    return fletcher16_checkbytes(b"\x00\x00" + lsa[2:], 16)  # leave out age
示例#4
0
文件: ospf.py 项目: commial/scapy
def ospf_lsa_checksum(lsa):
    return fletcher16_checkbytes(b"\x00\x00" + lsa[2:], 16)  # leave out age