HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/samba/tests/__pycache__/auth_log_netlogon.cpython-310.pyc
o

�/a��@s�dZddlZddlZddlmZddlZddlmZddl	m
Z
ddlmZddl
mZddlmZdd	lmZmZdd
lmZddlmZmZGdd
�d
ejjj�ZdS)a0
    Tests that exercise the auth logging for a successful netlogon attempt

    NOTE: As the netlogon authentication is performed once per session,
          there is only one test in this routine.  If another test is added
          only the test executed first will generate the netlogon auth message
�N)�SamDB)�Credentials)�netlogon)�AS_SYSTEM_MAGIC_PATH_TOKEN)�system_session)�delete_force)�UF_WORKSTATION_TRUST_ACCOUNT�UF_PASSWD_NOTREQD)�SEC_CHAN_WKSTA)�EVT_ID_SUCCESSFUL_LOGON�EVT_LOGON_NETWORKcs@eZdZ�fdd�Z�fdd�Zdd�Zdd�Zd	d
�Z�ZS)�AuthLogTestsNetLogoncs�tt|���tj��|_t�|_t	|j|jd�|_
tjd|_
d|_d|_t|_|j
��|_d|j|jf|_d|jd�d�}|j
�|jdd	|jtttB�|d
��dS)N)�session_info�lp�DOMAIN�NetLogonGood�
abcdefghijzcn=%s,cn=users,%s�"z	utf-16-le�computerz%s$)�dn�objectclass�sAMAccountName�userAccountControl�
unicodePwd)�superr
�setUp�samba�tests�env_loadparmrr�sessionr�ldb�os�environ�domain�netbios_name�machinepassr�
remoteAddress�	domain_dn�base_dnr�encode�add�strrr	)�self�utf16pw��	__class__��?/usr/lib/python3/dist-packages/samba/tests/auth_log_netlogon.pyr.s*�
�zAuthLogTestsNetLogon.setUpcs tt|���t|j|j�dS)N)rr
�tearDownrr r�r,r.r0r1r2FszAuthLogTestsNetLogon.tearDowncCs�dd�}|rd|}nd}t�}|�|���|�t�|�|j�|�|jd�t	�	d||��|�}|�
||�}||�dS)NcSs<|ddko|dddko|dddko|dddkS)	N�type�
Authorization�serviceDescription�DCE/RPC�authType�schannel�transportProtection�SEALr0)�msgr0r0r1�isLastExpectedMessageLs���zBAuthLogTestsNetLogon._test_netlogon.<locals>.isLastExpectedMessagez
[schannel,%s]z
[schannel]�$z
ncalrpc:%s)r�guess�get_loadparm�set_secure_channel_typer
�set_passwordr%�set_usernamer$r�waitForMessages)r,�binding�
checkFunctionr=�
machine_creds�
netlogon_conn�messagesr0r0r1�_test_netlogonJs


�z#AuthLogTestsNetLogon._test_netlogoncCsd}|�|t|�d�|d}|�d|d�|�d|dd�|�d|dd	�|�d
|dd�|�|�|dd��|d
}|�d|d�|�d|dd�|�d|dd�|�d|dd�|�d|dd�|�t|dd�|�t|dd�dS)N�z/Did not receive the expected number of messagesrr5r4r7r6�ncalrpcr8�NONEr:�	sessionId��Authentication�NETLOGON�ServerAuthenticate�authDescription�NT_STATUS_OK�statuszHMAC-SHA256�passwordType�eventId�	logonType)�assertEqual�len�
assertTrue�is_guidrr)r,rI�expected_messagesr<r0r0r1�netlogon_checkesB�
�
�
�
�
�
�
�z#AuthLogTestsNetLogon.netlogon_checkcCs|�d|j�dS)Nr;)rJr^r3r0r0r1�
test_netlogon�sz"AuthLogTestsNetLogon.test_netlogon)	�__name__�
__module__�__qualname__rr2rJr^r_�
__classcell__r0r0r.r1r
,s r
)�__doc__�samba.testsrr!�samba.samdbr�samba.tests.auth_log_base�samba.credentialsr�samba.dcerpcr�samba.dcerpc.dcerpcr�
samba.authrr�
samba.dsdbrr	�samba.dcerpc.miscr
�samba.dcerpc.windows_event_idsrrr�
auth_log_base�AuthLogTestBaser
r0r0r0r1�<module>s