
    iȫ                     L   S SK r S SKrS SKrS SKrS SKrS SKrS SKrS SKJr  S SK	J
r   " S S\R                  5      r " S S\R                  5      r " S S	\R                  5      r " S
 S\R                   5      rS\S\R&                  \   S\4S jr S-S\R,                  S\S\S\R0                  \R2                  \R,                  /\4      S\R6                  \\4   4
S jjr S-S\S\S\R0                  \R2                  \/\R,                  4      S\R,                  4S jjr " S S\5      r " S S\S9r  " S S\ 5      r! " S S \ 5      r" " S! S"\ 5      r# " S# S$\R                  5      r$ " S% S&5      r% " S' S(\ RL                  5      r' " S) S*5      r( " S+ S,5      r)g).    N)to_text)__version__c                       \ rS rSrSrSrSrSrSrSr	Sr
S	rS
rSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSr Sr!Sr"S r#S!r$\%S"\&RN                  S \(4   4S# j5       r)S$r*g%)&NegotiateFlags   zNTLM Negotiation flags.

Used during NTLM negotiation to negotiate the capabilities between the client and server.

.. _NEGOTIATE:
    https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-nlmp/99d90ff4-957f-4c8a-80e4-5bfe5a9a9832
l        i   @i    i   i   i   i   i   i   i  @ i    i   i   i   i   i   i   i @  i    i   i   i   i         @                   returnc                 ,   0 [         R                  S_[         R                  S_[         R                  S_[         R                  S_[         R
                  S_[         R                  S_[         R                  S_[         R                  S_[         R                  S	_[         R                  S
_[         R                  S_[         R                  S_[         R                  S_[         R                  S_[         R                  S_[         R                   S_[         R"                  S_[         R$                  S[         R&                  S[         R(                  S[         R*                  S[         R,                  S[         R.                  S[         R0                  S[         R2                  S[         R4                  S[         R6                  S[         R8                  S[         R:                  S[         R<                  S[         R>                  S[         R@                  S 0E$ )!NNTLMSSP_NEGOTIATE_56NTLMSSP_NEGOTIATE_KEY_EXCHNTLMSSP_NEGOTIATE_128NTLMSSP_RESERVED_R1NTLMSSP_RESERVED_R2NTLMSSP_RESERVED_R3NTLMSSP_NEGOTIATE_VERSIONNTLMSSP_RESERVED_R4NTLMSSP_NEGOTIATE_TARGET_INFO"NTLMSSP_REQUEST_NON_NT_SESSION_KEYNTLMSSP_RESERVED_R5NTLMSSP_NEGOTIATE_IDENTITY*NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITYzNTLMSSP_TARGET_TYPE_SHARE - R6NTLMSSP_TARGET_TYPE_SERVERNTLMSSP_TARGET_TYPE_DOMAINNTLMSSP_NEGOTIATE_ALWAYS_SIGNz!NTLMSSP_NEGOTIATE_LOCAL_CALL - R7*NTLMSSP_NEGOTIATE_OEM_WORKSTATION_SUPPLIED%NTLMSSP_NEGOTIATE_OEM_DOMAIN_SUPPLIEDNTLMSSP_ANOYNMOUSNTLMSSP_RESERVED_R8NTLMSSP_NEGOTIATE_NTLMNTLMSSP_RESERVED_R9NTLMSSP_NEGOTIATE_LM_KEYNTLMSSP_NEGOTIATE_DATAGRAMNTLMSSP_NEGOTIATE_SEALNTLMSSP_NEGOTIATE_SIGNzNTLMSSP_NEGOTIATE_NETWARE - R10NTLMSSP_REQUEST_TARGETNTLMSSP_NEGOTIATE_OEMNTLMSSP_NEGOTIATE_UNICODE)!r   key_56key_exchkey_128r1r2r3versionr4target_infonon_nt_session_keyr5identityextended_session_securitytarget_type_sharetarget_type_servertarget_type_domainalways_sign
local_calloem_workstation_suppliedoem_domain_name_supplied	anonymousr8ntlmr9lm_keydatagramsealsignnetwarerequest_targetoemunicodeclss    S/home/james-whalen/.local/lib/python3.13/site-packages/spnego/_ntlm_raw/messages.pynative_labelsNegotiateFlags.native_labels:   s   !
!!#9!
##%A!
 ""$;!
 4	!

 4!
 4!
 ""$?!
 4!
 &&(G!
 --/S!
 4!
 ##%A!
 446b!
 ,,.N!
 --/K!
  --/K!!
" &&(G#!
$ %%'J335a335\$$&94!94!!#=##%A!9!9""$E))+C 7""$?A!
 !	
     N)+__name__
__module____qualname____firstlineno____doc__r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   classmethodtypingDictstrrR   __static_attributes__rU   rT   rQ   r   r      s     FHG	B	B	BG	BK#	BH *"##KJ))I	BD	BFHDDGN
CG"
fkk*:C*?@ "
 "
rT   r   c                   z    \ rS rSrSrSrSrSrSrSr	Sr
S	rS
rSrSrSr\S\R$                  S \4   4S j5       rSrg)AvId`   zID for an NTLM AV_PAIR.

These are the IDs that can be set as the `AvId` on an `AV_PAIR`_.

.. _AV_PAIR:
    https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-nlmp/83f5e789-660d-4781-8491-5f8c6641f75e
r   r   r      r            r   	   
   r   c                 f   [         R                  S[         R                  S[         R                  S[         R                  S[         R
                  S[         R                  S[         R                  S[         R                  S[         R                  S	[         R                  S
[         R                  S0$ )N
MSV_AV_EOLMSV_AV_NB_COMPUTER_NAMEMSV_AV_NB_DOMAIN_NAMEMSV_AV_DNS_COMPUTER_NAMEMSV_AV_DNS_DOMAIN_NAMEMSV_AV_DNS_TREE_NAMEMSV_AV_FLAGSMSV_AV_TIMESTAMPMSV_AV_SINGLE_HOSTMSV_AV_TARGET_NAMEMSV_AV_CHANNEL_BINDINGS)ra   eolnb_computer_namenb_domain_namedns_computer_namedns_domain_namedns_tree_nameflags	timestampsingle_hosttarget_namechannel_bindingsrO   s    rQ   rR   AvId.native_labelsu   s     HHl!!#<!8""$>  ": 6JJNN.22!!#<
 	
rT   rU   N)rV   rW   rX   rY   rZ   ru   rv   rw   rx   ry   rz   r{   r|   r}   r~   r   r[   r\   r]   r^   rR   r_   rU   rT   rQ   ra   ra   `   si     CNOMEIKK
fkk&#+6 
 
rT   ra   c                   ^    \ rS rSrSrSrSrSrSr\	S\
R                  S \4   4S j5       rS	rg
)AvFlags   zMsvAvFlags for an AV_PAIR.

These are the flags that can be set on the MsvAvFlags entry of an NTLM `AV_PAIR`_.

.. _AV_PAIR:
    https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-nlmp/83f5e789-660d-4781-8491-5f8c6641f75e
r   r   r   r   r   c                 f    [         R                  S[         R                  S[         R                  S0$ )NAUTHENTICATION_CONSTRAINEDMIC_PROVIDEDUNTRUSTED_SPN_SOURCE)r   constrainedmicuntrusted_spnrO   s    rQ   rR   AvFlags.native_labels   s/     !=KK!!#9
 	
rT   rU   N)rV   rW   rX   rY   rZ   noner   r   r   r[   r\   r]   r^   rR   r_   rU   rT   rQ   r   r      sC     DK
CM
fkk)S.9 
 
rT   r   c                   V    \ rS rSrSrSrSr\S\R                  S \
4   4S j5       rSrg)	MessageType   r   r   rc   r   c                 f    [         R                  S[         R                  S[         R                  S0$ )NNEGOTIATE_MESSAGECHALLENGE_MESSAGEAUTHENTICATE_MESSAGE)r   	negotiate	challengeauthenticaterO   s    rQ   rR   MessageType.native_labels   s2     !!#6!!#6$$&<
 	
rT   rU   N)rV   rW   rX   rY   r   r   r   r[   r\   r]   r^   rR   r_   rU   rT   rQ   r   r      s8    IIL
fkk-*<= 
 
rT   r   b_datafield_offsetsr   c                     S nU HL  n[         R                  " SXS-   US-    R                  5       5      S   nU(       a  U(       d  MC  XB:  d  MJ  UnMN     U=(       d    [        U 5      $ N<Ir   r   r   )structunpacktobyteslen)r   r   payload_offsetfield_offsetoffsets        rQ   _get_payload_offsetr      sa    N%tV1,<|a?O%P%X%X%Z[\]^&&V-D#N &
 (S[(rT   data	b_payloadr   	pack_funcc                     U (       a  U(       a  U" U 5      OU nOSnUR                  U5        [        U5      n[        R                  " SU5      S-  [        R                  " SU5      -   nX%-  nXb4$ )NrT   <Hr   r   )extendr   r   pack)r   r   r   r   r   lengthb_fields          rQ   _pack_payloadr      sf     $-44V[F{{4(1,D.0QQGN""rT   r   unpack_funcc                    [         R                  " SXUS-    R                  5       5      S   nU(       aU  [         R                  " SXS-   US-    R                  5       5      S   nXX-    R                  5       nU(       a  U" U5      $ U$ g )Nr   r   r   r   r   r   )r   r   r   )r   r   r   	field_lenb_values        rQ   _unpack_payloadr      s    
 dF,:J$K$S$S$UVWXYI}}T62B\TUEU+V+^+^+`abcd(@AIIK'2{7#??	 rT   c                      ^  \ rS rSr% 0 r\R                  \\R                  4   \	S'   S\R                  S\R                  SS4S jrS\R                  S\R                  SS 4U 4S jjrS	rU =r$ )
_NTLMMessageMeta   _NTLMMessageMeta__registryargskwargsr   Nc                 6    X R                   [        U SS5      '   g )NMESSAGE_TYPEr   )r   getattr)rP   r   r   s      rQ   __init___NTLMMessageMeta.__init__   s    
 ;>wsNA67rT   c                    > SU;   a0  [         R                  " SUS   SS 5      S   nU R                  U   nOU n[        [        U]  " U0 UD6$ )N_b_datar   r      r   )r   r   r   superr   __call__)rP   r   r   message_typenew_cls	__class__s        rQ   r   _NTLMMessageMeta.__call__   s[    
 !==vi/@2/FGJLnn\2G G%w8$I&IIrT   rU   )rV   rW   rX   rY   r   r\   r]   intType__annotations__Anyr   r   r_   __classcell__r   s   @rQ   r   r      s{    02JC,-2>zz> **> 
	>JzzJ **J 
	J JrT   r   c                       \ rS rSrSrSrSrSS\R                  \	   S\R                  \
   SS4S jjrS\
4S	 jr\SS
\
S\R                  \	   SS 4S jj5       rSrg)NTLMMessage   zCBase NTLM message class that defines the pack and unpack functions.r   Nencodingr   r   c                 N   S[         R                  " SU R                  5      -   U l        U=(       d    SU l        U(       aU  [        U5      U R                  :  a"  [        SU R                  R                  -  5      e[        [        U5      5      U l        g [        S5      U l        g )Ns   NTLMSSP r   zwindows-1252zInvalid NTLM %s raw byte lengthrT   )r   r   r   	signature	_encodingr   MINIMUM_LENGTH
ValueErrorr   rV   
memoryview	bytearray_data)selfr   r   s      rQ   r   NTLMMessage.__init__   sy    '&++dD<M<M*NN!3^7|d111 !BT^^E\E\!\]]#Ig$67DJ $CDJrT   c                 6    U R                   R                  5       $ Packs the structure to bytes.r   r   r   s    rQ   r   NTLMMessage.pack      zz!!##rT   r   c                     [        XS9$ )!Unpacks the structure from bytes.r   r   )r   )r   r   s     rQ   r   NTLMMessage.unpack  s     H==rT   )r   r   r   )NNN)rV   rW   rX   rY   rZ   r   r   r\   Optionalr^   bytesr   r   staticmethodr   r_   rU   rT   rQ   r   r      s{    MLN)!5 )vW\G] )im )$e $ >u >(< > > >rT   r   )	metaclassc                   .  ^  \ rS rSrSr\R                  rSr      SS\	S\
R                  \   S\
R                  \   S\
R                  S	   S
\
R                  \   S\
R                  \   SS4U 4S jjjr\S\	4S j5       r\R"                  S\	SS4S j5       r\S\
R                  \   4S j5       r\S\
R                  \   4S j5       r\S\
R                  S	   4S j5       r\S\	4S j5       r\SS\S
\
R                  \   SS 4S jj5       rSrU =r$ )	Negotiatei  ak  NTLM Negotiate Message

This structure represents an NTLM `NEGOTIATE_MESSAGE`_ that can be serialized and deserialized to and from
bytes.

Args:
    flags: The `NegotiateFlags` that the client has negotiated.
    domain_name: The `DomainName` of the client authentication domain.
    workstation: The `Workstation` of the client.
    version: The `Version` of the client.
    encoding: The OEM encoding to use for text fields.
    _b_data: The raw bytes of the message to unpack from.

.. _NEGOTIATE_MESSAGE:
    https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-nlmp/b34032e5-3aae-4bc6-84c3-c6d80eadf7f2
r   Nr{   domain_nameworkstationr5   Versionr   r   r   c                   > [         [        U ]  XVS9  U(       GdQ  [        5       nSnSn	U(       a#  U[        R
                  -  nUR                  5       n	[        XU5      S   nSn
U(       a.  U[        R                  -  nUR                  U R                  5      n
[        XU5      u  pSnU(       a.  U[        R                  -  nUR                  U R                  5      n[        XU5      S   n[        U R                  5      nUR                  [        R                  " SU5      5        UR                  U5        UR                  U5        UR                  U5        [        U5      U l        g g )Nr   r   rT   r   r   r   )r   r   r   r   r   r5   r   r   rB   encoder   rA   r   r   r   r   r   )r   r{   r   r   r5   r   r   r   r   	b_versionb_domain_nameb_domain_name_fieldsb_workstationb_workstation_fieldsr   r   s                  rQ   r   Negotiate.__init__"  s3    	i''K!INI///#LLN	*9PQRSNM@@@ + 2 24>> B3@[i3j0 M@@@ + 2 24>> B#0>#Z[\#] t~~.FMM&++dE23MM./MM./MM)$#F+DJ; rT   c                 l    [         R                  " SU R                  SS R                  5       5      S   $ )z.The negotiate flags for the Negotiate message.r   r   r   r   r   r   r   r   r   s    rQ   r{   Negotiate.flagsL  .     }}T4::b#4#<#<#>?BBrT   valuec                 L    [         R                  " SU5      U R                  SS& g )Nr   r   r   r   r   r   r   r   s     rQ   r{   r   Q      "KKe4

2brT   c                 V    [        [        U R                  S5      U R                  SSS9$ )z-The name of the client authentication domain.r   replacepassthrur   errors	nonstringr   r   r   r   r   s    rQ   r   Negotiate.domain_nameU  &     tzz26XamwxxrT   c                 V    [        [        U R                  S5      U R                  SSS9$ )zThe name of the client machine.   r  r  r  r  r   s    rQ   r   Negotiate.workstationZ  r
  rT   c                     U R                   nUS:  a0  [        R                  U R                  SS R	                  5       5      $ g)The client NTLM version.(   r   N_payload_offsetr   r   r   r   r   r   s     rQ   r5   Negotiate.version_  A     -- R>>$**R"3";";"=>> rT   c                 2    [        U R                  SS/5      $ )+Gets the offset of the first payload value.r   r  r   r   r   s    rQ   r  Negotiate._payload_offsetk       #4::Bx88rT   r   c                 l    [         R                  XS9n[        U[        5      (       d  [	        S5      eU$ )Nr   z.Input message was not a NTLM Negotiate message)r   r   
isinstancer   r   r   r   msgs      rQ   r   Negotiate.unpackp  3       ;#y))MNN
rT   )r   )r   NNNNNr   )rV   rW   rX   rY   rZ   r   r   r   r   r   r\   r   r^   r   r   propertyr{   setterr   r   r5   r  r   r   r_   r   r   s   @rQ   r   r     s   " ((LN ,0,0.2)-*.(,(, __S)(, __S)	(,
 +(, //#&(, '(, 
(, (,T Cs C C \\53 54 5 5 yV__S1 y y yV__S1 y y 	3 	 	 9 9 9 u (<   rT   r   c                     ^  \ rS rSrSr\R                  rSr       SS\	S\
R                  \   S\
R                  \   S\
R                  S	   S
\
R                  S   S\
R                  \   S\
R                  \   4U 4S jjjr\S\
R                  \   4S j5       r\S\	4S j5       r\R$                  S\	SS4S j5       r\S\4S j5       r\R$                  S\SS4S j5       r\S\
R                  S	   4S j5       r\S\
R                  S   4S j5       r\S\	4S j5       r\SS\S\
R                  \   SS 4S jj5       rSrU =r$ )	Challengeiy  a  NTLM Challenge Message

This structure represents an NTLM `CHALLENGE_MESSAGE`_ that can be serialized and deserialized to and from
bytes.

Args:
    flags: The `NegotiateFlags` that the client has negotiated.
    server_challenge: The random 64-bit `ServerChallenge` nonce.
    target_name: The name of the acceptor server.
    target_info: The variable length `TargetInfo` information.
    version: The `Version` of the server.
    encoding: The OEM encoding to use for text fields if `NTLMSSP_NEGOTIATE_UNICODE` was not supported.
    _b_data: The raw NTLM Challenge bytes to unpack from.

.. _CHALLENGE_MESSAGE:
    https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-nlmp/801a4681-8809-4be9-ab0d-61dcfe762786
0   Nr{   server_challenger~   r7   
TargetInfor5   r   r   r   c                   > [         [        U ]  XgS9  U(       a6  U R                  [        R
                  -  (       a  SOU R                  U l        g U[        R
                  -  (       a  SOU R                  U l        [        5       nSn	Sn
U(       a#  U[        R                  -  nUR                  5       n
[        XU	5      S   n	SnU(       a.  U[        R                  -  nUR                  U R                  5      n[        XU	5      u  pSnU(       a#  U[        R                  -  nUR                  5       n[        XU	5      S   n[        U R                  5      nUR                  U5        UR                  [         R                  " SU5      5        UR                  S5        UR                  S5        UR                  U5        UR                  U5        [#        U5      U l        U(       a  X l        g g )	Nr   	utf-16-ler&  rT   r   r   r              )r   r%  r   r{   r   rN   r   r   r5   r   r   rL   r   r7   r   r   r   r   r   r'  )r   r{   r'  r~   r7   r5   r   r   r   r   r   b_target_nameb_target_name_fieldsb_target_infob_target_info_fieldsr   r   s                   rQ   r   Challenge.__init__  s    	i''K,0JJ9O9O,O[UYUcUcDN -2N4J4J,J[PTP^P^DN!INI///#LLN	*9PQRSNM666 + 2 24>> B3@[i3j0 M333 + 0 0 2#0>#Z[\#] t~~.FMM./MM&++dE23MM+&MM+&MM./MM)$#F+DJ(8%  rT   r   c                 T    [        [        U R                  S5      U R                  SS9$ )z,The name of the server authentication realm.r   r  r   r  r  r   s    rQ   r~   Challenge.target_name  #     tzz26[effrT   c                 l    [         R                  " SU R                  SS R                  5       5      S   $ )z,The negotiate flags supported by the server.r      r  r   r   r   s    rQ   r{   Challenge.flags  r   rT   r   c                 L    [         R                  " SU5      U R                  SS& g )Nr   r6  r  r   r   s     rQ   r{   r7    r  rT   c                 <    U R                   SS R                  5       $ )z$The server's 8 byte nonce challenge.r  r   r   r   s    rQ   r'  Challenge.server_challenge       zz"R ((**rT   c                 b    U(       a  [        U5      S:w  a  [        S5      eXR                  SS& g )Nr   z3NTLM Challenge ServerChallenge must be 8 bytes longr  r   r   r   r   r   s     rQ   r'  r:    s)    E
aRSS!

2brT   c                 2    [        U R                  SS 5      $ )z/The AV_PAIR structures generated by the server.r  c                 ,    [         R                  U 5      $ r   )r(  r   )ds    rQ   <lambda>'Challenge.target_info.<locals>.<lambda>  s    9J9J19MrT   r   r   r   s    rQ   r7   Challenge.target_info  s     tzz2/MNNrT   c                     U R                   nUS:  a0  [        R                  U R                  SS R	                  5       5      $ g)zThe server NTLM version.8   r&  Nr  r  s     rQ   r5   Challenge.version  r  rT   c                 2    [        U R                  SS/5      $ )r  r   r  r  r   s    rQ   r  Challenge._payload_offset  r  rT   r   c                 l    [         R                  XS9n[        U[        5      (       d  [	        S5      eU$ )Nr  z.Input message was not a NTLM Challenge message)r   r   r  r%  r   r  s      rQ   r   Challenge.unpack  r!  rT   )r   r   r'  )r   NNNNNNr   )rV   rW   rX   rY   rZ   r   r   r   r   r   r\   r   r   r^   r   r"  r~   r{   r#  r'  r7   r5   r  r   r   r_   r   r   s   @rQ   r%  r%  y  s   $ ((LN 37,059.2)-*.2929 !//%029 __S)	29
 __\229 +29 //#&29 '29 29h gV__S1 g g Cs C C \\53 54 5 5 +% + + "e " " " OV__\: O O 	3 	 	 9 9 9 u (<   rT   r%  c                     ^  \ rS rSrSr\R                  rSr           S$S\	S\
R                  \   S\
R                  \   S\
R                  \   S	\
R                  \   S
\
R                  \   S\
R                  \   S\
R                  S   S\
R                  \   S\
R                  \   S\
R                  \   SS4U 4S jjjr\S\
R                  \   4S j5       r\S\
R                  \   4S j5       r\S\
R                  \   4S j5       r\S\
R                  \   4S j5       r\S\
R                  \   4S j5       r\S\
R                  \   4S j5       r\S\	4S j5       r\R.                  S\	SS4S j5       r\S\
R                  S   4S j5       r\S\
R                  \   4S j5       r\R.                  S\SS4S j5       r\S\	4S j5       rS\	4S  jr\S%S!\S\
R                  \   SS 4S" jj5       rS#rU =r$ )&Authenticatei  a  NTLM Authentication Message

This structure represents an NTLM `AUTHENTICATION_MESSAGE`_ that can be serialized and deserialized to and from
bytes.

Args:
    flags: The `NegotiateFlags` that the client has negotiated.
    lm_challenge_response: The `LmChallengeResponse` for the client's secret.
    nt_challenge_response: The `NtChallengeResponse` for the client's secret.
    domain_name: The `DomainName` for the client.
    username: The `UserName` for the cleint.
    workstation: The `Workstation` for the client.
    encrypted_session_key: The `EncryptedRandomSessionKey` for the set up context.
    version: The `Version` of the client.
    mic: The `MIC` for the authentication exchange.
    encoding: The OEM encoding to use for text fields if `NTLMSSP_NEGOTIATE_UNICODE` was not supported.
    _b_data: The raw NTLM Authenticate bytes to unpack from.

.. _AUTHENTICATION_MESSAGE:
    https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-nlmp/033d32cc-88f9-4483-9bf2-b273055038ce
r
   Nr{   lm_challenge_responsent_challenge_responser   usernamer   encrypted_session_keyr5   r   r   r   r   r   c                 L  >^  [         [        T ]  XS9  U(       a6  T R                  [        R
                  -  (       a  SOT R                  T l        g U[        R
                  -  (       a  SOT R                  T l        [        5       nSnSnU(       a#  U[        R                  -  nUR                  5       n[        XU5      S   n[        SX5      S   n[        X,U5      u  p[        X<U5      u  nn[        XLUU 4S j5      u  nn[        X\UU 4S j5      u  nn[        XlUU 4S	 j5      u  nnU(       a  U[        R                  -  n[        X|U5      S
   n[        T R                  5      nUR                  U5        UR                  U5        UR                  U5        UR                  U5        UR                  U5        UR                  U5        UR                  [        R                  " SU5      5        UR                  U5        [        U5      T l        U	(       a  U	T l        g g )Nr   r*  r
   rT   r   s                   c                 :   > U R                  TR                  5      $ r   r   r   r@  r   s    rQ   rA  'Authenticate.__init__.<locals>.<lambda>>      !((4>>BZrT   c                 :   > U R                  TR                  5      $ r   rT  rU  s    rQ   rA  rV  A  s    qxx?WrT   c                 :   > U R                  TR                  5      $ r   rT  rU  s    rQ   rA  rV  D  rW  rT   r   r   )r   rM  r   r{   r   rN   r   r   r5   r   r   r0   r   r   r   r   r   r   )r   r{   rN  rO  r   rP  r   rQ  r5   r   r   r   r   r   r   b_lm_response_fieldsb_nt_response_fieldsb_domain_fieldsb_username_fieldsr   b_session_key_fieldsr   r   s   `                     rQ   r   Authenticate.__init__  s    	lD*H*N,0JJ9O9O,O[UYUcUcDN -2N4J4J,J[PTP^P^DN!IN I///#LLN	*9PQRSN +<STUVN3@AVcq3r0 3@AVcq3r0 ..;8Z/+O^ 1>^5W1-~ 4A8Z40 . %000#01FSa#bcd#e t~~.FMM./MM./MM/*MM+,MM./MM./MM&++dE23MM)$#F+DJ rT   c                 .    [        U R                  S5      $ )z+The LmChallengeResponse or None if not set.r   rC  r   s    rQ   rN  "Authenticate.lm_challenge_responseY       tzz2..rT   c                 .    [        U R                  S5      $ )z+The NtChallengeResponse or None if not set.r6  rC  r   s    rQ   rO  "Authenticate.nt_challenge_response^  rb  rT   c                 T    [        [        U R                  S5      U R                  SS9$ )z5The domain or computer name hosting the user account.   r  r2  r  r   s    rQ   r   Authenticate.domain_namec  r4  rT   c                 T    [        [        U R                  S5      U R                  SS9$ )z)The name of the user to be authenticated.$   r  r2  r  r   s    rQ   	user_nameAuthenticate.user_nameh  r4  rT   c                 T    [        [        U R                  S5      U R                  SS9$ )z8The name of the computer to which the user is logged on.,   r  r2  r  r   s    rQ   r   Authenticate.workstationm  r4  rT   c                 .    [        U R                  S5      $ )z*The client's encrypted random session key.4   rC  r   s    rQ   encrypted_random_session_key)Authenticate.encrypted_random_session_keyr  rb  rT   c                 l    [         R                  " SU R                  SS R                  5       5      S   $ )z7The negotiate flags supported by the client and server.r   <   r
   r   r   r   s    rQ   r{   Authenticate.flagsw  r   rT   r   c                 L    [         R                  " SU5      U R                  SS& g )Nr   rt  r
   r   r   s     rQ   r{   ru  |  r  rT   c                     U R                   nUS;  a6  US:  a0  [        R                  U R                  SS R	                  5       5      $ g)r  )r
   P   H   r
   Nr  r  s     rQ   r5   Authenticate.version  sH     -- )n.B>>$**R"3";";"=>> rT   c                 p    U R                  5       nU(       a  U R                  R                  5       XS-    $ g)z%The MIC for the Authenticate message.r   N)_get_mic_offsetr   r   )r   
mic_offsets     rQ   r   Authenticate.mic  s6     ))+
::%%'
"_EE rT   c                     [        U5      S:w  a  [        S5      eU R                  5       nU(       a  XR                  X"S-   & g [        S5      e)Nr   z+NTLM Authenticate MIC must be 16 bytes longz=Cannot set MIC on an Authenticate message with no MIC present)r   r   r|  r   )r   r   r}  s      rQ   r   r~    sG    u:JKK))+
7<JJzO4\]]rT   c                 2    [        U R                  / SQ5      $ )r  )r   r6  rf  ri  rm  rp  r  r   s    rQ   r  Authenticate._payload_offset  s     #4::/GHHrT   c                 8    U R                   nUS:  a  gUS:  a  gg)z0Gets the offset of the MIC structure if present.X   ry  rx  r
   r   )r  r  s     rQ   r|  Authenticate._get_mic_offset  s,    -- R r! rT   r   c                 l    [         R                  XS9n[        U[        5      (       d  [	        S5      eU$ )Nr  z1Input message was not a NTLM Authenticate message)r   r   r  rM  r   r  s      rQ   r   Authenticate.unpack  s3       ;#|,,PQQ
rT   )r   r   r   )r   NNNNNNNNNNr   ) rV   rW   rX   rY   rZ   r   r   r   r   r   r\   r   r   r^   r   r"  rN  rO  r   rj  r   rq  r{   r#  r5   r   r  r|  r   r   r_   r   r   s   @rQ   rM  rM    s   , ++LN 8<8<,0)-,08<.2&*)-*.AA  &u5A  &u5	A
 __S)A //#&A __S)A  &u5A +A __U#A //#&A 'A 
A AF /vu'= / / /vu'= / / gV__S1 g g g6??3/ g g gV__S1 g g /fooe.D / / Cs C C \\53 54 5 5 	3 	 	 V__U+   	ZZ^ ^4 ^ ^ I I I " u (<   rT   rM  c                   j  ^  \ rS rSrSrSrS\R                  S\R                  SS 4U 4S jjrS\R                  S\R                  SS4U 4S	 jjr	\
SS
\R                  \R                     SS 4S jj5       r\
SS\R                  S\SS 4S jj5       rS\4S jrS\4S jr\S\SS 4S j5       rSrU =r$ )FileTimei  a  Windows FILETIME structure.

FILETIME structure representing number of 100-nanosecond intervals that have elapsed since January 1, 1601 UTC.
This subclasses the datetime object to provide a similar interface but with the `nanosecond` attribute.

Attrs:
    nanosecond (int): The number of nanoseconds (< 1000) in the FileTime. Note this only has a precision of up to
        100 nanoseconds.

.. _FILETIME:
    https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-dtyp/2c57429b-fdd4-488f-b5fc-9e4cf020fcdf
l     }*{Gr   r   r   c                 v   > SnSU;   a  UR                  S5      n[        [        U ]  " U /UQ70 UD6nX4l        U$ )Nr   
nanosecond)popr   r  __new__r  )rP   r   r   nsdtr   s        rQ   r  FileTime.__new__  sC    6!L)B8S)#???	rT   Nc                 X   > [         TU ]  5         [        U SS 5      =(       d    SU l        g )Nr  r   )r   r   r   r  )r   r   r   r   s      rQ   r   FileTime.__init__  s#    !$d;@qrT   tzc                 b    [         R                  [        R                  R                  US95      $ )zGConstruct a FileTime from the current time and optional time zone info.)r  )r  from_datetimedatetimenow)rP   r  s     rQ   r  FileTime.now  s)     %%h&7&7&;&;r&;&BCCrT   r  r  c                     [        UR                  UR                  UR                  UR                  UR
                  UR                  UR                  UR                  US9	$ )z1Creates a FileTime object from a datetime object.)	yearmonthdayhourminutesecondmicrosecondtzinfor  )	r  r  r  r  r  r  r  r  r  )rP   r  r  s      rQ   r  FileTime.from_datetime  sL     ((999999

 
	
rT   c           
         SnU R                   (       d  U R                  (       a=  U R                  S5      nU R                  (       a  U[        U R                  S-  5      -  nSnU R                  (       a   U R                  S5      nUSS < SUSS < 3nS	R                  U R                  U R                  U R                  U R                  U R                  U R                  X5      $ )
zYDisplays the datetime in ISO 8601 including the 100th nanosecond internal like .NET does. z.%fd   Zz%zNrc   :z1{0}-{1:02d}-{2:02d}T{3:02d}:{4:02d}:{5:02d}{6}{7})r  r  strftimer^   r  formatr  r  r  r  r  r  )r   fraction_secondstimezone
utc_offsets       rQ   __str__FileTime.__str__  s    t#}}U3 C3(>$?? ;;t,J",Ra.*QR.AH CIIIItzz488TYYT[[Rb
 	
rT   c                    [         R                  R                  n[        R                  " [         R                   U R                  U R                  (       a  U R                  OUS95      nUR                  U5      [         R                   " SSSSSSUS9-
  nUR                  UR                  UR                  S-  S-  -   S-  -   n[        R                  US-  -   U R                  S	-  -   n[        R                  " S
U5      $ )r   )r    r   r   r  i  i@B rh   r  <Q)r  r  utcr\   castr  r  
astimezonemicrosecondssecondsdaysr  _EPOCH_FILETIMEr  r   r   )r   utc_tzutc_dttdepoch_time_msns100s         rQ   r   FileTime.pack  s     ""&&X..SWS^S^DKKdj0kl v&):):4Aq!QW])^^2::"t8K+Ku*TT ((MB,>?4??VYCYZ{{4''rT   r   c                    [         R                  " SU 5      S   nU[        R                  -
  S-  n[        R                  " SSS5      [        R
                  " US9-   n[        US-  5      S-  n[        R                  X4S9$ )	r   r  r   rh   r  r   )r  r  )r  )r   r   r  r  r  	timedeltar   r  )r   filetimer  r  r  s        rQ   r   FileTime.unpack  s}     ==v.q1 "H$<$<<CtQ*X-?-?]-[[ B#%%%b%00rT   )r  r   )r   )rV   rW   rX   rY   rZ   r  r\   r   r  r   r[   r   r  r  r  r   r  r^   r  r   r   r   r   r_   r   r   s   @rQ   r  r    s     )OFJJ &**  Afjj AFJJ A4 A DV__X__5 D D D 
x00 
c 
* 
 

 
((e ( 1u 1 1 1rT   r  c                      \ rS rSrSr    SS\R                  S   S\R                  \   S\R                  S   S	\R                  \   S
S4
S jjr\	S
\
4S j5       r\R                  S\
S
S4S j5       r\	S
\
4S j5       r\R                  S\
S
S4S j5       r\	SS j5       r\R                  SS j5       r\	S
\4S j5       r\R                  S\S
S4S j5       r\	SS j5       rS
\4S jr\S\S
S 4S j5       rSrg)NTClientChallengeV2i$  a  NTLMv2 Client Challenge

The `NTLMv2_CLIENT_CHALLENGE`_ structure defines the client challenge in the AUTHENTICATE_MESSAGE. This structure
is only used when NTLMv2 authentication is configured and is transported in the NT Challenge Response.

Args:
    time_stamp: The timestamp, defaults to the current time.
    client_challenge: The 8 byte nonce generated by the client.
    av_pairs: The TargetInfo AV_PAIRS for the client challenge.
    _b_data: Raw byte string for the NTClientChallengeV2, when set the other args are ignored.

.. _NTLMv2_CLIENT_CHALLENGE:
    https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-nlmp/aee311d6-21a7-4470-92a5-c4ecb022a87b
N
time_stampr  client_challengeav_pairsr(  r   r   c                    U(       a4  [        U5      S:  a  [        S5      e[        [        U5      5      U l        g U=(       d    [
        R                  5       nU=(       d
    [        5       n[        S5      nUR                  UR                  5       5        UR                  S5        UR                  UR                  5       5        [        U5      U l        U=(       d    SnX l
        g )Nr   z+Invalid NTClientChallengeV2 raw byte lengths         s               r+  )r   r   r   r   r   r  r  r(  r   r   challenge_from_client)r   r  r  r  r   r   s         rQ   r   NTClientChallengeV2.__init__4  s     7|b  !NOO#Ig$67DJ $5x||~J/:<HBCFMM*//+,MMMNMM(--/*#F+DJ/>;)9&rT   c                 l    [         R                  " SU R                  SS R                  5       5      S   $ )z4The current response type version, must be set to 1.BNr   r   r   r   s    rQ   	resp_typeNTClientChallengeV2.resp_typeO  s-     }}S$**Ra."8"8":;A>>rT   r   c                 L    [         R                  " SU5      U R                  S S& g )Nr  r   r   r   s     rQ   r  r  T  s    S%0

2ArT   c                 l    [         R                  " SU R                  SS R                  5       5      S   $ )z6The maximum response type supported, must be set to 1.r  r   r   r   r   r   s    rQ   hi_resp_type NTClientChallengeV2.hi_resp_typeX  s-     }}S$**Qq/"9"9";<Q??rT   c                 L    [         R                  " SU5      U R                  SS& g Nr  r   r   r   r   s     rQ   r  r  ]       ++c51

1QrT   c                 b    [         R                  U R                  SS R                  5       5      $ )zThe current system time.r   r   )r  r   r   r   r   s    rQ   r  NTClientChallengeV2.time_stampa  s'     tzz!B/779::rT   c                 >    UR                  5       U R                  SS& g Nr   r   )r   r   r   s     rQ   r  r  f  s     ::<

1RrT   c                 <    U R                   SS R                  5       $ )z8 byte client challenge.r   r  r   r   s    rQ   r  )NTClientChallengeV2.challenge_from_clientj  r;  rT   c                 T    [        U5      S:w  a  [        S5      eXR                  SS& g )Nr   z<NTClientChallengeV2 ChallengeFromClient must be 8 bytes longr   r  r=  r   s     rQ   r  r  o  s'    u:?[\\!

2brT   c                 b    [         R                  U R                  SS R                  5       5      $ )z#The target info AV_PAIR structures.rf  N)r(  r   r   r   r   s    rQ   r  NTClientChallengeV2.av_pairsu  s(       BC!8!8!:;;rT   c                 6    U R                   R                  5       $ )z'Packs the NTClientChallengeV2 to bytes.r   r   s    rQ   r   NTClientChallengeV2.packz  r   rT   r   c                     [        U S9$ )z;Unpacks the raw bytes to the NTClientChallengeV2 structure.r   )r  r   s    rQ   r   NTClientChallengeV2.unpack~  s     #622rT   )r   r  )NNNN)r   r  )r   r  r   N)r   r(  )rV   rW   rX   rY   rZ   r\   r   r   r   r"  r   r  r#  r  r  r  r  r   r   r   r_   rU   rT   rQ   r  r  $  s   " 373726*.:OOJ/: !//%0: //,/	:
 ': 
:6 ?3 ? ? 1s 1t 1 1 @c @ @ 2# 2$ 2 2 ; ; ( ( +u + + !!"5 "T " ""
 < <$e $ 3u 3!6 3 3rT   r  c                   L  ^  \ rS rSrSr\R                  \R                  \R                  \R                  \R                  \R                  4\R                  4\R                  \R                  4S.rS\S\R"                  SS4U 4S jjrS\4S	 jr\S
\SS 4S j5       rSrU =r$ )r(  i  a  A collection of AV_PAIR structures for the TargetInfo field.

The `AV_PAIR`_ structure defines an attribute/value pair and sequences of these pairs are using in the
:class:`Challenge` and :class:`Authenticate` messages. The value for each pair depends on the AvId specified.
Each value can be get/set/del like a normal dictionary where the key is the AvId of the value.

.. _AV_PAIR:
    https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-nlmp/83f5e789-660d-4781-8491-5f8c6641f75e
)textint32r   keyr   r   Nc                    > [        U[        5      (       aS  U[        R                  :X  a  [        R                  U5      nO)U[        R                  :X  a  [        R                  U5      n[        [        U ]+  X5        g r   )r  r   ra   r|   r  r   r}   
SingleHostr   r(  __setitem__)r   r  r   r   s      rQ   r  TargetInfo.__setitem__  sW    eU##dnn$ .((("))%0j$+C7rT   c           
         [         R                  " 5       nU R                  5        H  u  p#U[        R                  :X  a  M  X R
                  S   ;   a  UR                  S5      nOOX R
                  S   ;   a  [        R                  " SU5      nO%X R
                  S   ;   a  UR                  5       nOUnUR                  [        R                  " SU[        U5      5      U-   5        M     UR                  S5        UR                  5       $ )r   r  r*  r  r   r   z<HHs       )ioBytesIOitemsra   ru   _FIELD_TYPESr   r   r   writer   getvalue)r   r   av_idr   r   s        rQ   r   TargetInfo.pack  s     JJLLE ))&11,,{3++G44 ++dE2++H55**,LLUE3w<@7JK )  	()  rT   r   c                    [        5       n[        R                  " U 5      nUR                  S5      nU(       Ga6  [        R
                  " SU5      S   n[        R
                  " SUR                  S5      5      S   nUR                  U5      nU[         R                  S   ;   a  UR                  S5      nOU[         R                  S   ;   a$  [        [        R
                  " SU5      S   5      nOVU[        R                  :X  a  [        R                  U5      nO,U[        R                  :X  a  [        R                  U5      nOUnXq[        U5      '   UR                  S5      nU(       a  GM6  U$ )r   r   r   r   r  r*  r  r   )r(  r  r  readr   r   r  decoder   ra   r|   r  r}   r  )r   r7   b_iob_av_idr  r   r   r   s           rQ   r   TargetInfo.unpack  s     !lzz&!))A,MM$03E]]416q9Fii'G 
//77{3*11'::dG <Q ?@$..( 0$***"))'2  ',U$iilG/ g2 rT   rU   )rV   rW   rX   rY   rZ   ra   rv   rw   rx   ry   rz   r~   r{   r|   r}   r  r\   r   r  r   r   r   r   r_   r   r   s   @rQ   r(  r(    s     !!""  
 **>>4#3#34L8t 8FJJ 84 8!e !.  u      rT   r(  c                      \ rS rSrSr     SS\S\S\R                  \   S\R                  \   S\R                  \   S	S4S
 jjr	S\
S	\4S jr\S	\4S j5       r\R                  S\S	S4S j5       r\S	\4S j5       r\R                  S\S	S4S j5       r\S	\4S j5       r\R                  S\S	S4S j5       r\S	\4S j5       r\R                  S\S	S4S j5       rS	\4S jr\S\S	S 4S j5       rSrg)r  i  a  Single_Host_Data structure for NTLM TargetInfo entry.

`Single_Host_Data`_ structure allows a client to send machine-specific information within an authentication
exchange to services on the same machine. If the server and client platforms are different or if they are on
different hosts, then the information MUST be ignores.

Args:
    size: A 32-bit unsigned int that defines size of the structure.
    z4: A 32-bit integer value, currently set to 0.
    custom_data: An 8-byte platform-specific blob containing info only relevant when the client and server are on
        the same host.
    machine_id: A 32-byte random number created at computer startup to identify the calling machine.
    _b_data: Create a SingleHost object from the raw data byte string.

Attributes:
    size: See args.
    z4: See args.
    custom_data: See args.
    machine_id: See args.

.. _Single_Host_Data:
    https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-nlmp/f221c061-cc40-4471-95da-d2ff71c85c5b
Nsizez4custom_data
machine_idr   r   c                     U(       a+  [        U5      S:w  a  [        S5      e[        U5      U l        g [        [	        S5      5      U l        Xl        X l        U=(       d    SU l        U=(       d    SU l        g )Nr&  z)SingleHost bytes must have a length of 48r+  s                                    )	r   r   r   r   r   r  r  r  r  )r   r  r  r  r  r   s         rQ   r   SingleHost.__init__  s`     7|r! !LMM#G,DJ $IbM2DJIG*9kD(8LDOrT   otherc                     [        U[        [        45      (       d  g[        U[        5      (       a  UR                  5       nU R                  5       U:H  $ NF)r  r   r  r   r   r  s     rQ   __eq__SingleHost.__eq__  s@    %%!455eZ((JJLEyy{e##rT   c                 l    [         R                  " SU R                  S S R                  5       5      S   $ )Nr   r   r   r   r   s    rQ   r  SingleHost.size  s+    }}T4::bq>#9#9#;<Q??rT   r   c                 L    [         R                  " SU5      U R                  S S& g )Nr   r   r   r   s     rQ   r  r	    s    T51

2ArT   c                 l    [         R                  " SU R                  SS R                  5       5      S   $ r   r   r   s    rQ   r  SingleHost.z4  +    }}T4::a?#:#:#<=a@@rT   c                 L    [         R                  " SU5      U R                  SS& g )Nr   r   r   r   r   s     rQ   r  r  "       ++dE2

1QrT   c                 <    U R                   SS R                  5       $ r  r   r   s    rQ   r  SingleHost.custom_data&  s    zz!B''))rT   c                 T    [        U5      S:w  a  [        S5      eXR                  SS& g )Nr   z'custom_data length must be 8 bytes longr   r=  r   s     rQ   r  r  *  s'    u:?FGG 

1RrT   c                 <    U R                   SS R                  5       $ )Nr   r&  r   r   s    rQ   r  SingleHost.machine_id1  s    zz"R ((**rT   c                 T    [        U5      S:w  a  [        S5      eXR                  SS& g )Nr   z'machine_id length must be 32 bytes longr   r&  r=  r   s     rQ   r  r  5  s(    u:FGG!

2brT   c                 6    U R                   R                  5       $ r   r   r   s    rQ   r   SingleHost.pack<  r   rT   r   c                     [        U S9$ )z+Creates a SignleHost object from raw bytes.r  )r  r  s    rQ   r   SingleHost.unpack@  s     &))rT   )r   r  r  r  r  )r   r   NNN)rV   rW   rX   rY   rZ   r   r\   r   r   r   objectboolr  r"  r  r#  r  r  r  r   r   r   r_   rU   rT   rQ   r  r    s   4 .2-1*.99 9 __U+	9
 OOE*9 '9 
9($F $t $ @c @ @ 
[[2# 2$ 2 2 AC A A YY3 3 3 3 *U * * ! !4 ! ! +E + + " "$ " "$e $ *u * * *rT   r  c                      \ rS rSrSr     SS\S\S\S\S\R                  \   S	S4S
 jjr	S\
S	\4S jrS	\4S jr\S	\4S j5       r\R                   S\S	S4S j5       r\S	\4S j5       r\R                   S\S	S4S j5       r\S	\4S j5       r\R                   S\S	S4S j5       r\S	\4S j5       r\S	\4S j5       r\R                   S\S	S4S j5       rS	\4S jrS	\4S jrS	\4S jr\S S j5       r\S\S	S 4S j5       rSrg)!r   iF  a   A structure contains the OS information.

The `VERSION`_ structure contains operating system version information that SHOULD be ignored. This structure is
used for debugging purposes only and its value does not affect NTLM message processing. It is populated in the NTLM
messages only if `NTLMSSP_NEGOTIATE_VERSION` (`NegotiateFlags.version`) is negotiated.

Args:
    major: See args. The 8-bit unsigned int for the version major part.
    minor: The 8-bit unsigned int for the version minor part.
    build: The 16-bit unsigned int for the version build part.
    revision: An 8-bit unsigned integer for the current NTLMSSP revision. This field SHOULD be `0x0F`.
    _b_data: Create a Version object from the raw data byte string.

Attrs:
    major: See args.
    minor: See args.
    build: See args.
    reserved: A reserved 3-byte field that isn't used in the NTLM spec.
    revision: See args.

.. _VERSION:
    https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-nlmp/b1a6ceb2-f8ad-462b-b5af-f18527c48175
Nmajorminorbuildrevisionr   r   c                     U(       a+  [        U5      S:w  a  [        S5      e[        U5      U l        g [        [	        S5      5      U l        Xl        X l        X0l        X@l        g )Nr   z%Version bytes must have a length of 8)	r   r   r   r   r   r  r  r  r   )r   r  r  r  r   r   s         rQ   r   Version.__init___  sQ     7|q  !HII#G,DJ $IaL1DJJJJ$MrT   r  c                     [        U[        [        45      (       d  g[        U[        5      (       a  UR                  5       nU R                  5       U:H  $ r  )r  r   r   r   r  s     rQ   r  Version.__eq__t  s@    %%!122eW%%JJLEyy{e##rT   c                     g)Nr   rU   r   s    rQ   __len__Version.__len__}  s    rT   c                 l    [         R                  " SU R                  SS R                  5       5      S   $ Nr  r   r   r   r   s    rQ   r  Version.major  +    }}S$**Qq/"9"9";<Q??rT   r   c                 L    [         R                  " SU5      U R                  SS& g r)  r   r   s     rQ   r  r*    r  rT   c                 l    [         R                  " SU R                  SS R                  5       5      S   $ )Nr  r   r   r   r   r   s    rQ   r  Version.minor  r+  rT   c                 L    [         R                  " SU5      U R                  SS& g r  r   r   s     rQ   r  r.    r  rT   c                 l    [         R                  " SU R                  SS R                  5       5      S   $ )Nr   r   r   r   r   r   s    rQ   r  Version.build  r  rT   c                 L    [         R                  " SU5      U R                  SS& g )Nr   r   r   r   r   s     rQ   r  r1    r  rT   c                 <    U R                   SS R                  5       $ )Nr   rf   r   r   s    rQ   reservedVersion.reserved  s    zz!A&&((rT   c                 l    [         R                  " SU R                  SS R                  5       5      S   $ )Nr  rf   r   r   r   r   s    rQ   r   Version.revision  r+  rT   c                 L    [         R                  " SU5      U R                  SS& g )Nr  rf   r   r   r   s     rQ   r   r7    r  rT   c                     SR                  [        U 5      R                  [        U 5      R                  U R                  U R
                  U R                  U R                  5      $ )Nz<{0}.{1} {2}.{3}.{4}.{5}>)r  typerW   rV   r  r  r  r   r   s    rQ   __repr__Version.__repr__  sL    *11J!!4:#6#6

DJJPTPZPZ\`\i\i
 	
rT   c                 t    U R                   < SU R                  < SU R                  < SU R                  < 3$ )N.)r  r  r  r   r   s    rQ   r  Version.__str__  s!     $

DJJ

DMMRRrT   c                 6    U R                   R                  5       $ r   r   r   s    rQ   r   Version.pack  r   rT   c                  n   / n [         R                  " SS5       HU  nU(       d  M  [        R                  " SU5      nU(       d  M,  U R	                  [        UR                  S5      5      5        MW     U S/S[        U 5      -
  -  -  n [        [        U S   5      [        U S   5      [        U S   5      S9$ )zJGenerates an NTLM Version structure based on the pyspnego package version.r>  rc   z^(\d+)r   r   r   )r  r  r  )	pyspnego_versionsplitrematchappendr   groupr   r   )versionsvrF  s      rQ   get_currentVersion.get_current  s     !''Q/AHHY*EuEKKN 34 0 	QC1s8},--S!-S!5ESQYZ[Q\M]^^rT   r   c                     [        U S9$ )z(Creates a Version object from raw bytes.r  )r   r  s    rQ   r   Version.unpack  s     v&&rT   )r   r  r  r  r   )r   r   r      N)r   r   )rV   rW   rX   rY   rZ   r   r\   r   r   r   r  r  r  r&  r"  r  r#  r  r  r4  r   r^   r;  r  r   r   rK  r   r_   rU   rT   rQ   r   r   F  s   4 *.%% % 	%
 % '% 
%*$F $t $  @s @ @ \\23 24 2 2 @s @ @ \\23 24 2 2 As A A \\33 34 3 3 )% ) ) @# @ @ __2c 2d 2 2
# 

S S$e $ _ _ 'u ' ' 'rT   r   r   )*collectionsr  enumr  rE  r   r\   spnego._textr   spnego._versionr   rC  IntFlagr   ra   r   IntEnumr   r   Listr   r   r   r   r   Callabler   Tupler   r   r:  r   r   r   r%  rM  r  r  OrderedDictr(  r  r   rU   rT   rQ   <module>rZ     s      	 	     ;M
T\\ M
`#
4<< #
L
dll 
.
$,, 
)
 )6;;s;K )PS ) HL	#
**## # v

|U/BCD	#
 \\%*#. JN
@
@
@ %&**1D!EF
@ ZZ	
@Jt J2>, >:i iX@ @FA; AHa1x   a1H]3 ]3@Y(( Yxc* c*L}' }'rT   