%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/samba/netcmd/domain/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/samba/netcmd/domain/__pycache__/passwordsettings.cpython-312.pyc

�

�I�d�9���ddlZddlmZddlmZddlmZmZddl	m
Z
mZmZm
Z
ddlmZmZmZddlmZddlmZGd�d	e
�ZGd
�de
�ZGd�d
e
�Zy)�N)�system_session)�DOMAIN_PASSWORD_COMPLEX�DOMAIN_PASSWORD_STORE_CLEARTEXT)�Command�CommandError�Option�SuperCommand)�NEVER_TIMESTAMP�timestamp_to_days�timestamp_to_mins)�cmd_domain_passwordsettings_pso)�SamDBc��eZdZdZdZejejejd�Z	e
dddedd�	�gZdd�Z
y
)
� cmd_domain_passwordsettings_showz1Display current password settings for the domain.z%prog [options]��	sambaopts�versionopts�credopts�-H�--URL�%LDB URL for database or target server�URL�H��help�type�metavar�destNc��|j�}|j|�}t|t�||��}|j	�}|j|tjgd���}	t|	�dk(sJ�	t|	ddd�}
t|	ddd�}t|	ddd�}t|	dd	d�}
t|	dd
d�}t|	ddd�}t|	ddd�}t|	dd
d�}|jd|z�|jd�|
tzdk7r|jd�n|jd�|
t zdk7r|jd�n|jd�|jd|z�|jd|z�|jd|
z�|jd|z�|jd|z�|jd|z�|jd|z�y#t$r}td|��d}~wwxYw)N��url�session_info�credentials�lp)�
pwdProperties�pwdHistoryLength�minPwdLength�	minPwdAge�	maxPwdAge�lockoutDuration�lockoutThreshold�lockOutObservationWindow)�scope�attrs�rr%r&r'r(r)r+r*r,z'Could not retrieve password properties!z$Password information for domain '%s'�zPassword complexity: onzPassword complexity: offzStore plaintext passwords: onzStore plaintext passwords: offzPassword history length: %dzMinimum password length: %dzMinimum password age (days): %dzMaximum password age (days): %dz#Account lockout duration (mins): %dz(Account lockout threshold (attempts): %dz&Reset account lockout after (mins): %d)�get_loadparm�get_credentialsrr�	domain_dn�search�ldb�
SCOPE_BASE�len�intrr�	Exceptionr�messagerr)�selfrrrrr$�creds�samdbr3�res�	pwd_props�pwd_hist_len�cur_min_pwd_len�cur_min_pwd_age�cur_max_pwd_age�cur_account_lockout_threshold�cur_account_lockout_duration�cur_reset_account_lockout_after�es                   �F/usr/lib/python3/dist-packages/samba/netcmd/domain/passwordsettings.py�runz$cmd_domain_passwordsettings_show.run5sZ��
�
#�
#�
%���(�(��,���!�.�*:�"'�B�0���O�O�%�	��l�l�9�C�N�N�">��?���3�x�1�}��}�	M��C��F�?�3�A�6�7�I��s�1�v�&8�9�!�<�=�L�!�#�a�&��"8��";�<�O�/��A��{�0C�A�0F�G�O�/��A��{�0C�A�0F�G�O�,/��A��7I�0J�1�0M�,N�)�,=�S��V�DU�=V�WX�=Y�+Z�(�.?��A��Ga�@b�cd�@e�.f�+�	
���;�i�G�H����R���.�.�!�3��L�L�2�3��L�L�3�4��6�6�!�;��L�L�8�9��L�L�9�:����2�\�A�B����2�_�D�E����6��H�I����6��H�I����:�=Y�Y�Z����?�B_�_�`����=�@_�_�`��'�	M��H�!�L�L��	M�s�>B H.�.	I�7I�I)NNNN��__name__�
__module__�__qualname__�__doc__�synopsis�options�SambaOptions�VersionOptions�CredentialsOptions�takes_optiongroupsr�str�
takes_optionsrI��rHrr%sU��;� �H��)�)��-�-��.�.���	�t�W�#J�QT��3�	(��M�
-arXrc�b�eZdZdZdZejejejd�Z	e
dddedd�	�e
d
ddd
��e
ddgd�d��e
ddgd�d��e
dde��e
dde��e
dde��e
dde��e
dd e��e
d!d"e��e
d#d$e��gZ					d'd&�Z
y%)(�cmd_domain_passwordsettings_setaSet password settings.

    Password complexity, password lockout policy, history length,
    minimum password length, the minimum and maximum password age) on
    a Samba AD DC server.

    Use against a Windows DC is possible, but group policy will override it.
    z%prog <options> [options]rrrrrrrz-qz--quietzBe quiet�
store_true)r�actionz--complexity�choice)�on�off�defaultz=The password complexity (on | off | default). Default is 'on')r�choicesrz--store-plaintextz�Store plaintext passwords where account have 'store passwords with reversible encryption' set (on | off | default). Default is 'off'z--history-lengthzBThe password history length (<integer> | default).  Default is 24.)rrz--min-pwd-lengthzAThe minimum password length (<integer> | default).  Default is 7.z
--min-pwd-agezFThe minimum password age (<integer in days> | default).  Default is 1.z
--max-pwd-agezGThe maximum password age (<integer in days> | default).  Default is 43.z--account-lockout-durationz�The length of time an account is locked out after exceeding the limit on bad password attempts (<integer in mins> | default).  Default is 30 mins.z--account-lockout-thresholdz�The number of bad password attempts allowed before locking out the account (<integer> | default).  Default is 0 (never lock out).z--reset-account-lockout-afterzuAfter this time is elapsed, the recorded number of attempts restarts from zero (<integer> | default).  Default is 30.Nc�
�|
j�}|j|�}t|t�||��}|j	�}g}tj�}tj||�|_t|j��}|j�}|j�}|�E|dk(s|dk(r|tz}|jd�n |dk(r|tz}|jd�|�E|dk(s|dk(r|tz}|jd�n |dk(r|tz}|jd�|�|�1tj t#|�t
j$d	�|d	<|�j|dk(rd
}nt|�}|dks|d
kDrt'd��tj t#|�t
j$d
�|d
<|jd�|�j|dk(rd}nt|�}|dks|dkDrt'd��tj t#|�t
j$d�|d<|jd�|�y|dk(rd}nt|�}|dks|dkDrt'd��t|dz�}tj t#|�t
j$d�|d<|jd�|��|dk(rd}nt|�}|dks|dkDrt'd��|dk(rt(}nt|dz�}tj t#|�t
j$d�|d<|jd�|	��|	dk(rd}	nt|	�}	|	dks|	d kDrt'd!��|	dk(rt(}nt|	d"z�}tj t#|�t
j$d#�|d#<|jd$�|
�U|
dk(rd}
nt|
�}
tj t#|
�t
j$d%�|d%<|jd&�|��|dk(rd}nt|�}|dks|d kDrt'd'��|dk(rt(}nt|d"z�}tj t#|�t
j$d(�|d(<|jd)�|s|r0t+|�}t+|�}|dk7r||k\rt'd*||fz��t-|�dk(rt'd+��|j/|�|jd,�|j1d-j3|��y).Nr r^r`zPassword complexity activated!r_z Password complexity deactivated!z;Plaintext password storage for changed passwords activated!z=Plaintext password storage for changed passwords deactivated!r%�rz8Password history length must be in the range of 0 to 24!r&z Password history length changed!��z8Minimum password length must be in the range of 0 to 14!r'z Minimum password length changed!r/i�z6Minimum password age must be in the range of 0 to 998!g8M%iBr(zMinimum password age changed!�+i�z6Maximum password age must be in the range of 0 to 999!r)zMaximum password age changed!�i��z<Account lockout duration must be in the range of 0 to 99999!g��Ar*z!Account lockout duration changed!r+z"Account lockout threshold changed!z8Maximum password age must be in the range of 0 to 99999!r,z0Duration to reset account lockout after changed!zIMaximum password age (%d) must be greater than minimum password age (%d)!z7You must specify at least one option to set. Try --helpz!All changes applied successfully!�
)r1r2rrr3r5�Message�Dn�dnr8�get_pwdProperties�
get_maxPwdAge�
get_minPwdAger�appendr�MessageElementrU�FLAG_MOD_REPLACErr
rr7�modifyr:�join)r;r�min_pwd_age�max_pwd_age�quiet�
complexity�store_plaintext�history_length�min_pwd_length�account_lockout_duration�account_lockout_threshold�reset_account_lockout_afterrrrr$r<r=r3�msgs�mr?�max_pwd_age_ticks�min_pwd_age_ticksr@�min_pwd_len�account_lockout_duration_ticks�!reset_account_lockout_after_tickss                            rHrIz#cmd_domain_passwordsettings_set.run�s���
�
#�
#�
%���(�(��,���!�.�*:�"'�B�0���O�O�%�	����K�K�M���v�v�e�Y�'�����/�/�1�2�	�"�/�/�1��!�/�/�1���!��T�!�Z�9�%<�%�(?�?�	����<�=��u�$�%�*A�)A�B�	����>�?��&��$�&�/�Y�*F�%�(G�G�	����Y�Z� �E�)�%�*I�)I�J�	����[�\��!�_�%@�!$�!3�!3�C�	�N�47�4H�4H�/�"[�A�o���%���*�!��"�>�2���a��<�"�#4�"�#]�^�^�$'�$6�$6�s�<�7H�7:�7K�7K�M_�%a�A� �!��K�K�:�;��%���*���!�.�1���Q��+��"2�"�#]�^�^� #� 2� 2�3�{�3C�36�3G�3G��!Y�A�n���K�K�:�;��"��i�'���!�+�.���Q��+��"3�"�#[�\�\�"%�[�4F�%G�!H� H�� �/�/��4E�0F�03�0D�0D�k�S�A�k�N��K�K�7�8��"��i�'� ��!�+�.���Q��+��"3�"�#[�\�\��a��$3�!�%(��8J�)K�%L�$L�!� �/�/��4E�0F�03�0D�0D�k�S�A�k�N��K�K�7�8�#�/�'�9�4�+-�(�+.�/G�+H�(�'�!�+�/G�%�/O�"�$I�J�J�(�1�,�1@�.�25�6N�RZ�6[�2\�1\�.�#&�#5�#5�c�:X�6Y�69�6J�6J�L]�$_�A�� ��K�K�;�<�$�0�(�I�5�,-�)�,/�0I�,J�)�$'�$6�$6�s�;T�7U�7:�7K�7K�M_�%a�A� �!��K�K�<�=�&�2�*�i�7�.0�+�.1�2M�.N�+�*�Q�.�2M�PU�2U�"�#]�^�^�+�a�/�4C�1�58�9T�X`�9a�5b�4b�1�,/�,>�,>�s�Cd�?e�?B�?S�?S�Uo�-q�A�(�)��K�K�J�K��+�,�,=�>�K�+�,=�>�K��a��K�;�$>�"�#n�r}�@K�rL�$L�M�M��q�6�Q�;��X�Y�Y�
���Q�����7�8����T�Y�Y�t�_�%rX)NNNFNNNNNNNNNNrJrWrXrHrZrZes3���+�H��)�)��-�-��.�.���	�t�W�#J�QT��3�	(��t�Y�Z��E��~�H�6N�S�	U��"��;S�[�	\��!�X�_b�	d��!�W�^a�	c���\�cf�	h���]�dg�	i��+�i�ps�	t��,�X�_b�	c��.�L�SV�	W�)�M�09=�OS�Z^�GK��	d&rXrZc�P�eZdZdZiZe�ed<e�ed<e�ed<y)�cmd_domain_passwordsettingsz Manage password policy settings.�pso�show�setN)rKrLrMrN�subcommandsr
rrZrWrXrHr�r�6s1��*��K�8�:�K���:�<�K���8�:�K��rXr�)r5�samba.getopt�getoptrP�
samba.authr�samba.dcerpc.samrrr�samba.netcmdrrrr	�samba.netcmd.commonr
rr�samba.netcmd.psor
�samba.samdbrrrZr�rWrXrH�<module>r�sV��2��%�@�D�D�4�4�<��=a�w�=a�@N&�g�N&�b;�,�;rX

Zerion Mini Shell 1.0