o
    Žõ±jªÕ  ã                   @   sN  d dl Z d dlZd dlZd dlZd dlZd dlmZ d dlmZ d dl	T d dl
mZ d dlmZ d dlmZ d dlmZmZ d d	lmZ d d
lmZ d dlmZ d dlmZmZmZ d dlmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z' d dl(T d dl)T d dl*T d dl+T d dl,T d dl-m.Z. d dl/m0Z0 d dl1m2Z2 d dl3m4Z4 d dl5m6Z6 d dl7T d dl8m9Z9 d dl8m:Z: d dl;m<Z<m=Z=m>Z> d dl?m@Z@ d dlAmBZB d dlCmDZE d dlCmFZG d dlHmIZI G dd„ de jJƒZKG dd„ dƒZLG dd „ d ƒZMG d!d"„ d"ƒZNG d#d$„ d$ƒZOd%d&„ ZPeQd'k�r%d d(lRmSZS e Td)¡ d*ZUeS VeU¡ZWe XePeWƒ¡ dS dS )+é    N)Ú	Coroutine)Úlogger)Ú*)ÚNetBIOSPacketizer)Ú
SMBCommand)ÚNTStatus)Ú	SMBHeaderÚSMBHeaderFlags2Enum)Ú
SMBMessage)ÚSMBSecurityMode)ÚSMB_COM_NEGOTIATE_REQ)ÚSMB2MessageÚSMB2TransformÚSMB2Compression)
ÚSMB2ContextTypeÚ SMB2PreauthIntegrityCapabilitiesÚSMB2HashAlgorithmÚ
SMB2CipherÚSMB2CompressionTypeÚSMB2CompressionFlagsÚSMB2EncryptionCapabilitiesÚSMB2CompressionCapabilitiesÚSMB2SigningAlgorithmÚSMB2SigningCapabilities)ÚFileInfoClass)Ú FileFullDirectoryInformationList)ÚFileAttributes)ÚSECURITY_DESCRIPTOR)ÚSE_OBJECT_TYPE)Úhmac)Úhashlib)ÚAESÚMODE_CCMÚMODE_GCM)ÚAES_CMAC)ÚKDF_CounterMode)Úcompress)Ú
decompress)Ú	UniClientc                   @   s   e Zd ZdZdZdZdZdS )ÚSMBConnectionStatusÚNEGOTIATINGÚSESSIONSETUPÚRUNNINGÚCLOSEDN)Ú__name__Ú
__module__Ú__qualname__r*   r+   r,   r-   © r1   r1   ú„/root/aizidognhua/tmp/workspace/projects/ec89d86c-575f-41c9-af57-ac45cbdbf775/venv/lib/python3.10/site-packages/aiosmb/connection.pyr)   -   s
    r)   c                   @   ó    e Zd Zdd„ Zedd„ ƒZdS )Ú	TreeEntryc                 C   s:   d | _ d | _d | _d | _d | _d | _d | _d | _d | _d S ©N)	Ú
share_nameÚtree_idÚ
session_idÚnumber_of_usersÚis_DFSÚis_CAÚis_scaleoutÚencryptÚmaximal_access©Úselfr1   r1   r2   Ú__init__4   s   
zTreeEntry.__init__c                 C   st   t ƒ }||_| jj|_| jj|_d|_tj	| j
jv |_tj| j
jv |_tj| j
jv |_tj| j
jv |_| j
j|_|S ©Né   )r4   r6   ÚheaderÚTreeIdr7   Ú	SessionIdr8   r9   ÚTreeCapabilitiesÚSMB2_SHARE_CAP_DFSÚcommandÚCapabilitiesr:   Ú&SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITYr;   ÚSMB2_SHARE_CAP_SCALEOUTr<   Ú
ShareFlagsÚSMB2_SHAREFLAG_ENCRYPT_DATAr=   ÚMaximalAccessr>   )Úreplyr6   Úter1   r1   r2   Úfrom_tree_reply?   s   


zTreeEntry.from_tree_replyN)r.   r/   r0   rA   ÚstaticmethodrR   r1   r1   r1   r2   r4   3   s    r4   c                   @   r3   )Ú
FileHandlec                 C   s:   d | _ d | _d | _d | _d | _d | _d | _t d¡| _	d S rB   )
Úfile_idr7   Úoplock_levelÚ
is_durableÚis_resilientÚlast_disconnect_timeÚ	file_nameÚasyncioÚ	SemaphoreÚoplockr?   r1   r1   r2   rA   N   s   zFileHandle.__init__c                 C   s8   t ƒ }| jj|_||_||_d|_d|_d|_||_	|S )NFr   )
rT   rI   ÚFileIdrU   r7   rV   rW   rX   rY   rZ   )rP   r7   rZ   rV   Úfhr1   r1   r2   Úfrom_create_replyX   s   
zFileHandle.from_create_replyN)r.   r/   r0   rA   rS   r`   r1   r1   r1   r2   rT   M   s    
rT   c                   @   s>   e Zd Zddd„Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ ZdS )ÚSMBPendingMsgéˆ  éd   c                 C   s(   || _ || _|| _|| _|| _d | _d S r5   )Ú
message_idÚmax_renewalÚtimeoutÚOutstandingResponsesÚOutstandingResponsesEventÚpending_task)r@   rd   rg   rh   rf   re   r1   r1   r2   rA   e   s   
zSMBPendingMsg.__init__c                 Ã   s(   �t  d¡I d H  |  tƒ ¡I d H  d S )Nrb   )r[   ÚsleepÚ_SMBPendingMsg__destroy_messageÚSMBPendingTimeoutr?   r1   r1   r2   Ú__pending_waiterm   s   €zSMBPendingMsg.__pending_waiterc                 Ã   s2   �d |f| j | j< | j| jv r| j| j  ¡  d S r5   )rg   rd   rh   Úset)r@   Úproblemr1   r1   r2   Ú__destroy_messageq   s
   €zSMBPendingMsg.__destroy_messagec                 Ã   s^   �| j d ur| j  ¡  | jd ur%|  jd8  _| jdkr%|  tƒ ¡I d H  t |  ¡ ¡| _ d S )NrC   r   )ri   Úcancelre   rk   ÚSMBPendingMaxRenewalr[   Úcreate_taskÚ_SMBPendingMsg__pending_waiterr?   r1   r1   r2   Úupdatew   s   €



zSMBPendingMsg.updatec                 Ã   s   �t  |  ¡ ¡| _d S r5   )r[   rs   rt   ri   r?   r1   r1   r2   Úrun„   s   €zSMBPendingMsg.runc                 Ã   s   �| j d ur| j  ¡  d S d S r5   )ri   rq   r?   r1   r1   r2   Ústopˆ   s   €
ÿzSMBPendingMsg.stopN)rb   rc   )	r.   r/   r0   rA   rt   rk   ru   rv   rw   r1   r1   r1   r2   ra   d   s    
ra   c                   @   sÀ  e Zd ZdZdXdededefdd„Zd	d
„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdefd d!„ZdYd"d#„ZdYd$d%„Zd&eeeef fd'd(„Zd)efd*d+„Zded&efd,d-„Zd&efd.d/„ZdZd)efd1d2„Zd3e fd4d5„Z!e"j#e$j%d0dfd6e&d7e"fd8d9„Z'd[d;d<„Z(d\d=d>„Z)e*j+e,j-d:d:d?fd@dA„Z.dBd:e,j/d0d:fdCdD„Z0d0e1j2dEfdFdG„Z3e4j5fdHdI„Z6dJdK„ Z7dLdM„ Z8dNdO„ Z9dPdQ„ Z:dRdS„ Z;dTdU„ Z<dVdW„ Z=d0S )]ÚSMBConnectionzr
	Connection class for network connectivity and SMB messages management (sending/recieveing/singing/encrypting).
	TFÚtargetÚpreserve_gssapiÚnosignc                 C   sþ  || _ || _d | _|du rt |¡| _|| _| jj| _d | _d | _	d | _
d | _d | _d| _d | _d| _d| _d | _d | _d| _d| _tj| _i | _i | _i | _i | _i | _i | _i | _i | _d| _ | jj!d urk| jj!nd| _!| jj"d urx| jj"nd| _"| jj#d ur…| jj#nd| _#d | _$d| _%d | _&t' (¡ | _)d| _*d| _+d| _,d| _-d| _.d| _/d| _0d| _1t2j3| _4|du r½t2j5t2j6B | _4d| _7d| _8d | _9d | _:d | _;d | _<d | _=d| _>t?j@| _Ad| _Bd | _Cd | _Dd | _E	 tFjGg| _Ed| _HtIjJg| _Kd | _LtMjN| _Od| _Pd S )NTé   Fr   i   s@                                                                   )Qr{   ÚgssapiÚoriginal_gssapiÚcopyÚdeepcopyry   Úpreferred_dialectsÚsupported_dialectsÚsettingsÚnetwork_connectionÚnetbios_transportÚincoming_taskÚkeepalive_taskÚkeepalive_timeoutÚconnection_closed_evtÚlogin_okÚsupress_keepaliveÚactivity_atÚselected_dialectÚsigning_requiredÚencryption_requiredr)   r*   Ústatusrh   ÚOutstandingRequestsrg   Úpending_tableÚmessageIdToOplockÚTreeConnectTable_idÚTreeConnectTable_shareÚFileHandleTableÚSequenceWindowÚMaxTransactSizeÚMaxReadSizeÚMaxWriteSizeÚ
ServerGuidÚRequireSigningÚ
ServerNameÚGUIDÚrandomÚ
ClientGUIDÚSupportsFileLeasingÚSupportsMultiCreditÚSupportsDirectoryLeasingÚSupportsMultiChannelÚSupportsPersistentHandlesÚSupportsEncryptionÚClientCapabilitiesÚServerCapabilitiesÚNegotiateSecurityModeÚNONEÚClientSecurityModeÚSMB2_NEGOTIATE_SIGNING_ENABLEDÚSMB2_NEGOTIATE_SIGNING_REQUIREDÚServerSecurityModerF   Ú
SessionKeyÚ
SigningKeyÚApplicationKeyÚEncryptionKeyÚDecryptionKeyÚCompressAllRequestsr   ÚSHA_512ÚPreauthIntegrityHashIdÚPreauthIntegrityHashValueÚCompressionIdÚCipherIdÚCompressionIdsr   ÚLZNT1ÚSupportsChainedCompressionr   ÚAES_128_CCMÚsupported_encryptionsÚsupported_signaturesr    Úsha512Úpreauth_ctxÚsession_closed)r@   r}   ry   rz   r{   r1   r1   r2   rA   ‘   sˆ   




zSMBConnection.__init__c                 Ã   s   �| S r5   r1   r?   r1   r1   r2   Ú
__aenter__ø   s   €zSMBConnection.__aenter__c                 Ã   s   �t j|  ¡ dd�I d H  d S )Né   ©rf   )r[   Úwait_forÚ	terminate)r@   Úexc_typeÚexcÚ	tracebackr1   r1   r2   Ú	__aexit__û   s   €zSMBConnection.__aexit__c                 C   s"   | j tjtjtjfv r| jS | jS r5   )r�   ÚNegotiateDialectsÚSMB300ÚSMB302ÚSMB311r±   r¯   r?   r1   r1   r2   Úget_session_keyþ   s   zSMBConnection.get_session_keyc                 C   s^   z| j  ¡ }|d ur| ¡ }W n
   t ¡  d }Y | jd ur-|tj| jv tj| jv dœS d S )N)Ú	ntlm_dataÚsigning_enabledrŽ   )	r}   Úget_extra_infoÚto_dictrÊ   Ú	print_excr®   r©   r¬   r­   )r@   rÑ   r1   r1   r2   rÓ     s   
€


ýzSMBConnection.get_extra_infoc                 Ã   sî  ��zÌ�zd| j  ¡ 2 �zZ3 dH W }tj ¡ | _|du r*t| jdur'| j ¡ ƒ‚dƒ‚|d dk r8td|d  ƒ‚|d dkr“t	 
|¡}|jjtjkrht| jt|jjdd… dd	�}| |j|d
d… |jj¡}n+|jjtjkr‹t| jt|jjdd… ƒ}| |j|d
d… |jj¡}ntd|jj ƒ‚|d dkrÞt 
|¡}|jjtjkrÚ|jj| jkr±t d¡ |jjt j!krÑ|jd|jj"… }|t#|j|jj"d… ƒ7 }|}ntd|jjj$ ƒ‚tdƒ‚|d dkrét% 
|¡}|d dkrôt& 
|¡}|jj't(j)k�r0|jj*| j+v �r| j+|jj*  ,¡  t-|jj*| j.| j/| jj0| jj1d�| j2|jj*< | j2|jj*  3¡ I dH  q
|jj*| j2v �rJ| j2|jj*  4¡ I dH  | j2|jj*= ||f| j.|jj*< |jj*| j/v �re| j/|jj*  5¡  q
q
6 W n< t6j7�yœ   Y W t dtdƒ ¡ | j/D ]}dtdƒf| j.|< | j/|  5¡  �q|  8¡ I dH  dS    t 9d¡ Y W t dtdƒ ¡ | j/D ]}dtdƒf| j.|< | j/|  5¡  �q²|  8¡ I dH  dS t dtdƒ ¡ | j/D ]}dtdƒf| j.|< | j/|  5¡  �qÛ|  8¡ I dH  w )z±
		Waits from SMB message bytes from the transport in_queue, and fills the connection table.
		This function started automatically when calling connect.
		Pls don't touch it.
		NzUnknown targetr   éü   zUnknown SMB packet type %séý   é   é   ©Úsegment_sizeé   é4   é   z7Common encryption algo is %s but it is not implemented!zFServer is using a different compression algo than whats agreed upon...z5Server used %s compression, but it is not implementedz=Server sent chained compression, but its not implemented hereéþ   éÿ   )rf   re   z1__handle_smb_in got error from transport layer %szConnection closedÚ__handle_smb_in):r„   ÚreadÚdatetimeÚutcnowrŒ   ÚSMBConnectionTerminatedry   Úget_hostname_or_ipÚ	Exceptionr   Ú
from_bytesrD   ÚEncryptionAlgorithmr   r½   r!   r³   r"   ÚNonceÚdecryptÚdataÚ	SignatureÚAES_128_GCMr#   r   ÚFlagsr   rª   ÚCompressionAlgorithmr¸   r   Údebugr   r»   ÚOffsetÚlznt1_decompressÚnamer   r
   ÚStatusr   ÚPENDINGÚ	MessageIdr“   Úreleasera   rg   rh   ÚPendingTimeoutÚPendingMaxRenewalr’   rv   rw   rn   r[   ÚCancelledErrorrÇ   Ú	exception)r@   Úmsg_dataÚmsgÚctxÚuncompressed_dataÚmidr1   r1   r2   rá     s„   €




,ºH
ø€
û
zSMBConnection.__handle_smb_inc              
   Ã   s´   �z;|   ¡ I dH \}}|dur|‚|  ¡ I dH \}}|dur |‚|  ¡ I dH \}}|dur/|‚t |  ¡ ¡| _d| _W dS  tyY } z|  	¡ I dH  d|fW  Y d}~S d}~ww )a  
		This is the normal starting function.
		Performs establishment of the TCP connection, then the negotiation and finally the session setup.
		If this function returns without an exception, then I'm happy.
		Also it means that you have a working and active session to the server.
		NT©TNF)
ÚconnectÚ	negotiateÚsession_setupr[   rs   Ú	keepaliver‡   rŠ   rç   Ú
disconnect©r@   Ú_ÚerrÚer1   r1   r2   Úlogint  s&   €€þzSMBConnection.loginc              
   Ã   sä   �zhzId| j jvrtdƒ‚|  ¡ I d H \}}|d ur|‚|  ¡ I d H \}}|d ur+|‚| jdd�I d H \}}|d ur<|‚| j  ¡ d fW W |  ¡ I d H  S  tyi } zd |fW  Y d }~W |  ¡ I d H  S d }~ww |  ¡ I d H  w )Nz2NTLMSSP - Microsoft NTLM Security Support Providerz6Fake authentication is only supported via NTLM packageT)Ú	fake_auth)r}   Úauthentication_contextsrç   r  r  r  rÓ   r  r  r1   r1   r2   Ú
fake_login�  s*   €ý€ýzSMBConnection.fake_loginc           	   
   Ã   s  �z�z_|| _ |  ¡ I dH \}}|dur|‚d}d}| jdd�I dH \}}}t|tƒr9tj|jjv }tj	|jjv }nt|t
ƒrLtj|jjv }tj|jjv }|durR|‚||||dfW W |  ¡ I dH  S  ty‚ } zdddd|fW  Y d}~W |  ¡ I dH  S d}~ww |  ¡ I dH  w )z•
		Checks if the remote end supports a given protocol.
		On success it returns True and the reply from the server (for checking SMB3 capabilities)
		NT)Úprotocol_testF)r‚   r  r  Ú
isinstancer   r©   r¬   rI   ÚSecurityModer­   r
   r   Ú%NEGOTIATE_SECURITY_SIGNATURES_ENABLEDÚ&NEGOTIATE_SECURITY_SIGNATURES_REQUIREDr  rç   )	r@   Úprotocolr	  r
  Úsign_enÚsign_reqÚresÚrplyr  r1   r1   r2   r  ¤  s2   €

ý€ýzSMBConnection.protocol_testc              
   Ã   s„   �z#t  ¡ | _t| jƒ}t| j|ƒ}| ¡ I dH | _t  	|  
¡ ¡| _W dS  tyA } z|  ¡ I dH  d|fW  Y d}~S d}~ww )zh
		Establishes socket connection to the remote endpoint. Also starts the internal reading procedures.
		Nr  F)r[   ÚEventr‰   r   r™   r(   ry   r  r„   rs   Ú_SMBConnection__handle_smb_inr†   rç   r  )r@   Ú
packetizerÚclientr  r1   r1   r2   r  Á  s   €

€þzSMBConnection.connectc                 Ã   st   �| j tjkr	dS tj| _ | jdur| j ¡  | jdur,| j ¡ I dH  t d¡I dH  | j	dur8| j	 ¡  dS dS )z‘
		Tears down the socket connecting as well as the reading cycle.
		Doesn't do any cleanup! 
		For proper cleanup call the terminate function.
		Nr   )
r�   r)   r-   r†   rq   r„   Úcloser[   rj   r‡   r?   r1   r1   r2   r  Ð  s   €



ÿzSMBConnection.disconnectc              
   Ã   sØ   �zAd}| j jdk rW dS | j jdkrt| j jd |ƒ}	 t |¡I dH  tj ¡ | j j|krB| j	du rBtj
|  ¡ | jd�I dH  q tjyM   Y dS  tyk } zt d¡ |  ¡ I dH  W Y d}~dS d}~ww )	zR
		Sends an echo message every X seconds to the server to keep the channel open
		é
   r   NrC   TFrÅ   z/Keepalive failed! Server probably disconnected!)ry   rf   Úmaxr[   rj   rã   rä   rŒ   Úsecondsr‹   rÆ   Úechorˆ   rû   rç   r   rñ   r  )r@   Ú
sleep_timer  r1   r1   r2   r  ç  s&   € ý
€þzSMBConnection.keepaliverý   c                 C   s&   t  ¡ }| | j| ¡ | ¡ | _d S r5   )r    rÀ   ru   r·   Údigest)r@   rý   rÿ   r1   r1   r2   Úupdate_integrityü  s   zSMBConnection.update_integrityc              
   Ã   sb  ��zd}t j| jv rƒtƒ }tj|_tj|_	d|_
tj|_tƒ }|du r)dg|_nddg|_t||ƒ}|  |¡I dH \}}|durC|‚|  |¡I dH \}}}|durT|‚t|tƒrs|du ro|jjdkrid|dfW S d|dfW S td	ƒ‚|jj	tjkr~td
ƒ‚| jt j= tƒ }| j|_d|_| j|_dd„ | jD ƒ|_tdd„ | jD ƒƒr¨tj |_t j!| jv rð|j" #t$ %| j&g¡¡ | j'durÐ| jtj O  _|j" #t( )| j'¡¡ | j*durß|j" #t+ )| j*¡¡ | j,durð|j" #t- .| j,| j/¡¡ t0ƒ }t1j2|_d|_3t4||ƒ}|  |¡I dH \}}|du�r|‚|  |¡I dH \}}}|du�r"|‚t|tƒ�r,td	ƒ‚|  5|¡ |jj	tjk�rQ|jj	tj6k�rItd|jj	 ƒ‚td|jj	 ƒ‚|jj7| jv�r\t8ƒ ‚|jj7| _9|jj| _:t;j<|jjv | _=| j>du �rwd| _=tj |jjv �r†d| _?t@jA| _B|jj"D ] }	|	jCtDjEk�rœd| _?|	jFd | _B|	jCtDjGk�r©|	jHd | _I�qŠtJ Kdd| j9 ¡ tL| jM|jjMƒ| _MtL| jN|jjNƒ| _NtL| jO|jjOƒ| _O|jjP| _PtjQ|jjv | _RtjS|jjv | _TtjU|jjv | _V|jj| _W|jj| _XtYjZ| _[| jN| j\j]_^|du �rd|dfW S W dS  t�y0 }
 z|du �r"W Y d}
~
dS d|
fW  Y d}
~
S d}
~
ww )zj
		Initiates protocol negotiation.
		First we send an SMB_COM_NEGOTIATE_REQ with our supported dialects
		Nr   Tz
NT LM 0.12z	SMB 2.???z	SMB 2.002éÿÿ  Fz7Server replied with SMBv1 message, doesnt support SMBv2z<SMB2 negotiate error! Server replied with error status code!c                 S   s   g | ]}|‘qS r1   r1   ©Ú.0Údialectr1   r1   r2   Ú
<listcomp>2  s    z+SMBConnection.negotiate.<locals>.<listcomp>c                 s   s   � | ]}|t v V  qd S r5   )ÚSMB2_NEGOTIATE_DIALTECTS_3r'  r1   r1   r2   Ú	<genexpr>6  s   € z*SMBConnection.negotiate.<locals>.<genexpr>zDnegotiate_1 dialect probably not suppported by the server. reply: %sznegotiate_1 reply: %srC   zServer selected dialect: %sr  )FNN)_rÌ   ÚWILDCARDr‚   r   r   ÚSMB_COM_NEGOTIATEÚCommandr   ÚSUCCESSrõ   rï   r	   ÚSMB_FLAGS2_UNICODEÚFlags2r   ÚDialectsr
   ÚsendSMBÚrecvSMBr  rI   ÚDialectIndexrç   rD   ÚNEGOTIATE_REQr«   r  rJ   r    Ú
ClientGuidÚallÚNegotiateCapabilitiesÚ
ENCRYPTIONrÏ   ÚNegotiateContextListÚappendr   Ú	constructr¶   r¾   r   Úfrom_enc_listr¿   r   rº   r   Úfrom_comp_listr¼   ÚSMB2Header_SYNCÚSMB2CommandÚ	NEGOTIATEÚ	CreditReqr   r%  ÚNOT_SUPPORTEDÚDialectRevisionÚSMBUnsupportedDialectSelectedr�   r®   r©   r¬   rŽ   r{   r�   r   r½   r¹   ÚContextTyper   ÚENCRYPTION_CAPABILITIESÚCiphersÚCOMPRESSION_CAPABILITIESÚCompressionAlgorithmsr¸   r   ÚlogÚminr˜   r™   rš   r›   ÚMULTI_CHANNELr¤   ÚLEASINGr¡   Ú	LARGE_MTUr¢   r§   r¨   r)   r+   r�   r„   r  Úbuffer_size)r@   r  r  rD   rI   rþ   rd   r
  Ú	rply_dataÚnegctxr  r1   r1   r2   r    sê   €




ÿÿ
ÿÿ
ÿÿ
þÿ





€




€ýzSMBConnection.negotiatec              
   Ã   sF  ��z‰d }t j}d}|t jkrä|dkrätƒ }z1| jj|| j ¡ | jd�I d H \|_}}|d ur1|‚|dkrF| jjd urF| jjj	d urFW W dS W n t
yd } zt|ƒ d¡dkr^tt|ƒƒ‚|‚d }~ww d|_tj|_| jdu rutj|_d|_d|_d|_tƒ }	tj|	_d|	_t|	|ƒ}
|  |
¡I d H \}}|d ur�|‚|  |¡I d H \}}}|d ur®|‚| jdkr¸|j j| _|j j!t j"t jfvrÃn!|j j!t j"krÏ|  #|¡ |j$j}|j j!}|d8 }|t jkrä|dks|j j!t j"k�r…| jj|| j ¡ d	�I d H \|_}}|d u�r|‚| j %¡ du �rd
| _&| j '¡ d d… | _(| j&�r~| j)t*j+t*j,t*j-fv �r~| j)t*j-k�rZt.| j(d| j/dƒ| _0t.| j(d| j/dƒ| _1t.| j(d| j/dƒ| _2t.| j(d| j/dƒ| _3n$t.| j(dddƒ| _0t.| j(dddƒ| _1t.| j(dddƒ| _2t.| j(dddƒ| _3t4j5| _6W dS t7d|j j!ƒ‚ t
�y¢ } z
d
|fW  Y d }~S d }~ww )NrÄ   r   )Úspnry   Tr  ÚPreauthéÿÿÿÿrC   )rU  FrÙ   s   SMBSigningKey é€   s
   SMBAppKey s   SMBC2SCipherKey s   SMBS2CCipherKey s   SMB2AESCMAC s   SmbSign s   SMB2APP s   SmbRpc s   SMB2AESCCM s
   ServerIn  s
   ServerOut z.session_setup (authentication probably failed))8r   ÚMORE_PROCESSING_REQUIREDÚSESSION_SETUP_REQr}   Úauthenticatery   Úto_target_stringÚBufferÚselected_authentication_contextÚntlmChallengerç   ÚstrÚfindÚSMBKerberosPreauthFailedrï   r©   r¬   r  r{   rª   rJ   ÚChannelÚPreviousSessionIdrA  rB  ÚSESSION_SETUPr/  rD  r
   r4  r5  rF   rD   rõ   r0  r%  rI   Úis_guestrŽ   rÐ   r¯   r�   rÌ   rÍ   rÎ   rÏ   r%   r·   r°   r±   r²   r³   r)   r,   r�   ÚSMBException)r@   r  Úauthdatar�   ÚmaxiterrI   r  r
  r  rD   rþ   rd   r  rS  r1   r1   r2   r  §  s�   €(€€ú	




Î4$
 þ€ÿzSMBConnection.session_setupÚreturnc              
   Ã   sÖ   �zR|| j vr| j|  ¡ I dH  | j  |¡\}}|du r|‚| jtjkr6| jtj	kr6|  j
|jjd 7  _
|jjtjkrG|| jv rF| j|= n| j|  ¡  ||dfW S  tyj } zdd|fW  Y d}~S d}~ww )zo
		Returns an SMB message from the outstandingresponse dict, OR waits until the expected message_id appears.
		NrC   )rg   rh   ÚwaitÚpopr�   r)   r*   r�   rÌ   ÚSMB202r—   rD   ÚCreditChargerõ   r   rö   Úclearrç   )r@   rd   rþ   rý   r  r1   r1   r2   r5    s(   €

€€ÿzSMBConnection.recvSMBrþ   c                 C   sŒ   | j tjtjfv r.| jr,|jjtjA |j_t	 
| j| ¡ tj¡ ¡ }|d d… |j_d S d S | jrD| ¡ }t| j|t|ƒƒ}||j_d S d S )NrÙ   )r�   rÌ   rm  ÚSMB210r¯   rD   rï   ÚSMB2HeaderFlagÚSMB2_FLAGS_SIGNEDr   ÚnewÚto_bytesr    Úsha256r$  rí   r°   r$   Úlen)r@   rþ   r$  rý   Ú	signaturer1   r1   r2   Úsign_message!  s   ýýzSMBConnection.sign_messagec                 C   sè   | j tjkr9t d¡}tƒ }|d |_t|ƒ|_| j |_	| j
|_
t| jt|dd�}| || ¡ dd… ¡\}|_n6| j tjkrot d¡}tƒ }|d |_t|ƒ|_| j |_	| j
|_
t| jt|ƒ}| || ¡ dd… ¡\}|_t||ƒS )	NrØ   s        rÙ   rÚ   rÜ   rÝ   rÞ   s       )r¹   r   r½   ÚosÚurandomÚSMB2Header_TRANSFORMrê   rv  ÚOriginalMessageSizeré   rF   r!   r²   r"   r=   rt  rí   rî   r#   r   )r@   rý   ÚnonceÚhdrrÿ   Úenc_datar1   r1   r2   Úencrypt_message5  s&   


 



zSMBConnection.encrypt_messagec                 C   s€   |  ¡ }| jdu r<| jtjkr|}n| jtjkrt|ƒ}ntd| j ƒ‚tƒ }t	|ƒ|_
| j|_tj|_d|_t||ƒS tdƒ‚)NFz6Common compression type is %s but its not implemented!r   z$Chained compression not implemented!)rt  r¼   r¸   r   rª   r»   Úlznt1_compressrç   Ú SMB2Header_COMPRESSION_TRANSFORMrv  ÚOriginalCompressedSegmentSizerð   r   rï   rò   r   )r@   rþ   rý   Úcompressed_dataÚcomp_hdrr1   r1   r2   Úcompress_message_  s   



zSMBConnection.compress_messageNc              
   Ã   sÒ  �zÑt j  ¡ | _| jtjkrRt|tƒrd}|  jd7  _nd|j	_
d|j	_| j|j	_| j}|  jd7  _|  | ¡ ¡ t ¡ | j|< | j | ¡ ¡I dH  |dfW S |j	jtjure| j|j	_|  jd7  _| j|j	_|j	j
srd|j	_
| jtjkr|d|j	_|j	j}|durŠ|j| j|< | jdur™| jdur™|  |¡}| jdu r£|  |¡ | j du rµ| jdurµ|  !| ¡ ¡}n|  | ¡ ¡ t ¡ | j|< | j | ¡ ¡I dH  |dfW S  t"yè } z
d|fW  Y d}~S d}~ww )zp
		Sends an SMB message to teh remote endpoint.
		msg: SMB2Message or SMBMessage
		Returns: MessageId integer
		r   rC   Né   T)#rã   rä   rŒ   r�   r)   r*   r  r
   r—   rD   rn  rD  r÷   r%  rt  r[   r  rh   r„   Úwriter/  rB  ÚCANCELrF   r+   r]   r“   r¸   r²   r†  rŽ   rx  r�   r€  rç   )r@   rþ   r_   rd   r  r1   r1   r2   r4  t  sR   €








€ÿzSMBConnection.sendSMBr6   c              
   Ã   sF  �z‹| j dks| jtjkrtƒ ‚|du rtdƒ‚tƒ }||_d|_t	ƒ }t
j|_t||ƒ}|  |¡I dH \}}|dur=|‚|  |¡I dH \}}}|durN|‚|jjtjkrlt ||¡}	|	| j|jj< |	| j|< |	dfW S |jjtjkrvtƒ ‚|jjtjkr†d| _ tdtjƒ‚td|jjƒ‚ ty¢ }
 z
d|
fW  Y d}
~
S d}
~
ww )ze
		share_name MUST be in "\\server\share" format! Server can be NetBIOS name OR IP4 OR IP6 OR FQDN
		TNzShare name is None!r   zsession deltedÚ )rÂ   r�   r)   r-   rå   rç   ÚTREE_CONNECT_REQÚPathrï   rA  rB  ÚTREE_CONNECTr/  r
   r4  r5  rD   rõ   r   r0  r4   rR   r”   rE   r•   ÚBAD_NETWORK_NAMEÚSMBIncorrectShareNameÚUSER_SESSION_DELETEDrg  )r@   r6   rI   rD   rþ   rd   r
  r  r	  rQ   r  r1   r1   r2   Útree_connect³  sB   €


€ÿzSMBConnection.tree_connectÚ
file_attrsÚimpresonation_levelc              
   Ã   s¬  �z¯| j dks| jtjkrtƒ ‚|| jvrtd| ƒ‚tƒ }|	|_||_	||_
||_||_||_||_||_|
|_tƒ }tj|_||_t||ƒ}|  |¡I d H \}}|d urX|‚|  |¡I d H \}}}|d uri|‚|jjtjkr’t ||||	¡}|| j|j < |dkr‹|j!j"|j!d fW S |j!j"d fW S |jjtj#kr¥t$d|jjj% |jjƒ‚t$d|jjj% |jjƒ‚ tyÕ } z|dkrÇd d |fW  Y d }~S d |fW  Y d }~S d }~ww )NTúUnknown Tree ID! %sú%s)&rÂ   r�   r)   r-   rå   r”   rç   Ú
CREATE_REQÚRequestedOplockLevelÚImpersonationLevelÚDesiredAccessr   ÚShareAccessÚCreateDispositionÚCreateOptionsÚNameÚCreateContextrA  rB  ÚCREATEr/  rE   r
   r4  r5  rD   rõ   r   r0  rT   r`   r–   rU   rI   r^   ÚACCESS_DENIEDrg  rô   )r@   r7   Ú	file_pathÚdesired_accessÚ
share_modeÚcreate_optionsÚcreate_dispositionr’  r“  rV   Úcreate_contextsÚreturn_replyrI   rD   rþ   rd   r
  r  r	  r_   r  r1   r1   r2   Úcreateâ  sR   €

€ýzSMBConnection.creater   c              
   Ã   s  �zí| j dks| jtjkrtƒ ‚|| jvrtd| ƒ‚|| jvr&td| ƒ‚| j| j4 I dH š± t	ƒ }t
j|_||_| jtjkrP| jdkrPd|d d  |_ntd|ƒ}tƒ }||_||_||_d|_d|_t||ƒ}| j|| j| d�I dH \}}	|	dur�|	‚|  |¡I dH \}
}}	|	dur’|	‚|
jjtj kr­|
j!j"|
j!j#dfW  d  ƒI dH  W S |
jjtj$krÁ	 W d  ƒI dH  W d	S |
jjtj%krÚ|
j!j"ddfW  d  ƒI dH  W S t&d
|
jjƒ‚1 I dH sçw   Y  W dS  t�y } zdd|fW  Y d}~S d}~ww )a  
		Will issue one read command only then waits for reply. To read a whole file you must use a filereader logic! 
		returns the data bytes and the remaining data length
		
		IMPORTANT: remaning data length is dependent on the length of the requested chunk (length param) not on the actual file length.
		to get the remaining length for the actual file you must set the length parameter to the correct file size!
		
		If and EOF happens the function returns an empty byte array and the remaining data is set to 0
		Tr”  úUnknown File ID! %sNrC   é   r   ©r_   )ó    r   NzSMB READ Error!)'rÂ   r�   r)   r-   rå   r”   rç   r–   r]   rA  rB  ÚREADr/  rE   r�   rÌ   rm  r¢   rn  rN  ÚREAD_REQÚLengthrò   r^   ÚMinimumCountÚRemainingBytesr
   r4  r5  rD   rõ   r   r0  rI   r]  ÚDataRemainingÚEND_OF_FILEÚBUFFER_OVERFLOWrg  )r@   r7   rU   ÚoffsetÚlengthrD   rI   rþ   rd   r
  r  r	  r  r1   r1   r2   râ     sV   €




â ß#Û(Ø*€ÿzSMBConnection.readc              
   Ã   sÔ  �zÒ| j dks| jtjkrtƒ ‚|| jvrtd| ƒ‚|| jvr&td| ƒ‚| j| j4 I dH š– t	ƒ }t
j|_||_t|ƒ| jkrI|d| j… }| jtjkr`| jdkr`dt|ƒd d  |_n|dtdt|ƒƒ… }tƒ }t|ƒ|_||_||_||_t||ƒ}| j|| j| d�I dH \}}	|	dur–|	‚|  |¡I dH \}
}}	|	dur§|	‚|
jjt j!kr¿|
j"j#dfW  d  ƒI dH  W S t$d|
jjƒ‚1 I dH sÌw   Y  W dS  tyé } z
d|fW  Y d}~S d}~ww )	aW  
		This function will send one packet only! The data size can be larger than what one packet allows, but it will be truncated
		to the maximum. 
		Also, there is no guarantee that the actual sent data will be fully written to the remote file! This will be indicated in the returned value.
		Use a high-level function to get a full write.
		
		Tr”  r©  NrC   rª  r«  rŠ  )%rÂ   r�   r)   r-   rå   r”   rç   r–   r]   rA  rB  ÚWRITEr/  rE   rv  rš   r�   rÌ   rm  r¢   rn  rN  Ú	WRITE_REQr¯  rò   r^   ÚDatar
   r4  r5  rD   rõ   r   r0  rI   ÚCountrg  )r@   r7   rU   rì   rµ  rD   rI   rþ   rd   r
  r  r	  r  r1   r1   r2   rˆ  W  sL   €




ã à!€ÿzSMBConnection.writerŠ  c              
   Ã   s¶  �zÃ| j dks| jtjkrtƒ ‚|| jvrtd| ƒ‚|| jvr&td| ƒ‚tƒ }||_	||_
||_||_||_||_tƒ }	tj|	_||	_t|	|ƒ}
|  |
¡I dH \}}|durZ|‚|  |¡I dH \}}}|durk|‚|jjtjkr¾|tjkr„tj|jjt j!d�dfW S |tj"krŸ|t
j#kr˜t$ |jj¡dfW S |jjdfW S |tj%kr«|jjdfW S |tj&kr·|jjdfW S |jjdfW S t'd|jjƒ‚ tyÚ } z
d|fW  Y d}~S d}~ww )a  
		Queires the file or directory for specific information. The information returned is depending on the input parameters, check the documentation on msdn for a better understanding.
		The resturned data can by raw bytes or an actual object, depending on wther your info is implemented in the library.
		Sorry there are a TON of classes to deal with :(
		
		IMPORTANT: in case you are requesting big amounts of data, the result will arrive in chunks. You will need to invoke this function until None is returned to get the full data!!!
		Tr”  r©  N)Úobject_typerŠ  )(rÂ   r�   r)   r-   rå   r”   rç   r–   ÚQUERY_INFO_REQÚInfoTyper   ÚAdditionalInformationrï   r^   r¹  rA  rB  Ú
QUERY_INFOr/  rE   r
   r4  r5  rD   rõ   r   r0  ÚQueryInfoTypeÚSECURITYr   rè   rI   r   ÚSE_FILE_OBJECTÚFILEÚFileFullDirectoryInformationr   Ú
FILESYSTEMÚQUOTArg  )r@   r7   rU   Ú	info_typeÚinformation_classÚadditional_informationÚflagsÚdata_inrI   rD   rþ   rd   r
  r  r	  r  r1   r1   r2   Ú
query_infoŒ  sT   €







€ÿzSMBConnection.query_infor   c              
   Ã   sr  �z¡| j dks| jtjkrtƒ ‚|| jvrtd| ƒ‚|| jvr&td| ƒ‚tƒ }||_	d|_
|dkr;| j
tjO  _
||_||_||_tƒ }	tj|	_||	_t|	|ƒ}
|  |
¡I dH \}}|durc|‚|  |¡I dH \}}}|durt|‚|jjtjkr‘|tjkrŠt |j j!¡dfW S |j j!dfW S |jjtj"kr›W dS td|jj ƒ‚ ty¸ } z
d|fW  Y d}~S d}~ww )zº
		
		IMPORTANT: in case you are requesting big amounts of data, the result will arrive in chunks. You will need to invoke this function until None is returned to get the full data!!!
		Tr”  r©  r   N)NNzquery_directory reply: %s)#rÂ   r�   r)   r-   rå   r”   rç   r–   ÚQUERY_DIRECTORY_REQÚFileInformationClassrï   ÚQueryDirectoryFlagÚSMB2_INDEX_SPECIFIEDÚ	FileIndexr^   ÚFileNamerA  rB  ÚQUERY_DIRECTORYr/  rE   r   r4  r5  rD   rõ   r   r0  r   rÄ  r   rè   rI   r¹  ÚNO_MORE_FILES)r@   r7   rU   Úsearch_patternÚresume_indexrÈ  ÚmaxBufferSizerÊ  rI   rD   rþ   rd   r
  r  r	  r  r1   r1   r2   Úquery_directoryÐ  sJ   €



€ÿzSMBConnection.query_directoryr&  c              
   Ã   sÞ   �zW| j dks| jtjkrtƒ ‚tƒ }||_||_||_||_	||_
tƒ }tj|_||_t||ƒ}	|  |	¡I d H \}
}|d urA|‚|  |
¡I d H \}}}|d urR|‚|jj	d fW S  tyn } z
d |fW  Y d }~S d }~ww )NT)rÂ   r�   r)   r-   rå   Ú	IOCTL_REQÚCtlCoder^   rï   r]  ÚMaxOutputResponserA  rB  ÚIOCTLr/  rE   r   r4  r5  rI   rç   )r@   r7   rU   Úctlcoderì   rÊ  rÛ  rI   rD   rþ   rd   r
  r  r	  r  r1   r1   r2   Úioctl  s2   €
€ÿzSMBConnection.ioctlc              
   Ã   sä   �zZ| j dks| jtjkrtƒ ‚tƒ }||_||_tƒ }t	j
|_||_t||ƒ}|  |¡I dH \}}|dur8|‚|  |¡I dH \}	}
}|durI|‚|	jjtjkrY|| jv rY| j|= W dS  tyq } z
d|fW  Y d}~S d}~ww )z{
		Closes the file/directory/pipe/whatever based on file_id. It will automatically remove all traces of the file handle.
		TNr  )rÂ   r�   r)   r-   rå   Ú	CLOSE_REQrï   r^   rA  rB  ÚCLOSEr/  rE   r   r4  r5  rD   rõ   r   r0  r–   rç   )r@   r7   rU   rÊ  rI   rD   rþ   rd   r
  r  r	  r  r1   r1   r2   r  "  s2   €

€ÿzSMBConnection.closec              
   Ã   s¾   �zG| j dks| jtjkrtƒ ‚tƒ }||_tƒ }tj	|_
||_t||ƒ}|  |¡I dH \}}|dur5|‚|  |¡I dH \}}	}|durF|‚W dS  ty^ }
 z
d|
fW  Y d}
~
S d}
~
ww )zK
		Flushes all cached data that may be on the server for the given file.
		TNr  )rÂ   r�   r)   r-   rå   Ú	FLUSH_REQr^   rA  rB  ÚFLUSHr/  rE   r   r4  r5  rç   )r@   r7   rU   rI   rD   rþ   rd   r
  r  r	  r  r1   r1   r2   ÚflushB  s*   €
€ÿzSMBConnection.flushc           	   
   Ã   s²   �zA| j dks| jtjkrtƒ ‚tƒ }tƒ }tj|_	t
||ƒ}|  |¡I dH \}}|dur/|‚|  |¡I dH \}}}|dur@|‚W dS  tyX } z
d|fW  Y d}~S d}~ww )zú
		Logs off from the server, effectively terminates the session. 
		The underlying connection will still be active, so please either clean it up manually or dont touch this function
		For proper closing of the connection use the terminate function
		TNr  )rÂ   r�   r)   r-   rå   Ú
LOGOFF_REQrA  rB  ÚLOGOFFr/  r   r4  r5  rç   ©	r@   rI   rD   rþ   rd   r
  r  r	  r  r1   r1   r2   Úlogoff\  s&   €
€ÿzSMBConnection.logoffc           	   
   Ã   sÞ   �zW| j dks| jtjkrtƒ ‚tƒ }tƒ }tj|_	t
||ƒ}|  |¡I dH \}}|dur/|‚|  |¡I dH \}}}|dur@|‚|jjtjkrJW dS dtd|jjj |jjƒfW S  tyn } z
d|fW  Y d}~S d}~ww )zi
		Issues an ECHO request to the server. Server will reply with and ECHO response, if it's still alive
		TNr  r•  )rÂ   r�   r)   r-   rå   ÚECHO_REQrA  rB  ÚECHOr/  r   r4  r5  rD   rõ   r   r0  rg  rô   rç   ræ  r1   r1   r2   r"  v  s*   €
€ÿzSMBConnection.echoc              
   Ã   s&  �z{| j dks| jtjkrtƒ ‚tƒ }tƒ }tj|_	||_
t||ƒ}|  |¡I dH \}}|dur2|‚|  |¡I dH \}}}|durC|‚|jjtjkrzg }	| j| j}
| jD ]}| j| j|krh|	 | j| j¡ qU|	D ]}| j|= qk| j|= | j|
= W dS  ty’ } z
d|fW  Y d}~S d}~ww )zL
		Disconnects from tree, removes all file entries associated to the tree
		TNr  )rÂ   r�   r)   r-   rå   ÚTREE_DISCONNECT_REQrA  rB  ÚTREE_DISCONNECTr/  rE   r   r4  r5  rD   rõ   r   r0  r”   r6   r–   r7   r=  rU   r•   rç   )r@   r7   rI   rD   rþ   rd   r
  r  r	  Údel_file_idsr6   ÚferU   r  r1   r1   r2   Útree_disconnect‘  s>   €

€
€ÿzSMBConnection.tree_disconnectc           	   
   Ã   sº   �zE| j dks| jtjkrtƒ ‚tƒ }tƒ }tj|_	t
||ƒ}||j_|  |¡I dH \}}|dur3|‚|  |¡I dH \}}}|durD|‚W dS  ty\ } z
d|fW  Y d}~S d}~ww )z6
		Issues a CANCEL command for the given message_id
		TNr  )rÂ   r�   r)   r-   rå   Ú
CANCEL_REQrA  rB  r‰  r/  r   rD   r÷   r4  r5  rç   )	r@   rd   rI   rD   rþ   r
  r  r	  r  r1   r1   r2   rq   ¹  s(   €
€ÿzSMBConnection.cancelc              
   Ã   s†  �zµzs| j dks| jtjkrW W | jdur| j ¡  dS dS | jtjkrct| j 	¡ ƒD ]}zt
j|  |¡dd�I dH  W q+   Y q+zt
j|  ¡ dd�I dH  W n tyb } zW Y d}~nd}~ww t
j|  ¡ dd�I dH  t d¡ W n2 t
jy�   Y W | jdur‹| j ¡  dS dS  ty§ } zt dt|ƒ ¡ W Y d}~nd}~ww W | jdurµ| j ¡  dS dS | jdurÂ| j ¡  w w )z¤
		Use this function to properly terminate the SBM connection.
		Terminates the connection. Closes all tree handles, logs off and disconnects the TCP connection.
		TNrC   rÅ   zTerminate finished!zterminate error %s)rÂ   r�   r)   r-   r‰   rn   r,   Úlistr”   Úkeysr[   rÆ   rî  rç  rç   r  r   rñ   rû   r`  )r@   r7   r  r1   r1   r2   rÇ   Ò  sH   €
ÿì€ÿ
ÿý€ÿ€
ÿÿzSMBConnection.terminatec                 Ã   s’   �d| _ dd„ }tdƒ |  ¡ I d H  tdƒ tƒ }tƒ }tj|_t||ƒ}| j	||d�I d H \}}zt
j|  |¡dd�I d H }W dS    Y d	S )
NTc                 S   sH   t dƒ |  ¡ }t|ƒ}tƒ }t|ƒ|_tj|_t	j
|_d|_t||ƒS )NzCallback is here!r   )Úprintrt  r�  r‚  rv  rƒ  r   r»   rð   r   rª   rï   rò   r   )rþ   rý   r„  r…  r1   r1   r2   Úcompress_callbackö  s   

z1SMBConnection.ghosting.<locals>.compress_callbackz[################################### TESTING compression ###################################zY################################### SPLOIT SPLOIT SPLOIT ################################)Úcompression_cbg      à?rÅ   F)r‹   rò  r"  rè  rA  rB  ré  r/  r   r4  r[   rÆ   r5  )r@   ró  rI   rD   rþ   rd   r
  r  r1   r1   r2   Úghostingó  s    €	
zSMBConnection.ghosting)TF)Fr5   )r   r   )r   )>r.   r/   r0   Ú__doc__Ú	SMBTargetÚboolrA   rÃ   rË   rÐ   rÓ   r  r  r  r  r  r  r  Úbytesr%  r  r  r   r   rç   r5  rx  r   r€  r   r†  r4  r`  r‘  r˜  ÚImpersonationÚOplockLevelÚSMB2_OPLOCK_LEVEL_NONEr   r¨  râ   rˆ  rÀ  rÃ  r   ÚFileStandardInformationrÌ  rÄ  rØ  ÚIOCTLREQFlagsÚIS_IOCTLrÞ  Ú	CloseFlagrª   r  rã  rç  r"  rî  rq   rÇ   rõ  r1   r1   r1   r2   rx   �   sL    g]
 
'^*? /
4
A5D4 (!rx   c                 Ã   s   �|   ¡ }| ¡ I d H  d S r5   )Úget_connectionr  )ÚcuÚconnr1   r1   r2   Úctest  s   €r  Ú__main__)ÚSMBConnectionFactoryé   z5smb+ntlm-password://TEST\victim:Passw0rd!1@10.10.10.2)YÚenumr[   r   rÊ   rã   Útypingr   Úaiosmbr   Úaiosmb.commons.exceptionsÚaiosmb.transport.netbiosr   Ú!aiosmb.protocol.smb.command_codesr   Úaiosmb.wintypes.ntstatusr   Úaiosmb.protocol.smb.headerr   r	   Úaiosmb.protocol.smb.messager
   Úaiosmb.protocol.smb.commonsr   Úaiosmb.protocol.smb.commandsr   Úaiosmb.protocol.smb2.messager   r   r   Ú'aiosmb.protocol.smb2.commands.negotiater   r   r   r   r   r   r   r   r   r   Úaiosmb.protocol.smb2.commandsÚaiosmb.protocol.smb2.headersÚ"aiosmb.protocol.smb2.command_codesÚaiosmb.protocol.commonÚ.aiosmb.wintypes.dtyp.constrcuted_security.guidÚ-aiosmb.wintypes.fscc.structures.fileinfoclassr   Ú<aiosmb.wintypes.fscc.structures.FileFullDirectoryInformationr   Ú#aiosmb.wintypes.fscc.FileAttributesr   Úwinacl.dtyp.security_descriptorr   Úwinacl.functions.constantsr   Ú aiosmb.commons.connection.targetÚ	unicryptor   r    Úunicrypto.symmetricr!   r"   r#   Úunicrypto.cmacr$   Úunicrypto.kdfr%   Ú!aiosmb.protocol.compression.lznt1r&   r�  r'   ró   Úasysocks.unicomm.clientr(   ÚEnumr)   r4   rT   ra   rx   r  r.   Ú!aiosmb.commons.connection.factoryr  ÚsetLevelÚurlÚfrom_urlr  rv   r1   r1   r1   r2   Ú<module>   sx    0)           


ö