%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/plesk/python/2.7/lib/python2.7/site-packages/smb/
Upload File :
Create Path :
Current File : //opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyc

�
�ac@s
ddlZddlZddlZddlZddlZddlZddlZddlmZddlTe	Z
e	ZgZx=e
dNg�D],\Z\ZZeje�ee�e<q�WgZxGe
dOg�D]6\Z\ZZeje�eee�e�e<q�Wdefd	��YZd
efd��YZdefd
��YZdefd��YZddPd��YZddQd��YZddRd��YZdefd��YZdefd��YZdefd��YZdefd��YZ defd��YZ!d efd!��YZ"d"efd#��YZ#d$efd%��YZ$d&efd'��YZ%d(efd)��YZ&d*efd+��YZ'd,efd-��YZ(d.efd/��YZ)d0efd1��YZ*d2efd3��YZ+d4efd5��YZ,d6efd7��YZ-d8efd9��YZ.d:efd;��YZ/d<efd=��YZ0d>efd?��YZ1d@efdA��YZ2dBefdC��YZ3dDefdE��YZ4dFefdG��YZ5dHefdI��YZ6dJefdK��YZ7dLefdM��YZ8dS(Si����N(tStringIO(t*tNT_LAN_MANAGER_DIALECTs
NT LM 0.12tSMB2_DIALECTs	SMB 2.002tUnsupportedFeaturecBseZdZRS(sz
    Raised when an supported feature is present/required in the protocol but is not
    currently supported by pysmb
    (t__name__t
__module__t__doc__(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRst
ProtocolErrorcBs eZddd�Zd�ZRS(cCs||_||_||_dS(N(tmessagetdata_buftsmb_message(tselfR	R
R((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyt__init__#s		cCs�t�}|j|jtj�|jr^|jdddtj�|jt|j��n|jr�|jdddtj�|jtj	|j��|jtj�n|j
�S(	Nt=is
 SMB Message s SMB Data Packet (hex) s====================s====================s====================s====================(RtwriteR	tostlinesepRtstrR
tbinasciithexlifytgetvalue(Rtb((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyt__str__(s			N(RRtNoneR
R(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR!stSMB2ProtocolHeaderErrorcBseZd�ZRS(cCstj|d�dS(NsPacket header belongs to SMB2(RR
(R((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR
8s(RRR
(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR6stOperationFailurecBseZd�Zd�ZRS(cCs"|g|_||_||_dS(N(targsR	tsmb_messages(RR	R((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR
=s	cCs�t�}|j|jtj�x�t|j�D]�\}}|jdd|d	tj�|jdtj�|jdtj�|jt|��|jdtj�|jdtj�|jtj	|j
��|jtj�q0W|j�S(
NRis SMB Message %d sSMB Header:s-----------sSMB Data Packet (hex):s----------------------s====================s====================(RRR	RRt	enumerateRRRRtraw_dataR(RRtidxtm((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRBs	 (RRR
R(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR;s	tSMBErrorcBs2eZd�Zd�Zd�Zed��ZRS(cCs|j�dS(N(treset(R((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR
UscCsd|_t|_dS(Nl(tinternal_valuetTruetis_ntstatus(R((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR"Xs	cCs4|jrd|jSd|jd?|jd@fSdS(NsNTSTATUS=0x%08Xs"ErrorClass=0x%02X ErrorCode=0x%04Xii��(R%R#(R((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR\s	cCs
|jdkS(Ni(R#(R((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pythasErrorbs(RRR
R"RtpropertyR&(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR!Ss			t
SMBMessagecBs�eZdZeje�Zejd�ZdZ	dd�Zd�Zd�Z
ed��Zed��Zd�Zd	�Zd
�ZRS(s<4sBIBHHQxxHHHHBsSMB.SMBMessageicCs0|j�|r,||_|jj|�ndS(N(R"tpayloadtinitMessage(RR)((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR
os
	cCs�t�}|jd|jtj|jd�tjf�|jdt|j�tjf�|jd|j	tjf�|jd|j
tjf�|jd|jtjf�|jd|jtjf�|jd|j
tjf�|jd	|jtjf�|jd
|jtjf�|jdt|j�tjtj|j�tjf�|jdt|j�tjtj|j�tjf�|j�S(
NsCommand: 0x%02X (%s) %ss	<unknown>s
Status: %s %ssFlags: 0x%02X %ssFlags2: 0x%04X %ss
PID: %d %ss
UID: %d %ss
MID: %d %ss
TID: %d %ssSecurity: 0x%016X %ssParameters: %d bytes %s%s %ssData: %d bytes %s%s %s(RRtcommandtSMB_COMMAND_NAMEStgetRRRtstatustflagstflags2tpidtuidtmidttidtsecuritytlentparameters_dataRRtdataR(RR((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRus	/#88cCs|d|_d|_t�|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_d|_dS(Ntil(RR+R!R.R/R0R1R4R2R3R5R7R8RR)(R((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR"�s											cCst|jt@�S(N(tboolR/tSMB_FLAGS_REPLY(R((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pytisReply�scCst|jt@�S(N(R:R0tSMB_FLAGS2_EXTENDED_SECURITY(R((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pythasExtendedSecurity�scCs�|jst�tj�|_|jj|�t|j�}|ddksSt�tj	|j
d|j|jj
|j|j|jd?d@|j|j|jd@|j|jt|d��
}||jtj	dt|j��|jS(s!
        Encode this SMB message into a series of bytes suitable to be embedded with a NetBIOS session message.
        AssertionError will be raised if this SMB message has not been initialized with a Payload instance

        @return: a string containing the encoded SMB message
        iis�SMBii��s<H(R)tAssertionErrorRtgetpidR1tprepareR6R7tstructtpacktHEADER_STRUCT_FORMATR+R.R#R/R0R5R4R2R3tintR8(Rtparameters_lentheaders_data((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pytencode�s )cCs�t|�}||jkr-td|��n|j�tj|j||j �\}|_}|_|_	}|_
|_}|_|_
}|dkr�t��n|dkr�td|��n|d>|B|_||j_t|j	t@�|j_|j}||ddkr'td|��n||d}	tjd||	|	d!�d	}
|
d	kr�||	d|
kr�td
|��n|||	!|_|
d	kr�||	d|	d|
!|_n||_|j�|j|dd|
S(s

        Decodes the SMB message in buf.
        All fields of the SMBMessage object will be reset to default values before decoding.
        On errors, do not assume that the fields will be reinstated back to what they are before
        this method is invoked.

        @param buf: data containing one complete SMB message
        @type buf: string
        @return: a positive integer indicating the number of bytes used in buf to decode this SMB message
        @raise ProtocolError: raised when decoding fails
        s$Not enough data to decode SMB headers�SMBs�SMBsInvalid 4-byte protocol fieldiis0Not enough data. Parameters list decoding faileds<His%Not enough data. Body decoding failed(R6tHEADER_STRUCT_SIZERR"RBtunpackRDR+R/R0R5R4R2R3RR1R.R#R:tSMB_FLAGS2_NT_STATUSR%R7R8Rt_decodePayload(Rtbuftbuf_lentprotocolR.tpid_hightpid_lowtparams_counttoffsettdatalen_offsettbody_len((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pytdecode�s2
U	! 	
cCsL|jtkrt�|_n|jtkr<t�|_n�|jtkrZt�|_n�|jtkrxt	�|_n�|jt
kr�t�|_n�|jtkr�t
�|_nx|jtkr�t�|_nZ|jtkr�t�|_n<|jtkrt�|_n|jtkr,t�|_n|jrH|jj|�ndS(N(R+tSMB_COM_READ_ANDXtComReadAndxResponseR)tSMB_COM_WRITE_ANDXtComWriteAndxResponsetSMB_COM_TRANSACTIONtComTransactionResponsetSMB_COM_TRANSACTION2tComTransaction2ResponsetSMB_COM_OPEN_ANDXtComOpenAndxResponsetSMB_COM_NT_CREATE_ANDXtComNTCreateAndxResponsetSMB_COM_TREE_CONNECT_ANDXtComTreeConnectAndxResponsetSMB_COM_ECHOtComEchoResponsetSMB_COM_SESSION_SETUP_ANDXtComSessionSetupAndxResponsetSMB_COM_NEGOTIATEtComNegotiateResponseRV(R((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRL�s,	N(RRRDRBtcalcsizeRItloggingt	getLoggertlogRORR
RR"R'R<R>RHRVRL(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR(gs				5tPayloadcBs/eZdZdZd�Zd�Zd�ZRS(s�icCsW|j|kst�ttB|_ttBtBtB|_	t
rS|j	ttBO_	ndS(N(
R)R?tSMB_FLAGS_CASE_INSENSITIVEtSMB_FLAGS_CANONICALIZED_PATHSR/tSMB_FLAGS2_UNICODERKtSMB_FLAGS2_LONG_NAMEStSMB_FLAGS2_EASR0tSUPPORT_EXTENDED_SECURITYR=t!SMB_FLAGS2_SMB_SECURITY_SIGNATURE(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR*s

cCs
t�dS(N(tNotImplementedError(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRAscCs
t�dS(N(Rw(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRVs(RRtDEFAULT_ANDX_PARAM_HEADERtDEFAULT_ANDX_PARAM_SIZER*RARV(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRo�s
		tComNegotiateRequestcBs eZdZd�Zd�ZRS(s[
    References:
    ===========
    - [MS-CIFS]: 2.2.4.52.1
    - [MS-SMB]: 2.2.4.5.1
    cCstj||�t|_dS(N(RoR*RiR+(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR*scCsk|j|kst�d|_trIdjtd�tt��|_ndjtd�t��|_dS(NR9cSsd|dS(Nss((ts((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyt<lambda>&R9cSsd|dS(Nss((R{((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR|(R9(	R)R?R7tSUPPORT_SMB2tjointmaptDIALECTSt	DIALECTS2R8(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRA"s
	%(RRRR*RA(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRzs	RjcBs;eZdZdZeje�Zd�Zed��Z	RS(s�
    Contains information on the SMB_COM_NEGOTIATE response from server

    After calling the decode method, each instance will contain the following attributes,
    - security_mode (integer)
    - max_mpx_count (integer)
    - max_number_vcs (integer)
    - max_buffer_size (long)
    - max_raw_size (long)
    - session_key (long)
    - capabilities (long)
    - system_time (long)
    - server_time_zone (integer)
    - challenge_length (integer)

    If the underlying SMB message's flag2 does not have SMB_FLAGS2_EXTENDED_SECURITY bit enabled,
    then the instance will have the following additional attributes,
    - challenge (string)
    - domain (unicode)

    If the underlying SMB message's flags2 has SMB_FLAGS2_EXTENDED_SECURITY bit enabled,
    then the instance will have the following additional attributes,
    - server_guid (string)
    - security_blob (string)

    References:
    ===========
    - [MS-SMB]: 2.2.4.5.2.1
    - [MS-CIFS]: 2.2.4.52.2
    s<HBHHIIIIQHBcCs�|jtkst�|js6td|j|��nd\
|_|_|_|_	|_
|_|_|_
|_|_t|j�}|dkr�td|j|��ntjd|jd �d|_|jtkrc|dkrtd||j|��q�tj|j|j|j �\}|_|_|_|_	|_
|_|_|_
|_|_nC|jd	kr�td
|j|��ntd|j|j|��t|j�}|js�d\|_|_|jdkr�||jkrp|j|j |_d}|j}xr||krl|j||d!}|d
krU|jd�|_Pq||7}|d7}qWq�td|j|��q�nD|dkr�td|j|��n|jd |_|jd|_dS(NsNot a SMB_COM_NEGOTIATE replyii
is?Not enough data to decode SMB_COM_NEGOTIATE dialect_index fields<HishNT LAN Manager dialect selected in SMB_COM_NEGOTIATE but parameters bytes count (%d) does not meet specsi��scServer does not support any of the pysmb dialects. Please email pysmb to add in support for your OSsUnknown dialect index (0x%04X)R9ssUTF-16LEsYNot enough data to decode SMB_COM_NEGOTIATE (without security extensions) Challenge fieldisWNot enough data to decode SMB_COM_NEGOTIATE (with security extensions) ServerGUID field(i(
iiiiiiiiiii"(R9R9(R+RiR?R<RRt
security_modet
max_mpx_counttmax_number_vcstmax_buffer_sizetmax_raw_sizetsession_keytcapabilitiestsystem_timetserver_time_zonetchallenge_lengthR6R7RBRJt
dialect_indexRtPAYLOAD_STRUCT_FORMATtPAYLOAD_STRUCT_SIZER8R>t	challengetdomainRVtserver_guidt
security_blob(RR	tdata_lent_R{RSt_s((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRVNsJ	B 
a		
cCst|jt@�S(N(R:R�tCAP_EXTENDED_SECURITY(R((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pytsupportsExtendedSecurity�s(
RRRR�RBRkR�RVR'R�(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRj+s
	7t1ComSessionSetupAndxRequest__WithSecurityExtensioncBs/eZdZdZd�Zd�Zd�ZRS(s?
    References:
    ===========
    - [MS-SMB]: 2.2.4.6.1
    s<HHHIHIIcCs||_||_dS(N(R�R�(RR�R�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR
�s	cCstj||�t|_dS(N(RoR*RgR+(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR*�sc
Cs�|jst�|jtO_ttBtBtB}|jt	j
|jddd|jt
|j�d|�|_|j|_tjt
|j�t
|j�ddkr�|jd|_n|jd|_dS(	NiAi
iiisis(R>R?R0RrtCAP_UNICODEtCAP_STATUS32R�tCAP_NT_SMBSRxRBRCR�R�R6R�R7R8R(RI(RR	tcap((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRA�s+-(RRRR�R
R*RA(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR��s
		t/ComSessionSetupAndxRequest__NoSecurityExtensioncBs/eZdZdZd�Zd�Zd�ZRS(sA
    References:
    ===========
    - [MS-CIFS]: 2.2.4.53.1
    s	<HHHIHHIIcCs1||_||_||_||_||_dS(N(tusernameR�tpasswordt
is_unicodeR�(RR�R�R�R�R�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR
�s
				cCstj||�t|_dS(N(RoR*RgR+(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR*�scCs�|jr|jtO_n|jtd@M_t|j�}|jtj|jddd|j	|jro|prd|jr�|p�ddt
tBtB�	|_
tjt|j
�}|j|_|t|j�ddkr�|jt@r�|jd|_n|jt@r+|j|jjd�d|_n|jt|j�d|_|t|j�ddkr�|jt@r�|jd|_n|jt@r�|j|jjd�dd	jd�d|_n|j|jd
|_dS(Ni��iAi
iissUTF-16LEstpysmbspysmb(R�R0RrR6R�RxRBRCR�R�R�tCAP_LARGE_FILESR�R7R(RIR8R�RHRR�(RR	tpassword_lent
est_offset((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRA�s.	*
#*
4(RRRR�R
R*RA(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR��s
		RhcBsAeZdZdZeje�ZdZeje�Zd�Z	RS(s
    Contains information on the SMB_COM_SESSION_SETUP_ANDX response from server

    If the underlying SMB message's flags2 does not have SMB_FLAGS2_EXTENDED_SECURITY bit enabled,
    then the instance will have the following attributes,
    - action

    If the underlying SMB message's flags2 has SMB_FLAGS2_EXTENDED_SECURITY bit enabled
    and the message status is STATUS_MORE_PROCESSING_REQUIRED or equals to 0x00 (no error),
    then the instance will have the following attributes,
    - action
    - securityblob

    If the underlying SMB message's flags2 has SMB_FLAGS2_EXTENDED_SECURITY bit enabled but
    the message status is not STATUS_MORE_PROCESSING_REQUIRED

    References:
    ===========
    - [MS-SMB]: 2.2.4.6.2
    - [MS-CIFS]: 2.2.4.53.2
    s<BBHHs<BBHHHcCsR|jtkst�|js�|jjsNt|j�|jkrZt	d|j
|��ntj|j
|j|j �\}}}|_qNn�|jjs�|jjdkrNt|j�|jkr�t	d|j
|��ntj|j|j|j �\}}}|_}t|j�|kr;t	d|j
|��n|j| |_ndS(NsXNot enough data to decode SMB_COM_SESSION_SETUP_ANDX (no security extensions) parametersI�sZNot enough data to decode SMB_COM_SESSION_SETUP_ANDX (with security extensions) parameterss]Not enough data to decode SMB_COM_SESSION_SETUP_ANDX (with security extensions) security blob(R+RgR?R>R.R&R6R7tNOSECURE_PARAMETER_STRUCT_SIZERRRBRJt NOSECURE_PARAMETER_STRUCT_FORMATtactionR#tSECURE_PARAMETER_STRUCT_SIZEtSECURE_PARAMETER_STRUCT_FORMATR8R�(RR	R�tblob_length((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRVs	41(
RRRR�RBRkR�R�R�RV(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRh�stComTreeConnectAndxRequestcBsAeZdZdZeje�Zdd�Zd�Zd�Z	RS(s[
    References:
    ===========
    - [MS-CIFS]: 2.2.4.55.1
    - [MS-SMB]: 2.2.4.7.1
    s<HHR9cCs#||_||_|d|_dS(Ns(tpathtserviceR�(RR�R�R�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR
!s		cCstj||�t|_dS(N(RoR*RcR+(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR*&scCs�t|j�}|jtj|jd|jr3dp6dB|jrU|jdkrUdpXdB|�|_d}|ddkr�d}n|j||j	j
d	�d
|jd|_dS(Niiii��iR9issUTF-16LEs(
R6R�RxRBRCR�R>R4R7R�RHR�R8(RR	R�tpadding((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRA*s"
	(
RRRR�RBRkR�R
R*RA(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR�s	RdcBs,eZdZdZeje�Zd�ZRS(s
    Contains information about the SMB_COM_TREE_CONNECT_ANDX response from the server.

    If the message has no errors, each instance contains the following attributes:
    - optional_support

    References:
    ===========
    - [MS-CIFS]: 2.2.4.55.2
    s<BBHHcCs�|jtkst�|jjs�t|j�|jkrQtd|j	|��nt
j|j|j|j �\}}}|_
ndS(Ns>Not enough data to decode SMB_COM_TREE_CONNECT_ANDX parameters(R+RcR?R.R&R6R7R�RRRBRJR�toptional_support(RR	R�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRVKs
(RRRR�RBRkR�RV(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRd<s
tComNTCreateAndxRequestcBs\eZdZdZeje�Zddddddddddd�
Zd�Zd�Z	RS(s[
    References:
    ===========
    - [MS-CIFS]: 2.2.4.64.1
    - [MS-SMB]: 2.2.4.9.1
    s
<BHIIIQIIIIIBilcCst|djd�|_||_||_||_||_||_||_||_|	|_	|
|_
||_dS(NssUTF-16LE(RHtfilenameR/troot_fidtaccess_masktallocation_sizetext_attrtshare_accesstcreate_disptcreate_optionst
impersonationtsecurity_flags(RR�R/R�R�R�R�R�R�R�R�R�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR
`s									cCstj||�t|_dS(N(RoR*RaR+(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR*nscCs�t|j�}|jtj|jd||j|j|j|j	|j
|j|j|j
|j|j�
|_d}|jt|j�ddkr�d}n||j|_dS(NiR9is(R6R�RxRBRCR�R/R�R�R�R�R�R�R�R�R�R7RIR8(RR	tfilename_lenR�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRArs& 	(
RRRR�RBRkR�R
R*RA(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR�Us
	RbcBs,eZdZdZeje�Zd�ZRS(s
    Contains (partial) information about the SMB_COM_NT_CREATE_ANDX response from the server.

    Each instance contains the following attributes after decoding:
    - oplock_level
    - fid

    References:
    ===========
    - [MS-CIFS]: 2.2.4.64.2
    s<BBHBHcCs�|jtkst�|jjs�t|j�|jkrQtd|j	|��nt
j|j|j|j �\}}}|_
|_ndS(Ns;Not enough data to decode SMB_COM_NT_CREATE_ANDX parameters(R+RaR?R.R&R6R7R�RRRBRJR�toplock_leveltfid(RR	R�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRV�s
(RRRR�RBRkR�RV(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRb�stComTransactionRequestc	BsVeZdZdZeje�Zddddddddd�Zd�Zd�Z	RS(sA
    References:
    ===========
    - [MS-CIFS]: 2.2.4.33.1
    s<HHHHBBHIHHHHHHiR9s\PIPE\cCs|pt|�|_|p$t|�|_||_||_||_|	|_|
|_||_||_	||_
||_dS(N(R6ttotal_params_countttotal_data_counttmax_params_counttmax_data_counttmax_setup_countR/ttimeouttparams_bytest
data_bytestsetup_bytestname(RR�R�R�R�R�R�R�R�R/R�R�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR
�s								cCstj||�t|_dS(N(RoR*R[R+(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR*�sc
Cs�|jdjd�}t|�}t|j�}t|j�}t|j�}d}|j|j|d}|ddkr�d}|d7}n||7}d}	|ddkr�dd|d}	|d|d7}n|dkr�|}
||7}nd}
d}|ddkr9dd|d}|d|d7}n|dkrN|}nd}tj	|j
|j|j|j
|j|jd|j|jd||
||t|d��|j|_|||	|j||j|_dS(NssUTF-16LER9iiii(R�RHR6R�R�R�RIR�RBRCR�R�R�R�R�R�R/R�RER7R8(
RR	R�tname_lentsetup_bytes_lentparams_bytes_lentdata_bytes_lentpadding0RStpadding1tparams_bytes_offsettpadding2tdata_bytes_offset((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRA�sV


	
(
RRRR�RBRkR�R
R*RA(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR��s	
	R\cBs,eZdZdZeje�Zd�ZRS(sk
    Contains information about a SMB_COM_TRANSACTION response from the server

    After decoding, each instance contains the following attributes:
    - total_params_count (integer)
    - total_data_count (integer)
    - setup_bytes (string)
    - data_bytes (string)
    - params_bytes (string)

    References:
    ===========
    - [MS-CIFS]: 2.2.4.33.2
    s<HHHHHHHHHHcCs�|jtkst�|jjs�t|j�|jkrQtd|j	|��nt
j|j|j|j �\
|_
|_}}}}}}}}	|	dkr�|	d}
t|j�|j|
kr�td|j	|��n|j|j|j|
!|_n	d|_|j|j|	dd}|dkrQ|j|||||!|_n	d|_|dkr�|j|||||!|_q�d|_ndS(Ns8Not enough data to decode SMB_COM_TRANSACTION parametersiiR9(R+R[R?R.R&R6R7R�RRRBRJR�R�R�R�RIR8R�R�(RR	R�R�R�tparams_bytes_displR�R�tdata_bytes_displtsetup_countR�RS((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRVs$C
 	"	"(RRRR�RBRkR�RV(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR\�stComTransaction2RequestcBsSeZdZdZeje�Zdddddddd�Zd�Zd�Z	RS(sA
    References:
    ===========
    - [MS-CIFS]: 2.2.4.46.1
    tHHHHBBHIHHHHHHiR9cCsv|pt|�|_|p$t|�|_||_||_||_|	|_|
|_||_||_	||_
dS(N(R6R�R�R�R�R�R/R�R�R�R�(RR�R�R�R�R�R�R�R�R/R�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR
;s							cCstj||�t|_dS(N(RoR*R]R+(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR*JscCs�t|j�}t|j�}t|j�}d}d}|j|j|d}|ddkrtd}|d7}n|d7}d}|ddkr�dd|d}n|dkr�|}	||7}nd}	d}
|ddkr�dd|d}
n|dkr|}nd}tj|j|j	|j
|j|j|j
d|j|jd||	||t|d��|j|_||||j|
|j|_dS(NsR9iisii(R6R�R�R�RIR�RBRCR�R�R�R�R�R�R/R�RER7R8(RR	R�R�R�R�R�RSR�R�R�R�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRANsP


	
(
RRRR�RBRkR�R
R*RA(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR�1s		R^cBs,eZdZdZeje�Zd�ZRS(sl
    Contains information about a SMB_COM_TRANSACTION2 response from the server

    After decoding, each instance contains the following attributes:
    - total_params_count (integer)
    - total_data_count (integer)
    - setup_bytes (string)
    - data_bytes (string)
    - params_bytes (string)

    References:
    ===========
    - [MS-CIFS]: 2.2.4.46.2
    s<HHHHHHHHHBBcCs�|jtkst�|jjs�t|j�|jkrQtd|j	|��nt
j|j|j|j �\|_
|_}}}}}}}}	}|	dkr|	d}
t|j�|j|
kr�td|j	|��n|j|j|j|
!|_n	d|_|j|j|	dd}|dkrT|j|||||!|_n	d|_|dkr�|j|||||!|_q�d|_ndS(Ns9Not enough data to decode SMB_COM_TRANSACTION2 parametersiis8Not enough data to decode SMB_COM_TRANSACTION parametersR9(R+R]R?R.R&R6R7R�RRRBRJR�R�R�R�RIR8R�R�(RR	R�R�R�R�R�R�R�R�R�RS((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRV�s$F
 	"	"(RRRR�RBRkR�RV(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR^�stComCloseRequestcBsAeZdZdZeje�Zdd�Zd�Zd�Z	RS(s@
    References:
    ===========
    - [MS-CIFS]: 2.2.4.5.1
    s<HII����cCs||_||_dS(N(R�tlast_modified_time(RR�R�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR
�s	cCstj||�t|_dS(N(RoR*t
SMB_COM_CLOSER+(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR*�scCs.tj|j|j|j�|_d|_dS(NR9(RBRCR�R�R�R7R8(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRA�s!(
RRRR�RBRkR�R
R*RA(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR��s	tComOpenAndxRequestcBsMeZdZdZeje�Zdddddd�Zd�Zd�Z	RS(sA
    References:
    ===========
    - [MS-CIFS]: 2.2.4.41.1
    s
<HHHHIHIIIic		Cs^||_||_||_||_||_||_|pKttj��|_||_	dS(s6
        @param create_time: Epoch time value to indicate the time of creation for this file. If zero, we will automatically assign the current time
        @type create_time: int
        @param timeout: Number of milliseconds to wait for blocked open request before failing
        @type timeout: int
        N(
R�taccess_modet	open_modeR/tsearch_attributestfile_attributesREttimetcreate_timeR�(	RR�R�R�R/R�R�R�R�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR
�s						cCstj||�t|_dS(N(RoR*R_R+(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR*�scCsj|jtj|j|j|j|j|j|j|j	ddd�
|_
d|jjd�d|_
dS(NissUTF-16LEs(RxRBRCR�R/R�R�R�R�R�R7R�RHR8(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRA�s
(
RRRR�RBRkR�R
R*RA(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR��s	R`cBs,eZdZdZeje�Zd�ZRS(s�
    Contains information about a SMB_COM_OPEN_ANDX response from the server

    After decoding, each instance will contain the following attributes:
    - fid (integer)
    - file_attributes (integer)
    - last_write_time (long)
    - access_rights (integer)
    - resource_type (integer)
    - open_results (integer)

    References:
    ===========
    - [MS-CIFS]: 2.2.4.41.2
    - [MS-SMB]: 2.2.4.1.2
    s<BBHHHIIHHHHHHHcCs�|jtkst�|jjs�t|j�|jkrQtd|j	|��nt
j|j|j|j �\}}}|_
|_|_}|_|_}|_}}}ndS(Ns6Not enough data to decode SMB_COM_OPEN_ANDX parameters(R+R_R?R.R&R6R7R�RRRBRJR�R�R�tlast_write_timet
access_rightst
resource_typetopen_results(RR	R�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRVs(RRRR�RBRkR�RV(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR`�stComWriteAndxRequestcBsDeZdZdZeje�Zddd�Zd�Zd�Z	RS(s[
    References:
    ===========
    - [MS-CIFS]: 2.2.4.43.1
    - [MS-SMB]: 2.2.4.3.1
    s
<HIIHHHHHIicCs1||_||_||_||_||_dS(s�
        @param timeout: Number of milliseconds to wait for blocked write request before failing. Must be zero for writing to regular file
        @type timeout: int
        N(R�RSR�R�t
write_mode(RR�R�RSR�R�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR
+s
				cCstj||�t|_dS(N(RoR*RYR+(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR*6sc
Cs�|j|j|jdd}t|j�}|jtj|j|j	|j
d@|j|j|dt|j�||j
d?�
|_
d|j|_dS(NiiI����ii s(RIRyR�R6R�RxRBRCR�R�RSR�R�R7R8(RR	tdata_offsetR�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRA:s
(
RRRR�RBRkR�R
R*RA(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR� s	RZcBs,eZdZdZeje�Zd�ZRS(s[
    References:
    ===========
    - [MS-CIFS]: 2.2.4.43.2
    - [MS-SMB]: 2.2.4.3.2
    s<BBHHHHHcCs�|jtkst�|jjs�t|j�|jkrQtd|j	|��nt
j|j|j|j �\}}}}|_
}}|d@|d>B|_ndS(Ns7Not enough data to decode SMB_COM_WRITE_ANDX parametersi��i(R+RYR?R.R&R6R7R�RRRBRJR�t	availabletcount(RR	R�R�t
high_count((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRV[s7(RRRR�RBRkR�RV(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRZPstComReadAndxRequestcBsDeZdZdZeje�Zddd�Zd�Zd�Z	RS(s[
    References:
    ===========
    - [MS-CIFS]: 2.2.4.42.1
    - [MS-SMB]: 2.2.4.2.1
    s<HIHHIHIicCs:||_||_||_||_||_||_dS(sv
        @param timeout: If reading from a regular file, this parameter must be 0.
        @type timeout: int
        N(R�t	remainingtmax_return_bytes_counttmin_return_bytes_countRSR�(RR�RSR�R�R�R�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR
qs					cCstj||�t|_dS(N(RoR*RWR+(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR*}scCsh|jtj|j|j|jd@|j|j|jpA|jd?|j	|jd?�|_
d|_dS(NI����i R9(RxRBRCR�R�RSR�R�R�R�R7R8(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRA�s
(
RRRR�RBRkR�R
R*RA(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR�fs	RXcBs,eZdZdZeje�Zd�ZRS(s[
    References:
    ===========
    - [MS-CIFS]: 2.2.4.42.2
    - [MS-SMB]: 2.2.4.2.2
    s<BBHHHHHHHHHHHc
Cs�|jtkst�|jjs�t|j�|jkrQtd|j	|��nt
j|j|j|j �\
}}}}}}|_
}}}}}}||j|jd}|j|||j
!|_t|j�|j
ks�t�ndS(Ns6Not enough data to decode SMB_COM_READ_ANDX parametersi(R+RWR?R.R&R6R7R�RRRBRJR�tdata_lengthRIR8(RR	R�R�RS((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRV�s=(RRRR�RBRkR�RV(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRX�stComDeleteRequestcBs,eZdZdd�Zd�Zd�ZRS(s@
    References:
    ===========
    - [MS-CIFS]: 2.2.4.7.1
    icCs||_||_dS(N(tfilename_patternR�(RR�R�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR
�s	cCstj||�t|_dS(N(RoR*tSMB_COM_DELETER+(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR*�scCs9tjd|j�|_d|jjd�d|_dS(Ns<HssUTF-16LEs(RBRCR�R7R�RHR8(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRA�s(RRRR
R*RA(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR��s	tComCreateDirectoryRequestcBs)eZdZd�Zd�Zd�ZRS(s
    Although this command has been marked deprecated in [MS-CIFS], we continue to use it for its simplicity
    as compared to its replacement TRANS2_CREATE_DIRECTORY sub-command [MS-CIFS]: 2.2.6.14

    References:
    ===========
    - [MS-CIFS]: 2.2.4.1.1
    cCs
||_dS(N(R�(RR�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR
�scCstj||�t|_dS(N(RoR*tSMB_COM_CREATE_DIRECTORYR+(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR*�scCs*d|_d|jjd�d|_dS(NR9ssUTF-16LEs(R7R�RHR8(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRA�s	(RRRR
R*RA(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR��s		tComDeleteDirectoryRequestcBs)eZdZd�Zd�Zd�ZRS(s@
    References:
    ===========
    - [MS-CIFS]: 2.2.4.2.1
    cCs
||_dS(N(R�(RR�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR
�scCstj||�t|_dS(N(RoR*tSMB_COM_DELETE_DIRECTORYR+(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR*�scCs*d|_d|jjd�d|_dS(NR9ssUTF-16LEs(R7R�RHR8(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRA�s	(RRRR
R*RA(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR��s		tComRenameRequestcBs,eZdZdd�Zd�Zd�ZRS(s@
    References:
    ===========
    - [MS-CIFS]: 2.2.4.8.1
    icCs||_||_||_dS(N(told_pathtnew_pathR�(RR�R�R�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR
�s		cCstj||�t|_dS(N(RoR*tSMB_COM_RENAMER+(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR*�scCsMtjd|j�|_d|jjd�d|jjd�d|_dS(Ns<HssUTF-16LEss(RBRCR�R7R�RHR�R8(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRA�s(RRRR
R*RA(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR��s	tComEchoRequestcBs/eZdZddd�Zd�Zd�ZRS(sA
    References:
    ===========
    - [MS-CIFS]: 2.2.4.39.1
    R9icCs||_||_dS(N(t
echo_countt	echo_data(RR�R�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR
s	cCs&tj||�t|_d|_dS(Ni��(RoR*ReR+R4(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR*s	cCs(tjd|j�|_|j|_dS(Ns<H(RBRCR�R7R�R8(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRAs(RRRR
R*RA(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR��s	RfcBseZdZd�ZRS(sA
    References:
    ===========
    - [MS-CIFS]: 2.2.4.39.2
    cCs0tjd|jd �d|_|j|_dS(Ns<Hii(RBRJR7tsequence_numberR8(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRVs (RRRRV(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRfstComNTTransactRequestcBsMeZdZdZeje�Zdddddd�Zd�Zd�Z	RS(sA
    References:
    ===========
    - [MS-CIFS]: 2.2.4.62.1
    s
<BHIIIIIIIIBHiR9c

Csm||_|pt|�|_|p-t|	�|_||_||_||_||_||_|	|_	dS(N(
tfunctionR6R�R�R�R�R�R�R�R�(
RRR�R�R�R�R�R�R�R�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR
&s						cCstj||�t|_dS(N(RoR*tSMB_COM_NT_TRANSACTR+(RR	((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR*3sc
Cszt|j�}t|j�}t|j�}d}|j|j|d}|ddkr�dd|d}|d|d7}n|dkr�|}nd}||7}d}|ddkr�dd|d}|d|d7}n|dkr�|}	nd}	tj|j|j	d|j
|j|j|j
||||	t|d�|j�
|j|_||j||j|_dS(NR9iiis(R6R�R�R�RIR�RBRCR�R�R�R�R�R�RERR7R8(
RR	R�R�R�R�RSR�R�R�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRA7sD	
	
	
(
RRRR�RBRkR�R
R*RA(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyR�s	tComNTTransactResponsecBs,eZdZdZeje�Zd�ZRS(sk
    Contains information about a SMB_COM_NT_TRANSACT response from the server

    After decoding, each instance contains the following attributes:
    - total_params_count (integer)
    - total_data_count (integer)
    - setup_bytes (string)
    - data_bytes (string)
    - params_bytes (string)

    References:
    ===========
    - [MS-CIFS]: 2.2.4.62.2
    s
<3sIIIIIIIIBHc

Cs*|jtkst�|jjs&tj|j|j|j	 �\
}|_
|_}}}}}}}	|j|j	|j	|	d!|_|dkr�||j
|j	|	dd8}|j|||!|_n	d|_|dkr||j
|j	|	dd8}|j|||!|_q&d|_ndS(NiiR9(R+RR?R.R&RBRJR�R7R�R�R�R�RIR8R�R�(
RR	R�RRt
params_offsettparams_displt
data_countR�t
data_displR�((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRVws7! 	 (RRRR�RBRkR�RV(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyRes(Rs
NT LM 0.12(Rs	SMB 2.002((((9RtsysRBttypesRlRR�Rt
smb_constantsR$RuR}R�RtiR�tdialecttappendtglobalsR�R6t	ExceptionRRRRR!R(RoRzRjR�R�RhR�RdR�RbR�R\R�R^R�R�R`R�RZR�RXR�R�R�R�R�RfR�R(((sD/opt/plesk/python/2.7/lib/python2.7/site-packages/smb/smb_structs.pyt<module>s^T
"
"
�_#81&7V6R6/!0*H

Zerion Mini Shell 1.0