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/modules/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/ansible/modules/__pycache__/unarchive.cpython-312.pyc
�

1<�e����n�ddlmZmZmZeZdZdZdZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlmZddlmZddlmZmZmZdd	lmZdd
lm Z ddl!m"Z"ddl#m$Z$	dd
l%m&Z&	ddlm)Z)ejVd�Z,ejVd�Z-ejVd�Z.ejVd�Z/ejVd�Z0ejVd�Z1ejVd�Z2ejVd�Z3ejVd�Z4d�Z5d�Z6Gd�de7�Z8Gd�de9�Z:Gd�d e9�Z;Gd!�d"e;�Z<Gd#�d$e;�Z=Gd%�d&e;�Z>Gd'�d(e;�Z?Gd)�d*e:�Z@d+�ZAd,�ZBeCd-k(reB�yy#e'$r
dd
l(m&Z&Y��)wxYw#e'$r
ddlm*Z)Y��4wxYw).�)�absolute_import�division�print_functiona�
---
module: unarchive
version_added: '1.4'
short_description: Unpacks an archive after (optionally) copying it from the local machine
description:
     - The M(ansible.builtin.unarchive) module unpacks an archive. It will not unpack a compressed file that does not contain an archive.
     - By default, it will copy the source file from the local system to the target before unpacking.
     - Set O(remote_src=yes) to unpack an archive which already exists on the target.
     - If checksum validation is desired, use M(ansible.builtin.get_url) or M(ansible.builtin.uri) instead to fetch the file and set O(remote_src=yes).
     - For Windows targets, use the M(community.windows.win_unzip) module instead.
options:
  src:
    description:
      - If O(remote_src=no) (default), local path to archive file to copy to the target server; can be absolute or relative. If O(remote_src=yes), path on the
        target server to existing archive file to unpack.
      - If O(remote_src=yes) and O(src) contains V(://), the remote machine will download the file from the URL first. (version_added 2.0). This is only for
        simple cases, for full download support use the M(ansible.builtin.get_url) module.
    type: path
    required: true
  dest:
    description:
      - Remote absolute path where the archive should be unpacked.
      - The given path must exist. Base directory is not created by this module.
    type: path
    required: true
  copy:
    description:
      - If true, the file is copied from local controller to the managed (remote) node, otherwise, the plugin will look for src archive on the managed machine.
      - This option has been deprecated in favor of O(remote_src).
      - This option is mutually exclusive with O(remote_src).
    type: bool
    default: yes
  creates:
    description:
      - If the specified absolute path (file or directory) already exists, this step will B(not) be run.
      - The specified absolute path (file or directory) must be below the base path given with O(dest).
    type: path
    version_added: "1.6"
  io_buffer_size:
    description:
      - Size of the volatile memory buffer that is used for extracting files from the archive in bytes.
    type: int
    default: 65536
    version_added: "2.12"
  list_files:
    description:
      - If set to True, return the list of files that are contained in the tarball.
    type: bool
    default: no
    version_added: "2.0"
  exclude:
    description:
      - List the directory and file entries that you would like to exclude from the unarchive action.
      - Mutually exclusive with O(include).
    type: list
    default: []
    elements: str
    version_added: "2.1"
  include:
    description:
      - List of directory and file entries that you would like to extract from the archive. If O(include)
        is not empty, only files listed here will be extracted.
      - Mutually exclusive with O(exclude).
    type: list
    default: []
    elements: str
    version_added: "2.11"
  keep_newer:
    description:
      - Do not replace existing files that are newer than files from the archive.
    type: bool
    default: no
    version_added: "2.1"
  extra_opts:
    description:
      - Specify additional options by passing in an array.
      - Each space-separated command-line option should be a new element of the array. See examples.
      - Command-line options with multiple elements must use multiple lines in the array, one for each element.
    type: list
    elements: str
    default: []
    version_added: "2.1"
  remote_src:
    description:
      - Set to V(true) to indicate the archived file is already on the remote system and not local to the Ansible controller.
      - This option is mutually exclusive with O(copy).
    type: bool
    default: no
    version_added: "2.2"
  validate_certs:
    description:
      - This only applies if using a https URL as the source of the file.
      - This should only set to V(false) used on personally controlled sites using self-signed certificate.
      - Prior to 2.2 the code worked as if this was set to V(true).
    type: bool
    default: yes
    version_added: "2.2"
extends_documentation_fragment:
- action_common_attributes
- action_common_attributes.flow
- action_common_attributes.files
- decrypt
- files
attributes:
    action:
      support: full
    async:
      support: none
    bypass_host_loop:
      support: none
    check_mode:
      support: partial
      details: Not supported for gzipped tar files.
    diff_mode:
      support: partial
      details: Uses gtar's C(--diff) arg to calculate if changed or not. If this C(arg) is not supported, it will always unpack the archive.
    platform:
      platforms: posix
    safe_file_operations:
      support: none
    vault:
      support: full
todo:
    - Re-implement tar support using native tarfile module.
    - Re-implement zip support using native zipfile module.
notes:
    - Requires C(zipinfo) and C(gtar)/C(unzip) command on target host.
    - Requires C(zstd) command on target host to expand I(.tar.zst) files.
    - Can handle I(.zip) files using C(unzip) as well as I(.tar), I(.tar.gz), I(.tar.bz2), I(.tar.xz), and I(.tar.zst) files using C(gtar).
    - Does not handle I(.gz) files, I(.bz2) files, I(.xz), or I(.zst) files that do not contain a I(.tar) archive.
    - Existing files/directories in the destination which are not in the archive
      are not touched. This is the same behavior as a normal archive extraction.
    - Existing files/directories in the destination which are not in the archive
      are ignored for purposes of deciding if the archive should be unpacked or not.
seealso:
- module: community.general.archive
- module: community.general.iso_extract
- module: community.windows.win_unzip
author: Michael DeHaan
au
- name: Extract foo.tgz into /var/lib/foo
  ansible.builtin.unarchive:
    src: foo.tgz
    dest: /var/lib/foo

- name: Unarchive a file that is already on the remote machine
  ansible.builtin.unarchive:
    src: /tmp/foo.zip
    dest: /usr/local/bin
    remote_src: yes

- name: Unarchive a file that needs to be downloaded (added in 2.0)
  ansible.builtin.unarchive:
    src: https://example.com/example.zip
    dest: /usr/local/bin
    remote_src: yes

- name: Unarchive a file with extra options
  ansible.builtin.unarchive:
    src: /tmp/foo.zip
    dest: /usr/local/bin
    extra_opts:
    - --transform
    - s/^xxx/yyy/
ab
dest:
  description: Path to the destination directory.
  returned: always
  type: str
  sample: /opt/software
files:
  description: List of all the files in the archive.
  returned: When O(list_files) is V(True)
  type: list
  sample: '["file1", "file2"]'
gid:
  description: Numerical ID of the group that owns the destination directory.
  returned: always
  type: int
  sample: 1000
group:
  description: Name of the group that owns the destination directory.
  returned: always
  type: str
  sample: "librarians"
handler:
  description: Archive software handler used to extract and decompress the archive.
  returned: always
  type: str
  sample: "TgzArchive"
mode:
  description: String that represents the octal permissions of the destination directory.
  returned: always
  type: str
  sample: "0755"
owner:
  description: Name of the user that owns the destination directory.
  returned: always
  type: str
  sample: "paul"
size:
  description: The size of destination directory in bytes. Does not include the size of files or subdirectories contained within.
  returned: always
  type: int
  sample: 36
src:
  description:
    - The source archive's path.
    - If O(src) was a remote web URL, or from the local ansible controller, this shows the temporary location where the download was stored.
  returned: always
  type: str
  sample: "/home/paul/test.tar.gz"
state:
  description: State of the destination. Effectively always "directory".
  returned: always
  type: str
  sample: "directory"
uid:
  description: Numerical ID of the user that owns the destination directory.
  returned: always
  type: int
  sample: 1000
N)�partial)�ZipFile)�to_bytes�	to_native�to_text)�
AnsibleModule)�get_bin_path)�get_best_parsable_locale)�
fetch_file)�quote)�
BadZipFile)�
BadZipfilez: Uid differs$z: Gid differs$z: Mode differs$z: Mod time differs$z4: : Warning: Cannot stat: No such file or directory$z2: Warning: Cannot stat: No such file or directory$z([r-][w-][SsTtx-]){3}z: Invalid ownerz: Invalid groupc��tjd�}t|d�5}tt	|j
|�d�D]}tj||�}�	ddd�|dzS#1swY|dzSxYw)z# Return a CRC32 checksum of a file ��rbNl��)�binascii�crc32�open�iterr�read)�path�buffer_size�crc�f�b_blocks     �;/usr/lib/python3/dist-packages/ansible/modules/unarchive.pyrr sy���.�.��
�C�	
�d�D�	�/�Q��G�A�F�F�K�8�#�>�	/�G��.�.��#�.�C�	/�/�����/�����s�<A,�,A9c�0�tjdd|�S)z6 Quote meta-characters in the args for the unix shell z([^A-Za-z0-9_])z\\\1)�re�sub)�strings r�shell_escaper$*s��
�6�6�$�g�v�6�6rc��eZdZy)�UnarchiveErrorN)�__name__�
__module__�__qualname__�rrr&r&/s��rr&c�F�eZdZd�Zd�Zd�Zd�Zed��Zd�Z	d�Z
d�Zy	)
�
ZipArchivec�b�||_||_||_|jd|_||_|jd|_|jd|_g|_|j
jd|_	d|_
d|_g|_t�|_d|_d|_y)N�
extra_opts�io_buffer_size�exclude�include�)��unzip�cmd_path)�zipinfo�zipinfo_cmd_path)�src�b_dest�	file_args�params�opts�moduler/�excludes�includes�
include_filesr5r7�_files_in_archive�dict�	_infodict�zipinfoflag�binaries)�selfr8r9r:r=s     r�__init__zZipArchive.__init__5s���������"����M�M�,�/��	����$�m�m�,<�=����
�
�i�0��
���
�!�[�[�/�/�	�:�����
� $���!#����������
��
rc��|ddd�}d}tdd�D]/}tdd�D]}||d|zzdvs�|d|d|zzzz
}� �1||zS)zA Convert a Unix permission string (rw-r--r--) into a mode (0644) N���r�)�r�w�x�s�t�)�range)rF�modestr�umask�revstr�mode�j�is       r�_permstr_to_octalzZipArchive._permstr_to_octalIsy����2�������q�!��	-�A��1�a�[�
-���!�a�!�e�)�$�(A�A��A�!�a�!�e�)�,�,�D�
-�	-���v�
�rc��|jj|jd|jg�\}}}|r3|jj	|�td|jz��|j
�ddD]P}|jdd�}|jj|d�t|d�|j|d<�Ry)Nz-vz,Neither python zipfile nor unzip can read %srJ�����)r=�run_commandr5r8�debugr&�
splitlines�splitrA�append�intrC)rF�rc�out�err�line�fieldss      r�_legacy_file_listzZipArchive._legacy_file_listVs����{�{�.�.��
�
�t�T�X�X�/N�O���C��
��K�K���c�"� �!O�RV�RZ�RZ�!Z�[�[��N�N�$�Q�r�*�	7�D��Z�Z��a�(�F��"�"�)�)�&��)�4�(+�F�1�I��D�N�N�6�!�9�%�	7rc��|jr|j|S	t|j�}	|j�D].}t	|j
�|j|j<�0	|j|S#t$r|j�td��wxYw#t$rH}|jdj�jd�r|j�n�Yd}~��d}~wwxYw)Nz#Unable to list files in the archiver�bad magic number)rCrr8�infolistrb�CRC�filename�	Exception�closer&r�args�lower�
startswithrh)rFr�archive�item�es     r�_crc32zZipArchive._crc32as����>�>��>�>�$�'�'�	L��d�h�h�'�G�
L�#�,�,�.�B�D�47����M�D�N�N�4�=�=�1�B��~�~�d�#�#��	�
L��
�
��$�%J�K�K�
L���	��v�v�a�y��� �+�+�,>�?��&�&�(��)��		�s#�B,�AB�%B)�,	C=�5>C8�8C=c�r�|jr|jSg|_	t|j�}	|j�D]�}|jrM|jD]=}tj
||�s�|jj
t|���?�\d}|jr+|jD]}tj
||�s�d}n|r��|jj
t|����	|j�|jS#t$r,}|j�tdt|�z��d}~wwxYw#t$rS}|jdj�jd�r|j!�n�Yd}~|jSd}~wwxYw)NFT�'Unable to list files in the archive: %srrj)rArr8�namelistr@�fnmatchrar	r>rnror&rrprqrrrh)rFrs�memberr1�exclude_flagr0rus       r�files_in_archivezZipArchive.files_in_archivexs����!�!��)�)�)�!#���	��d�h�h�'�G�
_�%�.�.�0�
M�F��)�)�'+�'9�'9�Q�G�&���v�w�?� $� 6� 6� =� =�i��>O� P�Q�(-���=�=�+/�=�=�*��#*�?�?�6�7�#C�37�L�$)�*� ,� �2�2�9�9�)�F�:K�L�
M�$
�M�M�O��%�%�%���
_��
�
��$�%N�QZ�[\�Q]�%]�^�^��
_��/�	��v�v�a�y��� �+�+�,>�?��&�&�(��)�0�%�%�%��9	�sB�E�AD"�<AD"�D"�&D"�"	E�+'E�E�	F6�#>F1�1F6c
���|jr&|j|jdd|jg}n|jdd|jg}|jr|j	dg|jz�|j
r|j	|j
�|jj|�\}}}|jj|�|}d}d}|dk(rd}nd}tjd�}tj|�tj�}	tj�}
tj�}tj�}	t!j"|�j$}
	t+j,|�j.}dx}}|j4dr<	t!j6|j4d�}|j$}|j:}n	|
}|}dx}}|j4d	r<	t+j>|j4d	�}|j.}|j@}n	|}|}|jC�D�]}d}|jEdd
�}tG|�dk7r�'tG|d�d
k7rtG|d�dk7r�JtG|d
�dk7r�\|dddvs tI|ddd�jKd�s��|dd}|ddd}|d}|d}t9|d�}tM|d
d��}||jvr	|d|zz
}��|ddk(r|dk7r|d|�d|�d�z
}d}n|dk(rd}n|dk(rd }n|d!k(rd }tG|�d
k(r|ddk(rd"}n
|d#k(rd"}nd$}|}nd%|	jO�vr|}nd}tG|�d&k7stPjS|�stUd'|z��tjVjY|jZt]|d���} 	tj^| �}!dk(rRtejf|!jh�s3d}|j`jc|�|d,|zz
}|d-|�d*|�d+�z
}��|d k(rTtejj|!jh�s5d}d}|j`jc|�|d.|zz
}|d-|�d*|�d+�z
}��r|dk(rRtejl|!jh�s3d}|j`jc|�|d/|zz
}|d-|�d*|�d+�z
}���tod0|z�}"tqjptsjt|d
d1�dd
�}#tsjv|#jy��}$tejj|!jh�r�|jjzd2r�|$|!j|kDr+d}|j`jc|�|d3|zz
}d4|"d5<n�tejj|!jh�rz|$|!j|krk|d6|zz
}|jjc|����|$|!j|k7r7d}|j`jc|�|d7||$|!j|fzz
}d4|"d5<tejj|!jh�r+||!j~k7rd}|d8|||!j~fzz
}d9|"d<tejj|!jh�rKt�| |j��}%|%|j�|�k7r!d}|d:||j�|�|%fzz
}d-|"d<|dk7r�|j4d;rHt�|j4d;t8�r|j4d;}&nE	t9|j4d;d�}&n*|d!k(r|j�|d�}&n|j�||�}&&tej�|!jh�k7r/d}d>|"d?<|d@||&tej�|!jh�fzz
}dx}(})	t!j"|!j��j$}(|dk7r||
k7s||k7rtUdA|�dB|�dC|
����|(r|(|k7rd}|d|�dD|(�dE|�dF�z
}dG|"d
<n|)r|)|k7rd}|d|�dH|)�dI|�dF�z
}dG|"d
<dx}*}+	t+j,|!j��j.}*|dk7r"||k7s||k7r||
vrtUdJ|�dB|�dC|
����|*r|*|k7rd}|d|�dK|*�dL|�dF�z
}dM|"d
<n|+r|+|k7rd}|d|�dN|+�dO|�dF�z
}dM|"d
<|s���||j`vr|j`jc|�|djY|"��dP|�d+�z
}��!|j`rd}t�||||||�Q�S#t&t(f$r|}
Y��-wxYw#t(t0t2f$r|}Y��*wxYw#t($r`	t!j"t9|j4d��}n/#t&t(t0f$rt!j"|�}YnwxYwY��`wxYw#t<$rY��TwxYw#t0t(f$r`	t+j,t9|j4d	��}n/#t(t0t2f$rt+j,|�}YnwxYwY���wxYw#t<$rY���wxYw#t<$r5d}|j`jc|�|d(|zz
}|d)�d*|�d+�z
}Y���wxYw#t<$r�}'	t�j�|!|j4d;�}&nR#t0$rF}'|jj�|d<t�|'�zt�j���=�Yd}'~'nd}'~'wwxYwYd}'~'���d}'~'wwxYw#t&t(f$r|!j�})Y��wwxYw#t(t0t2f$r|!j�}+Y��wxYw)RNz-Tz-s�-xr2rTF�owner�groupr[��
r\�zdl-?�zrwxstah-rPrJ�surrogate_or_strict��errorszPath %s is excluded on request
rI�/�dzPath z incorrectly tagged as "z", but is a directory.
�l�L�-r�?�	rwxrwxrwxzrwx---z	rw-rw-rw-�bsd�	z"ZIP info perm format incorrect, %szPath %s is missing
�>z
++++++.?? �
z/File %s already exists, but not as a directory
�cz7Directory %s already exists, but not as a regular file
z2Directory %s already exists, but not as a symlink
z.%s.......??z
%Y%m%d.%H%M%S�
keep_newerz!File %s is older, replacing file
rO�z!File %s is newer, excluding file
z$File %s differs in mtime (%f vs %f)
z#File %s differs in size (%d vs %d)
rNz5File %s differs in CRC32 checksum (0x%08x vs 0x%08x)
rUz%s)r�msg�	exception�p�z*Path %s differs in permissions (%o vs %o)
zCannot change ownership of � to z
, as user z is owned by user z, not by user z
 as expected
�oz is owned by uid z
, not by uid z!Cannot change group ownership of z is owned by group z, not by group �gz is owned by gid z
, not by gid � )�
unarchivedrcrdre�cmd�diff)OrDr7r8r>�extendr@r=r]r^�osrS�platform�system�	getgroups�getuid�getgid�pwd�getpwuid�pw_name�	TypeError�KeyError�grp�getgrgid�gr_name�
ValueError�
OverflowErrorr:�getpwnamrb�pw_uidrn�getgrnam�gr_gidr_r`�len�	frozenset�issubsetr
rq�ZIP_FILE_MODE_RE�matchr&r�joinr9r�lstatr?ra�stat�S_ISDIR�st_mode�S_ISREG�S_ISLNK�list�datetime�time�strptime�mktime�	timetupler;�st_mtime�st_sizerr/rv�
isinstancer�_symbolic_mode_to_octal�	fail_jsonr	�	traceback�
format_excrX�S_IMODE�st_uid�st_gidrB),rFr�rcrdre�old_outr�r�rS�
systemtype�groups�run_uid�run_gid�	run_owner�	run_group�	fut_owner�fut_uid�tpw�	fut_group�fut_gid�tgrrf�change�pcs�ztype�permstr�version�ostype�sizer�ftype�
file_umaskr9�st�itemized�	dt_object�	timestamprrUrur��uidr��gids,                                            r�
is_unarchivedzZipArchive.is_unarchived�s�������(�(�$�*:�*:�D�$����Q�C��(�(�$��d�h�h�?�C��=�=��J�J��x�$�-�-�/�0�����J�J�t�)�)�*��{�{�.�.�s�3���C�������#��������
��7��J��J�������
������_�_�&�
�������)�)�+���)�)�+��	 ����W�-�5�5�I�	 ����W�-�5�5�I�
#�"�	�G��>�>�'�"�
0��l�l�4�>�>�'�#:�;�����I��j�j�G�
�%�	��G�#�"�	�G��>�>�'�"�
0��l�l�4�>�>�'�#:�;�����I��j�j�G�
�%�	��G��&�&�(�[	>�D��F��*�*�T�1�%�C��3�x�1�}���3�q�6�{�a��C��A��K�2�$5���3�q�6�{�b� ���1�v�a�y��&�i��A��q�r�
�.C�.L�.L�Z�.X����F�1�I�E��!�f�Q�R�j�G��!�f�G���V�F��s�1�v�;�D��3�q�6�*?�@�D��t�}�}�$��9�D�@�@����B�x�3���C�<��Z^�`e�f�f�C����#�����#�����#�����7�|�q� ���8�s�?�)�G���(�)�G�)�G�"�
��*�*�*�,�,�"�
��
��7�|�q� �(8�(>�(>�w�(G�$�%I�G�%S�T�T�
�W�W�\�\�$�+�+�x��EZ�/[�\�F�
��X�X�f�%����|�D�L�L����$<����
�
�$�$�T�*��I�D�P�P���u�d�;�;�����|�D�L�L����$<���"�
��
�
�$�$�T�*��Q�TX�X�X���u�d�;�;�����|�D�L�L����$<����
�
�$�$�T�*��L�t�S�S���u�d�;�;����N�U�2�3�H�
!�)�)�D�M�M�#�a�&�/�,R�ST�UV�,W�Y�I����I�$7�$7�$9�:�I��|�|�B�J�J�'��;�;�%�%�l�3� �2�;�;�.�!%���
�
�,�,�T�2��C�d�J�J��&)�������b�j�j�1�i�"�+�+�6M��C�d�J�J���
�
�,�,�T�2� � �B�K�K�/�!%���
�
�,�,�T�2��F�$�PY�[]�[f�[f�Ig�g�g��&)�����|�|�B�J�J�'�D�B�J�J�,>����=��t�R�Z�Z�@X�X�X��!�����|�|�B�J�J�'��F�D�$7�$7�8���$�+�+�d�+�+�!�F��S�W[�]a�]h�]h�im�]n�ps�Vt�t�t�C�"%�H�Q�K�
��|��>�>�&�)�!�$�.�.��"8�#�>�#�~�~�f�5��|�#&�t�~�~�f�'=�q�#A�D��c�\��1�1�'�1�=�D��1�1�'�:�F�D��4�<�<��
�
�3�3�!�F�"%�H�Q�K��H�D�RV�X\�Xd�Xd�eg�eo�eo�Xp�Kq�q�q�C���E�C�
 ����R�Y�Y�/�7�7��
�!�|��i�!7�7�g�;M�$�Z^�`i�kt�%u�v�v���)�+����VZ�\a�cl�m�m��!�����������TX�Z]�_f�g�g��!������E�C�
 ����R�Y�Y�/�7�7���!�|��i�!7�7�g�;M�SZ�bh�Sh�$�`d�fo�qz�%{�|�|���)�+����X\�^c�en�o�o��!�����������TX�Z]�_f�g�g��!������t�}�}�,��M�M�(�(��.��R�W�W�X�%6��=�=��w[	>�z�=�=��J�
�z�b�c�s��RV�W�W��e�8�$�	 ��I�	 ���*�m�4�	 ��I�	 ���
0�0��,�,�s�4�>�>�'�+B�'C�D�C��!�8�Z�8�0��,�,�w�/�C�0��
0���
��
����)�
0�0��,�,�s�4�>�>�'�+B�'C�D�C�� �*�m�<�0��,�,�w�/�C�0��
0���
��
��`�
����
�
�$�$�T�*��-��4�4���u�d�;�;���
��h )�|�|�'4�'L�'L�R�QU�Q_�Q_�`f�Qg�'h���#-�|� $��� 5� 5�4�T�I�VW�L�EX�dm�dx�dx�dz� 5� {� {��|���|��(�x�(�
 ��i�i��
 ��(�j�-�8�
 ��i�i��
 �s&�$f�f4�7"g�3h=�"i
�j?�k�l�)n�()o�f1�0f1�4g�
g�	h:�+h�h:�)h3�0h:�2h3�3h:�9h:�=	i
�	i
�
j<�+j	�j<�	)j5�2j<�4j5�5j<�;j<�?	k�k�:l
�l
�	n�#l>�=n�>	n
�<n�n�n
�
n�n�n=�<n=� o$�#o$c���|jdg}|jr|j|j�|j|j�|j
r|jdg|j
z�|jr|j|j�|jd|jg�|jj|�\}}}t||||��S)Nz-orz-d�r�rcrdre)r5r<r�rar8r>r@r9r=r]rB)rFr�rcrdres     r�	unarchivezZipArchive.unarchive�s����}�}�d�#���9�9��J�J�t�y�y�!��
�
�4�8�8��
�=�=��J�J��v��
�
�-�.�����J�J�t�)�)�*��
�
�D�$�+�+�&�'��{�{�.�.�s�3���C�������5�5rc	���g}|jD]}	t||dt|d���!|r#ddjdj
|���fS|jd|jg}|jj|�\}}}|dk(ry|jj|�dd	|j�d
|��fS#t$r|j	|d�Y��wxYw)Nr�rFz7Unable to find required '{missing}' binary in the path.z' or ')�missingz-l�TN�	Command "�" could not handle archive: )rE�setattrrr�ra�formatr�r5r8r=r]r^)rFr��br�rcrdres       r�can_handle_archivezZipArchive.can_handle_archive�s��������	%�A�
%���a��d�L��1��$6�7�	%���S�Z�Z�ck�cp�cp�qx�cy�Z�z�z�z��}�}�d�D�H�H�-���{�{�.�.�s�3���C��
��7�������#���T�]�]�TW�X�X�X���
%����q��t�$�
%�s�C�C#�"C#N)r'r(r)rGrXrhrv�propertyr}r�r�r�r*rrr,r,3s>��
�(�	7�$�.�#&��#&�JsX�j	6�"Yrr,c�:�eZdZd�Zd�Zed��Zd�Zd�Zd�Z	y)�
TgzArchivec���||_||_||_|jd|_||_|j
jr4|j
jdd|j
jz��|j
jdD�cgc]}|jd���c}|_
|j
jd|_d|_d|_
d|_g|_ycc}w)	Nr.Tz>remote module (%s) does not support check mode when using gtar)�skippedr�r0r�r1z-z)r8r9r:r;r<r=�
check_mode�	exit_json�_name�rstripr>r@r5�tar_type�zipflagrA)rFr8r9r:r=rs      rrGzTgzArchive.__init__�s���������"����M�M�,�/��	�����;�;�!�!��K�K�!�!�$�4t�w{�xC�xC�xI�xI�5I�!�
J�6:�k�k�6H�6H��6S�T�d����S�)�T��
�!�[�[�/�/�	�:�����
���
����!#����Us�C1c��|jdg}|jj|�\}}}d}|jd�rd}|S|jd�rd|vrd}|S)Nz	--version�bsdtarr��tar�GNU�gnu)r5r=r]rr)rFr�rcrdrers      r�
_get_tar_typezTgzArchive._get_tar_type
se���}�}�k�*�����0�0��5���S�#����>�>�(�#��H����^�^�E�
"�u��|��H��rc
�t�|jr|jS|jdd|jg}|jr|j	|j�|j
r|j
dg|j
z�|jr,|j
|jD�cgc]}d|z��	c}�|j
d|jg�|jr|j
|j�t|j�}|jj||jt||||����\}}}|dk7r)|jj|�td	|z��|j!�D]�}t#t%j&|�d�}|j)d
�r|dd}d}|jr+|jD]}	t+j*||	�s�d
}n|r�v|jj	t#|����|jScc}w)Nz--list�-C�--show-transformed-names�
--exclude=�-f��LANG�LC_ALL�LC_MESSAGES�LANGUAGE��cwd�environ_updaterrxr�r�FT)rAr5r9rrar<r�r>r8r@r
r=r]rBr^r&r_r	�codecs�
escape_decoderrrz)
rFr�r�localercrdrermr|r0s
          rr}zTgzArchive.files_in_archives����!�!��)�)�)��}�}�h��d�k�k�:���<�<��J�J�t�|�|�$��9�9��J�J�2�3�d�i�i�?�@��=�=��J�J�$�-�-�@�Q��q�(�@�A��
�
�D�$�(�(�#�$�����J�J�t�)�)�*�)�$�+�+�6���{�{�.�.�s����TX�^d�ms�BH�SY�UZ�.�[���C��
��7��K�K���c�"� �!J�S�!P�Q�Q����(�	C�H�!��!5�!5�h�!?��!B�C�H�
�"�"�3�'�#�A�B�<�� �L��}�}�#�}�}��G����x��9�'+����
 ��&�&�-�-�i��.A�B�'	C�*�%�%�%��AAs�*H5c
��|jdd|jg}|jr|j|j�|jr|jdg|jz�|jdr*|jdt|jd�z�|jdr*|jdt|jd�z�|jjdr|jd	�|jr,|j|jD�cgc]}d
|z��	c}�|jd|jg�|jr|j|j�t|j�}|jj||jt||||���
�\}}}d}|}d}t!j"�}	|j%�|j%�zD�]}
t&j)|
�r�|	dk(r,|jdst*j)|
�r||
dzz
}|	dk(r,|jdst,j)|
�r||
dzz
}|jdst.j)|
�r||
dzz
}t0j)|
�r||
dzz
}t2j)|
�r||
dzz
}t4j)|
�r||
dzz
}t6j)|
�s��||
dzz
}�� |rd}t|||||��Scc}w)Nz--diffrrr��--owner=r��--group=r��--keep-newer-filesrrrrTr2rr�rUF)r�rcrdrer�)r5r9rrar<r�r:rr=r;r>r8r@r
r]rBr�r�r_�
EMPTY_FILE_RE�search�
OWNER_DIFF_RE�
GROUP_DIFF_RE�MODE_DIFF_RE�MOD_TIME_DIFF_RE�MISSING_FILE_RE�INVALID_OWNER_RE�INVALID_GROUP_RE)rFr�rrrcrdrer�r�r�rfs           rr�zTgzArchive.is_unarchivedAs����}�}�h��d�k�k�:���<�<��J�J�t�|�|�$��9�9��J�J�2�3�d�i�i�?�@��>�>�'�"��J�J�z�E�$�.�.��*A�$B�B�C��>�>�'�"��J�J�z�E�$�.�.��*A�$B�B�C��;�;���l�+��J�J�+�,��=�=��J�J�$�-�-�@�Q��q�(�@�A��
�
�D�$�(�(�#�$�����J�J�t�)�)�*�)�$�+�+�6���{�{�.�.�s����TX�^d�ms�BH�SY�UZ�.�[���C���
������)�)�+���&�&�(�3�>�>�+;�;�	#�D��#�#�D�)���!�|�D�N�N�7�$;�
�@T�@T�UY�@Z��t�d�{�"���!�|�D�N�N�7�$;�
�@T�@T�UY�@Z��t�d�{�"���>�>�&�)�l�.A�.A�$�.G��t�d�{�"���&�&�t�,��t�d�{�"���%�%�d�+��t�d�{�"���&�&�t�,��t�d�{�"���&�&�t�,��t�d�{�"��%	#�&��J��z�b�c�s��L�L��OAs�.Mc
���|jdd|jg}|jr|j|j�|jr|jdg|jz�|jdr*|jdt|jd�z�|jdr*|jdt|jd�z�|jjdr|jd	�|jr,|j|jD�cgc]}d
|z��	c}�|jd|jg�|jr|j|j�t|j�}|jj||jt||||���
�\}}}t||||��Scc}w)Nz	--extractrrr�rr�rr�r rrrrr�)r5r9rrar<r�r:rr=r;r>r8r@r
r]rB)rFr�rrrcrdres       rr�zTgzArchive.unarchivews����}�}�k�4����=���<�<��J�J�t�|�|�$��9�9��J�J�2�3�d�i�i�?�@��>�>�'�"��J�J�z�E�$�.�.��*A�$B�B�C��>�>�'�"��J�J�z�E�$�.�.��*A�$B�B�C��;�;���l�+��J�J�+�,��=�=��J�J�$�-�-�@�Q��q�(�@�A��
�
�D�$�(�(�#�$�����J�J�t�)�)�*�)�$�+�+�6���{�{�.�.�s����TX�^d�ms�BH�SY�UZ�.�[���C�������5�5��
As�.G"c��	td�|_|j�|_|jdk7rdd|j�d|j�d�fS	|j
ry		dd|jzfS#t$r%	td�|_n#t$rYYywxYwY��wxYw#t$r'}dd|j�d
t|���fcYd}~Sd}~wwxYw)N�gtarr	)Fz:Unable to find required 'gtar' or 'tar' binary in the pathrFr�z" detected as tar type z. GNU tar required.r�r�zNCommand "%s" found no files in archive. Empty archive files are not supported.)rr5r�rrr}r&r	)rFrus  rr�zTgzArchive.can_handle_archive�s���	[�(��0�D�M��*�*�,��
��=�=�E�!��W[�Wd�Wd�fj�fs�fs�t�t�t�	f��$�$�!�%��f�im�iv�iv�v�v�v��'�	[�
[� ,�U� 3��
���
[�Z�
[���	[���	f�����Xa�bc�Xd�e�e�e��	f�sS�A5�B&�5	B#�?B�B#�	B�B#�B�B#�"B#�&	C�/C�C�CN)
r'r(r)rGrr�r}r�r�r�r*rrr�r��s3��
$���*&��*&�X4M�l6�*wrr�c���eZdZ�fd�Z�xZS)�
TarArchivec�@��tt|�||||�d|_y)Nr2)�superr.rGr�rFr8r9r:r=�	__class__s     �rrGzTarArchive.__init__�s���
�j�$�(��f�i��H���r�r'r(r)rG�
__classcell__�r2s@rr.r.�s
����rr.c���eZdZ�fd�Z�xZS)�TarBzipArchivec�@��tt|�||||�d|_y)Nz-j)r0r7rGrr1s     �rrGzTarBzipArchive.__init__�s���
�n�d�,�S�&�)�V�L���rr3r5s@rr7r7��
����rr7c���eZdZ�fd�Z�xZS)�TarXzArchivec�@��tt|�||||�d|_y)Nz-J)r0r;rGrr1s     �rrGzTarXzArchive.__init__�s���
�l�D�*�3��	�6�J���rr3r5s@rr;r;�r9rr;c���eZdZ�fd�Z�xZS)�TarZstdArchivec�@��tt|�||||�d|_y)Nz--use-compress-program=zstd)r0r>rGrr1s     �rrGzTarZstdArchive.__init__�s!���
�n�d�,�S�&�)�V�L�5��rr3r5s@rr>r>�s
���5�5rr>c�(��eZdZ�fd�Z�fd�Z�xZS)�ZipZArchivec�N��tt|�||||�d|_d|_y)Nz-Z)r3)r4r7)r0rArGrDrEr1s     �rrGzZipZArchive.__init__�s)���
�k�4�)�#�v�y�&�I����
��
rc����tt|��\}}|s||fS|j|jg}|j
j
|�\}}}d|j�vrydd|zfS)Nr6r�Fz/Command "unzip -Z" could not handle archive: %s)r0rAr�r7rDr=r]rq)rF�unzip_available�	error_msgr�rcrdrer2s       �rr�zZipZArchive.can_handle_archive�sy���%*�;��%P�%R�"����"�I�-�-��$�$�d�&6�&6�7���{�{�.�.�s�3���C����	�	��#���G�#�M�M�Mr)r'r(r)rGr�r4r5s@rrArA�s���
�N�NrrAc�,�tttttt
tg}t�}|D]7}|||||�}|j�\}}	|r|cS|j|	��9dj|�}
|jd|�d|
����y)Nr�zFailed to find handler for "zD". Make sure the required command to extract the file is installed.
�r�)r,rAr�r.r7r;r>�setr��addr�r�)r8�destr:r=�handlers�reasons�handler�obj�
can_handle�reason�
reason_msgs           r�pick_handlerrR�s����K��Z��Q]�_m�n�H��e�G�����c�4��F�3��"�5�5�7���V���J����F������7�#�J�
���EH�JT�U��Vrc�Z
�tttdd��tdd��tdd��td��tdd��tdd��tdd	g�
�tdd	g�
�tdd	g�
�tdd��tdd��tdd��tdd���
�
dddg��}|jd}|jd}tjj|�}t
|d��}tjj|�s"|jdj||���|jd}|j|j�}tjj|�s>|s|jd|z��n&d|vr
t||�}n|jd|z��tj|tj�s|jd|z��tjj|�}	tjj!|�dk(r|jd|z��tjj'|�s|jd |z��t)||||�}t|j*j,||�!�}	|j/�}
|j0r
|
d"|	d#<nI|
d"rd|	d#<n>	|j3�|	d$<|	d$d%dk7r|jd0d&d'|�d(|��i|	��d|	d#<|
j7d)d�r
d*|
d)i|	d)<|	j7d)d�r�|j0s�g}|j8D]z}tjj;|t
|d���|d<	|j=||	d#d�+�|	d#<d-|vs�Q|jAd-�d}
|
|vs�j|jC|
��||r,|D]'}|�d-|��|d<	|j=||	d#d�+�|	d#<�)|jd.r|j8|	d/<|jDd0i|	��y#t"$r,}|jd|�dt%|�����Yd}~��'d}~wwxYw#t4$r|jd0d&d'|�d(|��i|	��Y���wxYw#t4t>f$r+}|jd0d&d,t%|�zi|	��Yd}~��'d}~wwxYw#t4t>f$r+}|jd0d&d,t%|�zi|	��Yd}~��/d}~wwxYw)1NrT)�type�required�boolF)rT�default)rTr��str)rT�elementsrWrbi)
r8rJ�
remote_src�creates�
list_filesr�r0r1r.�validate_certsr/�copy�decrypt)r1r0)�
argument_spec�add_file_common_args�supports_check_mode�mutually_exclusiver8rJr�r�zNRelative destination path '{dest}' was resolved to absolute path '{abs_dest}'.)rJ�abs_destrZzSource '%s' failed to transferrGz://zSource '%s' does not existzSource '%s' not readablerz)Invalid archive '%s', the file is 0 byteszSource 'z' not readable, z#Destination '%s' is not a directory)rMrJr8r��changed�extract_resultsrcr�zfailed to unpack r�r��prepared)�expandz1Unexpected error when accessing exploded file: %sr�r\�filesr*)#rrBr;r�r�abspathr�isabs�warnr��load_file_common_arguments�existsr�r�access�R_OK�getsizernr	�isdirrRr2r'r�rr��IOError�getr}r��set_fs_attributes_if_different�OSErrorr`rar)r=r8rJrdr9rZr:rurM�res_args�
check_results�top_foldersrm�top_folder_pathrs               r�mainr{�s(��
���&�4�0��6�D�1����7��f�%����7����7��f�u�b�A��f�u�b�A���%��D��V�T�:��U�I�>�
�6�4�0��f�d�3�#
�&"� �2�3�1�F�6�-�-��
�C��=�=�� �D��w�w���t�$�H�
�h�'<�
=�F�
�7�7�=�=������d�k�k�qu�AI�k�J�	K����|�,�J��1�1�&�-�-�@�I��7�7�>�>�#������!A�C�!G��H�
�c�\��V�S�)�C����!=��!C��D�
�9�9�S�"�'�'�"����7�#�=��>�
�'�'�/�/�#�
�C�S�
�7�7�?�?�3��1�$����!L�s�!R��S�
�7�7�=�=�� ����B�T�I��J��3��	�6�:�G��G�-�-�6�6�T�s�K�H��)�)�+�M�
���"/��"=�=����	�|�	$�#����	'�*1�*;�*;�*=�H�&�'��)�*�4�0�A�5� �� � �[�C��%N�[�RZ�[�#'�H�Y�������'�&�
�f�(=�>�����|�|�F�D�!�&�*;�*;����0�0�	8�H� "�����V�X�h�Od�5e� f�I�f��
u�&,�&K�&K�I�W_�`i�Wj�sx�&K�&y���#��h��"*�.�.��"5�a�"8��"�+�5��&�&��7�	8�� �
y��/3�Q�$7�	�&�!�y�*0�*O�*O�PY�[c�dm�[n�w|�*O�*}�H�Y�'�
y��}�}�\�"�#�4�4�����F��� �x� ��E�S����s�I�a�L�Q��R�R��S��6�	X��F���W��T�!J�W�h�W�	X��$�W�%�
u� �� � �t�%X�[d�ef�[g�%g�t�ks�t�t��
u�� ��)�y�$�F�$�$�x�)\�_h�ij�_k�)k�x�ow�x�x��y�sZ�#7Q�08R	�'R3�S0�	R�!R�R�	#R0�/R0�3S-� S(�(S-�0T*�? T%�%T*�__main__)D�
__future__rrrrT�
__metaclass__�
DOCUMENTATION�EXAMPLES�RETURNrrr�rzr�r�r�r�r!r�r�r��	functoolsr�zipfiler�+ansible.module_utils.common.text.convertersrr	r
�ansible.module_utils.basicr�#ansible.module_utils.common.processr�"ansible.module_utils.common.localer
�ansible.module_utils.urlsr�shlexr�ImportError�pipesrr�compiler#r$r%r&r!r'r�r(r)rr$rnr&�objectr,r�r.r7r;r>rArRr{r'r*rr�<module>r�s���A�@��
�L�
�\��6:
��x�
���
�	��
�	������T�T�4�<�G�0���1�"���
�
�,�-�
���
�
�,�-�
��r�z�z�,�-���2�:�:�4�5����
�
�R�S�
��"�*�*�R�S���2�:�:�6�7���2�:�:�0�1���2�:�:�0�1���7�
	�Y�	�CY��CY�Ljw��jw�\����Z���:��	5�Z�	5�N�*�N�0
V�|!�~�z���F���G������
�1�0�0�1�s$�2F�9F%�F"�!F"�%F4�3F4

Youez - 2016 - github.com/yon3zu
LinuXploit