
    %
i3                         d Z ddlZddlZddlmZ ddlZddlZddlZd Zedk    r ej	         e                       dS dS )a9  A demo of using win32net.NetValidatePasswordPolicy.

Example usage:

% NetValidatePasswordPolicy.py --password=foo change
which might return:

> Result of 'change' validation is 0: The operation completed successfully.

or depending on the policy:

> Result of 'change' validation is 2245: The password does not meet the
> password policy requirements. Check the minimum password length,
> password complexity and password history requirements.

Adding --user doesn't seem to change the output (even the PasswordLastSet seen
when '-f' is used doesn't depend on the username), but theoretically it will
also check the password history for the specified user.

% NetValidatePasswordPolicy.py auth

which always (with and without '-m') seems to return:

> Result of 'auth' validation is 2701: Password must change at next logon
    N)pprintc            	         t          j        dd          } |                     dddd           |                     d	d
dd           |                     ddddd           |                     dddd           |                     ddddd           |                                 \  }}|sdg}|D ]%}|dk    rd|j        i}t
          j        }n=|dk    r"|j        |j        |j        d}t
          j	        }n| 
                    d           	 t          j        |j        d ||          \  }}nJ# t          $ r t          d           Y  d S t          j
        $ r}t          d!|           Y d }~ d S d }~ww xY w|j        rt          d"           t#          |           t          d#||t%          j        |                                          fz             'd$S )%Nz%prog [options] auth|change ...z*A win32net.NetValidatePasswordPolicy demo.)descriptionz-uz
--usernamestorezDThe username to pass to the function (only for the 'change' command))actionhelpz-pz
--passwordzOThe clear-text password to pass to the function (only for the 'change' command)z-mz--password-matchedstore_falseTzUsed to specify the password does NOT match (ie, uses False for the PasswordMatch/PasswordMatched arg, both 'auth' and 'change' commands))r   defaultr   z-sz--serverz0The name of the server to execute the command onz-fz--show_fields
store_trueFz0Print the NET_VALIDATE_PERSISTED_FIELDS returnedauthPasswordMatchedchange)ClearPasswordPasswordMatchUserAccountNamez(Invalid arg - must be 'auth' or 'change'z;NetValidatePasswordPolicy not implemented on this platform.   z"NetValidatePasswordPolicy failed: z%NET_VALIDATE_PERSISTED_FIELDS fields:z!Result of %r validation is %d: %sr   )optparseOptionParser
add_option
parse_argspassword_matchedwin32netconNetValidateAuthenticationpasswordusernameNetValidatePasswordChangeerrorwin32netNetValidatePasswordPolicyserverNotImplementedErrorprintshow_fieldsr   win32apiFormatMessagestrip)	parseroptionsargsarginputval_typefieldsstatusexcs	            C:\Users\Dell Inspiron 16\Desktop\tws\AgrotaPowerBi\back-agrota-powerbi\mcp-client-agrota\venv\Lib\site-packages\win32/Demos/NetValidatePasswordPolicy.pymainr1   $   s   ")@  F
 S	     *	     2     ?	     ?     %%''MGT x "
 "
&==!7#;E #<HHH__!(!1!(!9#*#3 E
 #<HHLLCDDD		%?h NFFF # 	 	 	OPPP111~ 	 	 	6<<<111111	  	9:::6NNN/FH26::@@BBCD	
 	
 	
 	

 1s   D11E8E8E33E8__main__)
__doc__r   sysr   r$   r   r   r1   __name__exit     r0   <module>r9      s    4  



            W W Wt zCHTTVV r8   