MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / decodeChallengeSecurityBlob

Function decodeChallengeSecurityBlob

pager_lib/smb/securityblob.py:43–59  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

41
42
43def decodeChallengeSecurityBlob(data):
44 try:
45 d, _ = decoder.decode(data, asn1Spec = NegotiationToken())
46 nt = d.getComponentByName('negTokenTarg')
47
48 token = nt.getComponentByName('responseToken')
49 if not token:
50 raise BadSecurityBlobError('NTLMSSP_CHALLENGE security blob does not contain responseToken field')
51
52 provider_oid = nt.getComponentByName('supportedMech')
53 if provider_oid and str(provider_oid) != '1.3.6.1.4.1.311.2.2.10': # This OID is defined in [MS-NLMP]: 1.9
54 raise UnsupportedSecurityProvider('Security provider "%s" is not supported by pysmb' % str(provider_oid))
55
56 result = nt.getComponentByName('negResult')
57 return int(result), token
58 except Exception as ex:
59 raise BadSecurityBlobError(str(ex))
60
61
62def decodeAuthResponseSecurityBlob(data):

Callers

nothing calls this directly

Calls 5

NegotiationTokenClass · 0.85
getComponentByNameMethod · 0.80
decodeMethod · 0.45

Tested by

no test coverage detected