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

Method verify

scapy/layers/smb2.py:1980–1999  ·  view source on GitHub ↗

[MS-SMB2] sect 3.2.5.1.3 - Verifying the signature

(
        self, dialect, SigningSessionKey, SigningAlgorithmId=None, IsClient=None
    )

Source from the content-addressed store, hash-verified

1978 self.payload = conf.raw_layer(load=s[64:])
1979
1980 def verify(
1981 self, dialect, SigningSessionKey, SigningAlgorithmId=None, IsClient=None
1982 ):
1983 """
1984 [MS-SMB2] sect 3.2.5.1.3 - Verifying the signature
1985 """
1986 s = bytes(self)
1987 # Set SecuritySignature to nul
1988 s = s[:48] + b"\x00" * 16 + s[64:]
1989 # Calculate the signature
1990 sig = self._calc_signature(
1991 s,
1992 dialect=dialect,
1993 SigningSessionKey=SigningSessionKey,
1994 SigningAlgorithmId=SigningAlgorithmId,
1995 IsClient=IsClient,
1996 )
1997 if self.SecuritySignature != sig:
1998 log_runtime.error("SMB signature is invalid !")
1999 raise Exception("ERROR: SMB signature is invalid !")
2000
2001 def encrypt(self, dialect, EncryptionKey, CipherId):
2002 """

Callers 1

recvMethod · 0.45

Calls 1

_calc_signatureMethod · 0.95

Tested by

no test coverage detected