scapy.layers.ntlm
NTLM
This is documented in [MS-NLMP]
Note
You will find more complete documentation for this layer over at GSSAPI
- class scapy.layers.ntlm.AV_PAIR(_pkt, /, *, AvId=0, AvLen=None, Value=None)[source]
Bases:
Packet- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | AVID | AVLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | VALUE | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. AV_PAIRAV_PAIR fields AvId
0AvLen
NoneValue
MultipleTypeField(LEIntEnumField, UTCTimeField, PacketField, XStrLenField, StrLenFieldUtf16)b''
- scapy.layers.ntlm.HTTP_ntlm_negotiate(ntlm_negotiate)[source]
Create an HTTP NTLM negotiate packet from an NTLM_NEGOTIATE message
- class scapy.layers.ntlm.LM_RESPONSE(_pkt, /, *, Response=b'')[source]
Bases:
Packet- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | RESPONSE | + + | | + + | | + + | | + + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. LM_RESPONSELM_RESPONSE fields Response
b''
- class scapy.layers.ntlm.LMv2_RESPONSE(_pkt, /, *, Response=b'', ChallengeFromClient=b'')[source]
Bases:
Packet- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | RESPONSE | + + | | + + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | CHALLENGEFROMCLIENT | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. LMv2_RESPONSELMv2_RESPONSE fields Response
b''ChallengeFromClient
b''
- class scapy.layers.ntlm.NEGOEX_EXCHANGE_NTLM(_pkt, /, *, items=[])[source]
Bases:
ASN1_PacketGSSAPI NegoEX Exchange metadata blob This was reversed and may be meaningless
- ASN1_codec = <ASN1Codec BER[1]>
- ASN1_root = <ASN1F_SEQUENCE(<ASN1F_SEQUENCE(<ASN1F_SEQUENCE_OF items>,)>,)>
- aliastypes
- class scapy.layers.ntlm.NEGOEX_EXCHANGE_NTLM_ITEM(_pkt, /, *, oid=<ASN1_OID['.']>, token=<ASN1_PRINTABLE_STRING['']>)[source]
Bases:
ASN1_Packet- ASN1_codec = <ASN1Codec BER[1]>
- ASN1_root = <ASN1F_SEQUENCE(<ASN1F_SEQUENCE(<ASN1F_SEQUENCE(<scapy.asn1fields.ASN1F_OID object>, <scapy.asn1fields.ASN1F_PRINTABLE_STRING object>)>,)>,)>
- aliastypes
- class scapy.layers.ntlm.NTLMSSP(UPN=None, HASHNT=None, PASSWORD=None, USE_MIC=True, VARIANT: NTLM_VARIANT = NTLM_VARIANT.RECENT, NTLM_VALUES={}, DOMAIN_FQDN=None, DOMAIN_NB_NAME=None, COMPUTER_NB_NAME=None, COMPUTER_FQDN=None, IDENTITIES=None, DO_NOT_CHECK_LOGIN=False, SERVER_CHALLENGE=None, **kwargs)[source]
Bases:
SSPThe NTLM SSP
Common arguments:
- param auth_level:
One of DCE_C_AUTHN_LEVEL
- param USE_MIC:
whether to use a MIC or not (default: True)
- param NTLM_VALUES:
a dictionary used to override the following values
In case of a client:
- NegotiateFlags - ProductMajorVersion - ProductMinorVersion - ProductBuild
In case of a server:
- NetbiosDomainName - NetbiosComputerName - DnsComputerName - DnsDomainName (defaults to DOMAIN) - DnsTreeName (defaults to DOMAIN) - Flags - Timestamp
Client-only arguments:
- param UPN:
the UPN to use for NTLM auth. If no domain is specified, will use the one provided by the server (domain in a domain, local if without domain)
- param HASHNT:
the password to use for NTLM auth
- param PASSWORD:
the password to use for NTLM auth
Server-only arguments:
- param DOMAIN_FQDN:
the domain FQDN (default: domain.local)
- param DOMAIN_NB_NAME:
the domain Netbios name (default: strip DOMAIN_FQDN)
- param COMPUTER_NB_NAME:
the server Netbios name (default: SRV)
- param COMPUTER_FQDN:
the server FQDN (default: <computer_nb_name>.<domain_fqdn>)
- param IDENTITIES:
a dict {“username”: <HashNT>} Setting this value enables signature computation and authenticates inbound users.
- class CONTEXT(IsAcceptor, req_flags=None)[source]
Bases:
CONTEXT- ExportedSessionKey
- IsAcceptor
- RecvSealHandle
- RecvSealKey
- RecvSeqNum
- RecvSignKey
- SendSealHandle
- SendSealKey
- SendSeqNum
- SendSignKey
- ServerDomain
- ServerHostname
- SessionKey
- chall_tok
- neg_tok
- GSS_Accept_sec_context(Context: ~scapy.layers.ntlm.NTLMSSP.CONTEXT, input_token=None, req_flags: ~scapy.layers.gssapi.GSS_S_FLAGS | None = <GSS_S_FLAGS.GSS_S_ALLOW_MISSING_BINDINGS: 268435456>, chan_bindings: ~scapy.layers.gssapi.GssChannelBindings = b'\x00')[source]
- GSS_Init_sec_context(Context: CONTEXT, input_token=None, target_name: str | None = None, req_flags: GSS_C_FLAGS | None = None, chan_bindings: GssChannelBindings = b'\x00')[source]
- MaximumSignatureLength(Context: CONTEXT)[source]
Returns the Maximum Signature length.
This will be used in auth_len in DceRpc5, and is necessary for PFC_SUPPORT_HEADER_SIGN to work properly.
- NTLM_MaxLifetime = 129600
- class STATE(*values)[source]
Bases:
STATE- CLI_SENT_AUTH = 3
- CLI_SENT_NEGO = 2
- INIT = 1
- SRV_SENT_CHAL = 4
- auth_type = 10
- class scapy.layers.ntlm.NTLMSSP_DOMAIN(UPN=None, *args, timeout=3, ssp=None, **kwargs)[source]
Bases:
NTLMSSPA variant of the NTLMSSP to be used in server mode that gets the session keys from the domain using a Netlogon channel.
This has the same arguments as NTLMSSP, but supports the following in server mode:
- Parameters:
UPN – the UPN of the machine account to login for Netlogon.
HASHNT – the HASHNT of the machine account (use Netlogon secure channel).
ssp – a KerberosSSP to use (use Kerberos secure channel).
PASSWORD – the PASSWORD of the machine account to use for Netlogon.
DC_IP – (optional) specify the IP of the DC.
Netlogon example:
>>> mySSP = NTLMSSP_DOMAIN( ... UPN="Server1@domain.local", ... HASHNT=bytes.fromhex("8846f7eaee8fb117ad06bdd830b7586c"), ... )
Kerberos example:
>>> mySSP = NTLMSSP_DOMAIN( ... UPN="Server1@domain.local", ... KEY=Key(EncryptionType.AES256_CTS_HMAC_SHA1_96, ... key=bytes.fromhex( ... "85abb9b61dc2fa49d4cc04317bbd108f8f79df28" ... "239155ed7b144c5d2ebcf016" ... ) ... ), ... )
- class scapy.layers.ntlm.NTLMSSP_MESSAGE_SIGNATURE(_pkt, /, *, Version=1, Checksum=b'', SeqNum=0)[source]
Bases:
Packet- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | VERSION | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | CHECKSUM | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SEQNUM | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. NTLMSSP_MESSAGE_SIGNATURENTLMSSP_MESSAGE_SIGNATURE fields Version
1Checksum
b''SeqNum
0
- class scapy.layers.ntlm.NTLM_AUTHENTICATE(_pkt, /, *, Signature=b'NTLMSSP\x00', MessageType=3, LmChallengeResponseLen=None, LmChallengeResponseMaxLen=None, LmChallengeResponseBufferOffset=None, NtChallengeResponseLen=None, NtChallengeResponseMaxLen=None, NtChallengeResponseBufferOffset=None, DomainNameLen=None, DomainNameMaxLen=None, DomainNameBufferOffset=None, UserNameLen=None, UserNameMaxLen=None, UserNameBufferOffset=None, WorkstationLen=None, WorkstationMaxLen=None, WorkstationBufferOffset=None, EncryptedRandomSessionKeyLen=None, EncryptedRandomSessionKeyMaxLen=None, EncryptedRandomSessionKeyBufferOffset=None, NegotiateFlags=<Flag 0 ()>, ProductMajorVersion=0, ProductMinorVersion=0, ProductBuild=0, res_ver=0, NTLMRevisionCurrent=15, MIC=b'', Payload=[])[source]
Bases:
_NTLM_VARIANT_Packet,NTLM_Header- NTLM_VERSION = 1
- VARIANT
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SIGNATURE | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MESSAGETYPE | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | LMCHALLENGERESPONSELEN | LMCHALLENGERESPONSEMAXLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | LMCHALLENGERESPONSEBUFFEROFFSET | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | NTCHALLENGERESPONSELEN | NTCHALLENGERESPONSEMAXLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | NTCHALLENGERESPONSEBUFFEROFFSET | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | DOMAINNAMELEN | DOMAINNAMEMAXLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | DOMAINNAMEBUFFEROFFSET | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | USERNAMELEN | USERNAMEMAXLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | USERNAMEBUFFEROFFSET | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | WORKSTATIONLEN | WORKSTATIONMAXLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | WORKSTATIONBUFFEROFFSET | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ENCRYPTEDRANDOMSESSIONKEYLEN |ENCRYPTEDRANDOMSESSIONKEYMAXLEN| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | ENCRYPTEDRANDOMSESSIONKEYBUFFEROFFSET | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | NEGOTIATEFLAGS | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |PRODUCTMAJORVER|PRODUCTMINORVER| PRODUCTBUILD | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | RES VER | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |NTLMREVISIONCUR| MIC | +-+-+-+-+-+-+-+-+ + | | + + | | + + | | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | PAYLOAD | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. NTLM_AUTHENTICATENTLM_AUTHENTICATE fields Signature
b'NTLMSSP\x00'MessageType
3LmChallengeResponseLen
NoneLmChallengeResponseMaxLen
NoneLmChallengeResponseBufferOffset
NoneNtChallengeResponseLen
NoneNtChallengeResponseMaxLen
NoneNtChallengeResponseBufferOffset
NoneDomainNameLen
NoneDomainNameMaxLen
NoneDomainNameBufferOffset
NoneUserNameLen
NoneUserNameMaxLen
NoneUserNameBufferOffset
NoneWorkstationLen
NoneWorkstationMaxLen
NoneWorkstationBufferOffset
NoneEncryptedRandomSessionKeyLen
NoneEncryptedRandomSessionKeyMaxLen
NoneEncryptedRandomSessionKeyBufferOffset
NoneNegotiateFlags
<Flag 0 ()>ProductMajorVersion
ByteField(Cond)0ProductMinorVersion
ByteField(Cond)0ProductBuild
LEShortField(Cond)0res_ver
LEThreeBytesField(Cond)0NTLMRevisionCurrent
ByteEnumField(Cond)15MIC
XStrFixedLenField(Cond)b''Payload
_NTLMPayloadField[]
- class scapy.layers.ntlm.NTLM_AUTHENTICATE_V2(_pkt, /, *, Signature=b'NTLMSSP\x00', MessageType=3, LmChallengeResponseLen=None, LmChallengeResponseMaxLen=None, LmChallengeResponseBufferOffset=None, NtChallengeResponseLen=None, NtChallengeResponseMaxLen=None, NtChallengeResponseBufferOffset=None, DomainNameLen=None, DomainNameMaxLen=None, DomainNameBufferOffset=None, UserNameLen=None, UserNameMaxLen=None, UserNameBufferOffset=None, WorkstationLen=None, WorkstationMaxLen=None, WorkstationBufferOffset=None, EncryptedRandomSessionKeyLen=None, EncryptedRandomSessionKeyMaxLen=None, EncryptedRandomSessionKeyBufferOffset=None, NegotiateFlags=<Flag 0 ()>, ProductMajorVersion=0, ProductMinorVersion=0, ProductBuild=0, res_ver=0, NTLMRevisionCurrent=15, MIC=b'', Payload=[])[source]
Bases:
NTLM_AUTHENTICATE- NTLM_VERSION = 2
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SIGNATURE | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MESSAGETYPE | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | LMCHALLENGERESPONSELEN | LMCHALLENGERESPONSEMAXLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | LMCHALLENGERESPONSEBUFFEROFFSET | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | NTCHALLENGERESPONSELEN | NTCHALLENGERESPONSEMAXLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | NTCHALLENGERESPONSEBUFFEROFFSET | +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+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |NTLMREVISIONCUR| MIC | +-+-+-+-+-+-+-+-+ + | | + + | | + + | | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | PAYLOAD | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. NTLM_AUTHENTICATE_V2NTLM_AUTHENTICATE_V2 fields Signature
b'NTLMSSP\x00'MessageType
3LmChallengeResponseLen
NoneLmChallengeResponseMaxLen
NoneLmChallengeResponseBufferOffset
NoneNtChallengeResponseLen
NoneNtChallengeResponseMaxLen
NoneNtChallengeResponseBufferOffset
NoneDomainNameLen
NoneDomainNameMaxLen
NoneDomainNameBufferOffset
NoneUserNameLen
NoneUserNameMaxLen
NoneUserNameBufferOffset
NoneWorkstationLen
NoneWorkstationMaxLen
NoneWorkstationBufferOffset
NoneEncryptedRandomSessionKeyLen
NoneEncryptedRandomSessionKeyMaxLen
NoneEncryptedRandomSessionKeyBufferOffset
NoneNegotiateFlags
<Flag 0 ()>ProductMajorVersion
ByteField(Cond)0ProductMinorVersion
ByteField(Cond)0ProductBuild
LEShortField(Cond)0res_ver
LEThreeBytesField(Cond)0NTLMRevisionCurrent
ByteEnumField(Cond)15MIC
XStrFixedLenField(Cond)b''Payload
_NTLMPayloadField[]
- class scapy.layers.ntlm.NTLM_CHALLENGE(_pkt, /, *, Signature=b'NTLMSSP\x00', MessageType=2, TargetNameLen=None, TargetNameMaxLen=None, TargetNameBufferOffset=None, NegotiateFlags=<Flag 0 ()>, ServerChallenge=None, Reserved=None, TargetInfoLen=None, TargetInfoMaxLen=None, TargetInfoBufferOffset=None, ProductMajorVersion=0, ProductMinorVersion=0, ProductBuild=0, res_ver=0, NTLMRevisionCurrent=15, Payload=[])[source]
Bases:
_NTLM_VARIANT_Packet,NTLM_Header- VARIANT
- aliastypes
- fields_desc
Display RFC-like schema
0 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+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |NTLMREVISIONCUR| PAYLOAD | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. NTLM_CHALLENGENTLM_CHALLENGE fields Signature
b'NTLMSSP\x00'MessageType
2TargetNameLen
NoneTargetNameMaxLen
NoneTargetNameBufferOffset
NoneNegotiateFlags
<Flag 0 ()>ServerChallenge
NoneReserved
NoneTargetInfoLen
NoneTargetInfoMaxLen
NoneTargetInfoBufferOffset
NoneProductMajorVersion
ByteField(Cond)0ProductMinorVersion
ByteField(Cond)0ProductBuild
LEShortField(Cond)0res_ver
LEThreeBytesField(Cond)0NTLMRevisionCurrent
ByteEnumField(Cond)15Payload
_NTLMPayloadField[]
- class scapy.layers.ntlm.NTLM_Header(_pkt, /, *, Signature=b'NTLMSSP\x00', MessageType=3)[source]
Bases:
Packet- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SIGNATURE | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MESSAGETYPE | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. NTLM_HeaderNTLM_Header fields Signature
b'NTLMSSP\x00'MessageType
3
- class scapy.layers.ntlm.NTLM_NEGOTIATE(_pkt, /, *, Signature=b'NTLMSSP\x00', MessageType=1, NegotiateFlags=<Flag 0 ()>, DomainNameLen=None, DomainNameMaxLen=None, DomainNameBufferOffset=None, WorkstationNameLen=None, WorkstationNameMaxLen=None, WorkstationNameBufferOffset=None, ProductMajorVersion=0, ProductMinorVersion=0, ProductBuild=0, res_ver=0, NTLMRevisionCurrent=15, Payload=[])[source]
Bases:
_NTLM_VARIANT_Packet,NTLM_Header- VARIANT
- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SIGNATURE | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MESSAGETYPE | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | NEGOTIATEFLAGS | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | DOMAINNAMELEN | DOMAINNAMEMAXLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | DOMAINNAMEBUFFEROFFSET | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | WORKSTATIONNAMELEN | WORKSTATIONNAMEMAXLEN | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | WORKSTATIONNAMEBUFFEROFFSET | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |PRODUCTMAJORVER|PRODUCTMINORVER| PRODUCTBUILD | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | RES VER | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |NTLMREVISIONCUR| PAYLOAD | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. NTLM_NEGOTIATENTLM_NEGOTIATE fields Signature
b'NTLMSSP\x00'MessageType
1NegotiateFlags
<Flag 0 ()>DomainNameLen
NoneDomainNameMaxLen
NoneDomainNameBufferOffset
NoneWorkstationNameLen
NoneWorkstationNameMaxLen
NoneWorkstationNameBufferOffset
NoneProductMajorVersion
ByteField(Cond)0ProductMinorVersion
ByteField(Cond)0ProductBuild
LEShortField(Cond)0res_ver
LEThreeBytesField(Cond)0NTLMRevisionCurrent
ByteEnumField(Cond)15Payload
_NTLMPayloadField[]
- class scapy.layers.ntlm.NTLM_RESPONSE(_pkt, /, *, Response=b'')[source]
Bases:
Packet- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | RESPONSE | + + | | + + | | + + | | + + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. NTLM_RESPONSENTLM_RESPONSE fields Response
b''
- class scapy.layers.ntlm.NTLM_VARIANT(*values)[source]
Bases:
IntEnumThe message variant to use for NTLM.
- NT_OR_2000 = 0
- RECENT = 2
- XP_OR_2003 = 1
- class scapy.layers.ntlm.NTLMv2_CLIENT_CHALLENGE(_pkt, /, *, RespType=1, HiRespType=1, Reserved1=0, Reserved2=0, TimeStamp=None, ChallengeFromClient=b'12345678', Reserved3=0, AvPairs=[<AV_PAIR |>])[source]
Bases:
Packet- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | RESPTYPE | HIRESPTYPE | RESERVED1 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | RESERVED2 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TIMESTAMP | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | CHALLENGEFROMCLIENT | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | RESERVED3 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | AVPAIRS | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. NTLMv2_CLIENT_CHALLENGENTLMv2_CLIENT_CHALLENGE fields RespType
1HiRespType
1Reserved1
0Reserved2
0TimeStamp
NoneChallengeFromClient
b'12345678'Reserved3
0AvPairs
[<AV_PAIR |>]
- class scapy.layers.ntlm.NTLMv2_RESPONSE(_pkt, /, *, NTProofStr=b'', RespType=1, HiRespType=1, Reserved1=0, Reserved2=0, TimeStamp=None, ChallengeFromClient=b'12345678', Reserved3=0, AvPairs=[<AV_PAIR |>])[source]
Bases:
NTLMv2_CLIENT_CHALLENGE- aliastypes
- computeNTProofStr(ResponseKeyNT, ServerChallenge)[source]
- Set temp to ConcatenationOf(Responserversion, HiResponserversion,
Z(6), Time, ClientChallenge, Z(4), ServerName, Z(4))
- Set NTProofStr to HMAC_MD5(ResponseKeyNT,
ConcatenationOf(CHALLENGE_MESSAGE.ServerChallenge,temp))
Remember ServerName = AvPairs
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | NTPROOFSTR | + + | | + + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | RESPTYPE | HIRESPTYPE | RESERVED1 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | RESERVED2 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TIMESTAMP | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | CHALLENGEFROMCLIENT | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | RESERVED3 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | AVPAIRS | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. NTLMv2_RESPONSENTLMv2_RESPONSE fields NTProofStr
b''RespType
1HiRespType
1Reserved1
0Reserved2
0TimeStamp
NoneChallengeFromClient
b'12345678'Reserved3
0AvPairs
[<AV_PAIR |>]
- scapy.layers.ntlm.NTOWFv2(Passwd, User, UserDom, HashNt=None)[source]
Computes the ResponseKeyNT (per [MS-NLMP] sect 3.3.2)
- Parameters:
Passwd – the plain password
User – the username
UserDom – the domain name
HashNt – (out of spec) if you have the HashNt, use this and set Passwd to None
- scapy.layers.ntlm.RC4K(key, data)[source]
Indicates the encryption of data item D with the key K using the RC4 algorithm.
- class scapy.layers.ntlm.Single_Host_Data(_pkt, /, *, Size=None, Z4=0, Flags=<Flag 0 ()>, TokenIL=8192, MachineID=b'', PermanentMachineID=None)[source]
Bases:
Packet- aliastypes
- fields_desc
Display RFC-like schema
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SIZE | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Z4 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | FLAGS | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | TOKENIL | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MACHINEID | + + | | + + | | + + | | + + | | + + | | + + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | PERMANENTMACHINEID | + + | | + + | | + + | | + + | | + + | | + + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Fig. Single_Host_DataSingle_Host_Data fields Size
NoneZ4
0Flags
<Flag 0 ()>TokenIL
8192MachineID
b''PermanentMachineID
XStrFixedLenField(Cond)None