PHP WebShell

Текущая директория: /usr/lib/python3/dist-packages/cloudinit/sources/helpers/vmware/imc/__pycache__

Просмотр файла: config_passwd.cpython-310.pyc

o

x[hv	�@s<ddlZddlZddlmZmZe�e�ZGdd�d�ZdS)�N)�
atomic_helper�subpc@s eZdZdZdd�Zdd�ZdS)�PasswordConfiguratorzv
    Class for changing configurations related to passwords in a VM. Includes
    setting and expiring passwords.
    cCs�t�d�|rt�|�}g}tdd�D]}|�d�ddkr(|�|�d�d�qg}tdd�D]}|�d�d}||vrB|�|�q0|rPt�d	�|�d
|�|rW|�|�t�d�dS)
a+
        Main method to perform all functionalities based on configuration file
        inputs.
        @param passwd: encoded admin password.
        @param resetPasswd: boolean to determine if password needs to be reset.
        @return cfg: dict to be used by cloud-init set_passwd code.
        zStarting password configurationz/etc/passwd�r�:��0rz/etc/shadowzSetting admin password�rootzConfigure Password completed!N)	�LOG�infor�b64d�open�split�append�
set_passwd�reset_password)�self�passwd�resetPasswd�distro�allRootUsers�line�uidUsersList�user�r�T/usr/lib/python3/dist-packages/cloudinit/sources/helpers/vmware/imc/config_passwd.py�	configures(

�
�

zPasswordConfigurator.configurecCs�t�d�|D]6}z
t�dd|g�Wqtjy=}ztj�d�r,t�ddd|g�nt�d||�WYd	}~qd	}~wwd	S)
z�
        Method to reset password. Use passwd --expire command. Use chage if
        not succeeded using passwd command. Log failure message otherwise.
        @param: list of users for which to expire password.
        zExpiring password.rz--expirez/usr/bin/chage�chagez-drz/Failed to expire password for %s with error: %sN)r
rr�ProcessExecutionError�os�path�exists�warning)r�uidUserListr�errrr3s
����z#PasswordConfigurator.reset_passwordN)�__name__�
__module__�__qualname__�__doc__rrrrrrrsr)	�loggingr�	cloudinitrr�	getLoggerr%r
rrrrr�<module>s



Выполнить команду


Для локальной разработки. Не используйте в интернете!