404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.15.31.50: ~ $
3

گa�'�@s�dZddlZddlZddlmZddlmZddlmZddlm	Z	yddl
Z
Wn ek
rpddlZdZ
YnXdZ
eje�ZGd	d
�d
�ZGdd�d�ZGd
d�de�ZGdd�de�Zeed�dd�ZdS)zZImplements file locks compatible with Linux and Windows for locking files and directories.�N)�Optional)�errors)�
filesystem)�osFTc@sXeZdZdZedd�dd�Zed�dd�Zdd�d	d
�Zdd�dd�Ze	d�d
d�Z
dS)�LockFilea�
    Platform independent file lock system.
    LockFile accepts a parameter, the path to a file acting as a lock. Once the LockFile,
    instance is created, the associated file is 'locked from the point of view of the OS,
    meaning that if another instance of Certbot try at the same time to acquire the same lock,
    it will raise an Exception. Calling release method will release the lock, and make it
    available to every other instance.
    Upon exit, Certbot will also release all the locks.
    This allows us to protect a file or directory from being concurrently accessed
    or modified by two Certbot instances.
    LockFile is platform independent: it will proceed to the appropriate OS lock mechanism
    depending on Linux or Windows.
    N)�path�returncCs(||_trtnt}||�|_|j�dS)z�
        Create a LockFile instance on the given file path, and acquire lock.
        :param str path: the path to the file that will hold a lock
        N)�_path�
POSIX_MODE�_UnixLockMechanism�_WindowsLockMechanism�_lock_mechanism�acquire)�selfrZ	mechanism�r�/usr/lib/python3.6/lock.py�__init__$s
zLockFile.__init__)rcCs0dj|jj|j�}|j�r$|d7}n|d7}|S)Nz
{0}({1}) <z	acquired>z	released>)�format�	__class__�__name__r	�	is_locked)r�repr_strrrr�__repr__/s

zLockFile.__repr__cCs|jj�dS)z�
        Acquire the lock on the file, forbidding any other Certbot instance to acquire it.
        :raises errors.LockError: if unable to acquire the lock
        N)r
r)rrrrr7szLockFile.acquirecCs|jj�dS)zb
        Release the lock on the file, allowing any other Certbot instance to acquire it.
        N)r
�release)rrrrr>szLockFile.releasecCs
|jj�S)zu
        Check if the file is currently locked.
        :return: True if the file is locked, False otherwise
        )r
r)rrrrrDszLockFile.is_locked)r�
__module__�__qualname__�__doc__�strrrrr�boolrrrrrrs
rc@sFeZdZedd�dd�Zed�dd�Zdd�dd	�Zdd�d
d�ZdS)�_BaseLockMechanismN)rrcCs||_d|_dS)zk
        Create a lock file mechanism for Unix.
        :param str path: the path to the lock file
        N)r	�_fd)rrrrrrMsz_BaseLockMechanism.__init__)rcCs
|jdk	S)zvCheck if lock file is currently locked.
        :return: True if the lock file is locked
        :rtype: bool
        N)r )rrrrrUsz_BaseLockMechanism.is_lockedcCsdS)Nr)rrrrr\sz_BaseLockMechanism.acquirecCsdS)Nr)rrrrr_sz_BaseLockMechanism.release)	rrrrrrrrrrrrrrLsrc@sLeZdZdZdd�dd�Zedd�dd�Zeed�d	d
�Zdd�dd�Z	dS)
rz�
    A UNIX lock file mechanism.
    This lock file is released when the locked file is closed or the
    process exits. It cannot be used to provide synchronization between
    threads. It is based on the lock_file package by Martin Horcicka.
    N)rcCsbx\|jdkr\tj|jtjtjBd�}z|j|�|j|�r@||_Wd|jdkrXtj	|�XqWdS)zAcquire the lock.Ni�)
r r�openr	r�O_CREAT�O_WRONLY�	_try_lock�
_lock_success�close)r�fdrrrrjs



z_UnixLockMechanism.acquire)r'rcCslytj|tjtjB�WnNtk
rf}z2|jtjtjfkrTtj	d|j
�tjd���WYdd}~XnXdS)z�
        Try to acquire the lock file without blocking.
        :param int fd: file descriptor of the opened file to lock
        z(A lock on %s is held by another process.z/Another instance of Certbot is already running.N)
�fcntl�lockfZLOCK_EXZLOCK_NB�IOError�errno�EACCESZEAGAIN�logger�debugr	r�	LockError)rr'�errrrrr$xs
z_UnixLockMechanism._try_lockcCs|ddlm}ddlm}y||j�}Wn4tk
rZ}z|jtjkrHdS�WYdd}~XnX||�}|j|jkoz|j|jkS)a�
        Did we successfully grab the lock?
        Because this class deletes the locked file when the lock is
        released, it is possible another process removed and recreated
        the file between us opening the file and acquiring the lock.
        :param int fd: file descriptor of the opened file to lock
        :returns: True if the lock was successfully acquired
        :rtype: bool
        r)�fstat)�statFN)	rr1r2r	�OSErrorr+�ENOENT�st_dev�st_ino)rr'r1r2Zstat1r0Zstat2rrrr%�s
z _UnixLockMechanism._lock_successcCsDztj|j�Wd|jdkr$td��ztj|j�Wdd|_XXdS)z)Remove, close, and release the lock file.NzError, self._fd is None.)r�remover	r �	TypeErrorr&)rrrrr�s
z_UnixLockMechanism.release)
rrrrr�intr$rr%rrrrrrcs

rc@s,eZdZdZdd�dd�Zdd�dd�ZdS)ra"
    A Windows lock file mechanism.
    By default on Windows, acquiring a file handler gives exclusive access to the process
    and results in an effective lock. However, it is possible to explicitly acquire the
    file handler in shared access in terms of read and write, and this is done by os.open
    and io.open in Python. So an explicit lock needs to be done through the call of
    msvcrt.locking, that will lock the first byte of the file. In theory, it is also
    possible to access a file in shared delete access, allowing other processes to delete an
    opened file. But this needs also to be done explicitly by all processes using the Windows
    low level APIs, and Python does not do it. As of Python 3.7 and below, Python developers
    state that deleting a file opened by a process from another process is not possible with
    os.open and io.open.
    Consequently, mscvrt.locking is sufficient to obtain an effective lock, and the race
    condition encountered on Linux is not possible on Windows, leading to a simpler workflow.
    N)rcCs�tjtjBtjB}d}y$tj|j|d�}tj|tj	d�WnZt
tfk
r�}z:|r^tj|�|j
t
jkrl�tjd|j�tjd��WYdd}~XnX||_dS)zAcquire the lockNi��z(A lock on %s is held by another process.z/Another instance of Certbot is already running.)r�O_RDWRr"�O_TRUNCrr!r	�msvcrt�lockingZLK_NBLCKr*r3r&r+r,r-r.rr/r )rZ	open_moder'r0rrrr�s
z_WindowsLockMechanism.acquirecCs�zt|jstjd��tj|jtjd�tj|j�ytj|j	�Wn0t
k
rp}ztjt
|��WYdd}~XnXWdd|_XdS)zRelease the lock.z%The lock has not been acquired first.r:N)r r�Errorr=r>ZLK_UNLCKrr&r7r	r3r-r.r)r�errrr�s
$z_WindowsLockMechanism.release)rrrrrrrrrrr�sr)�dir_pathrcCsttjj|d��S)a3Place a lock file on the directory at dir_path.

    The lock file is placed in the root of dir_path with the name
    .certbot.lock.

    :param str dir_path: path to directory

    :returns: the locked LockFile object
    :rtype: LockFile

    :raises errors.LockError: if unable to acquire the lock

    z
.certbot.lock)rrr�join)rArrr�lock_dir�srC)rr+ZloggingZtypingrZcertbotrZcertbot.compatrrr(�ImportErrorr=r
Z	getLoggerrr-rrrrrrCrrrr�<module>s$

6U=

Filemanager

Name Type Size Permission Actions
__init__.cpython-36.opt-1.pyc File 302 B 0644
__init__.cpython-36.pyc File 302 B 0644
account.cpython-36.opt-1.pyc File 13.29 KB 0644
account.cpython-36.pyc File 13.29 KB 0644
auth_handler.cpython-36.opt-1.pyc File 16.2 KB 0644
auth_handler.cpython-36.pyc File 16.29 KB 0644
cert_manager.cpython-36.opt-1.pyc File 14.98 KB 0644
cert_manager.cpython-36.pyc File 14.98 KB 0644
client.cpython-36.opt-1.pyc File 25.25 KB 0644
client.cpython-36.pyc File 25.25 KB 0644
constants.cpython-36.opt-1.pyc File 3.98 KB 0644
constants.cpython-36.pyc File 3.98 KB 0644
eff.cpython-36.opt-1.pyc File 4.45 KB 0644
eff.cpython-36.pyc File 4.45 KB 0644
error_handler.cpython-36.opt-1.pyc File 5.8 KB 0644
error_handler.cpython-36.pyc File 5.8 KB 0644
hooks.cpython-36.opt-1.pyc File 8.34 KB 0644
hooks.cpython-36.pyc File 8.34 KB 0644
lock.cpython-36.opt-1.pyc File 8.77 KB 0644
lock.cpython-36.pyc File 8.77 KB 0644
log.cpython-36.opt-1.pyc File 12.77 KB 0644
log.cpython-36.pyc File 12.85 KB 0644
main.cpython-36.opt-1.pyc File 43.5 KB 0644
main.cpython-36.pyc File 43.69 KB 0644
renewal.cpython-36.opt-1.pyc File 15.53 KB 0644
renewal.cpython-36.pyc File 15.53 KB 0644
reporter.cpython-36.opt-1.pyc File 2.85 KB 0644
reporter.cpython-36.pyc File 2.91 KB 0644
snap_config.cpython-36.opt-1.pyc File 4.04 KB 0644
snap_config.cpython-36.pyc File 4.04 KB 0644
storage.cpython-36.opt-1.pyc File 38.5 KB 0644
storage.cpython-36.pyc File 38.5 KB 0644
updater.cpython-36.opt-1.pyc File 4.18 KB 0644
updater.cpython-36.pyc File 4.18 KB 0644