403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /lib/python3.11/site-packages/ansible/modules/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib/python3.11/site-packages/ansible/modules/__pycache__/unarchive.cpython-311.pyc
�

���c'���X�ddlmZmZmZeZdZdZdZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlmZddlmZmZddlmZmZmZdd	lmZdd
l m!Z!ddl"m#Z#ddl$m%Z%	dd
l&m'Z'n#e($r	dd
l)m'Z'YnwxYwej*d��Z+ej*d��Z,ej*d��Z-ej*d��Z.ej*d��Z/ej*d��Z0ej*d��Z1ej*d��Z2ej*d��Z3d�Z4d�Z5Gd�de6��Z7Gd�de8��Z9Gd�de8��Z:Gd�d e:��Z;Gd!�d"e:��Z<Gd#�d$e:��Z=Gd%�d&e:��Z>Gd'�d(e9��Z?d)�Z@d*�ZAeBd+kreA��dSdS),�)�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 C(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 C(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 C(remote_src=yes).
     - For Windows targets, use the M(community.windows.win_unzip) module instead.
options:
  src:
    description:
      - If C(remote_src=no) (default), local path to archive file to copy to the target server; can be absolute or relative. If C(remote_src=yes), path on the
        target server to existing archive file to unpack.
      - If C(remote_src=yes) and C(src) contains C(://), 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 C(remote_src).
      - This option is mutually exclusive with C(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 C(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 C(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 C(include)
        is not empty, only files listed here will be extracted.
      - Mutually exclusive with C(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 C(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 C(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 C(false) used on personally controlled sites using self-signed certificate.
      - Prior to 2.2 the code worked as if this was set to C(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/
a_
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 I(list_files) is 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 I(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�
BadZipfile)�to_bytes�	to_native�to_text)�
AnsibleModule)�get_bin_path)�get_best_parsable_locale)�
fetch_file)�quotez: 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��n#1swxYwY|dzS)z# Return a CRC32 checksum of a file ��rbNl��)�binascii�crc32�open�iterr�read)�path�buffer_size�crc�f�b_blocks     �>/usr/lib/python3.11/site-packages/ansible/modules/unarchive.pyrrs����.��
�
�C�	
�d�D�	�	�/�Q��G�A�F�K�8�8�#�>�>�	/�	/�G��.��#�.�.�C�C�	/�/�/�/�/�/�/�/�/�/�/�/����/�/�/�/����s�<A.�.A2�5A2c�.�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�$�g�v�6�6�6rc��eZdZdS)�UnarchiveErrorN)�__name__�
__module__�__qualname__�rrr%r%*s�������Drr%c�N�eZdZd�Zd�Zd�Zd�Zed���Zd�Z	d�Z
d�Zd	S)
�
ZipArchivec�R�||_||_||_|jd|_||_|jd|_|jd|_g|_|jjd|_	d|_
d|_g|_t��|_d|_d|_dS)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_filesr4r6�_files_in_archive�dict�	_infodict�zipinfoflag�binaries��selfr7r8r9r<s     r�__init__zZipArchive.__init__0s���������"����M�,�/��	����$�m�,<�=����
�i�0��
���
�!�[�/�	�:�����
� $���!#�����������
��
�
�
rc��|ddd�}d}tdd��D]3}tdd��D] }||d|zzdvr|d|d|zzzz
}�!�4||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_octalDs������2�������q�!���	-�	-�A��1�a�[�[�
-�
-���!�a�!�e�)�$�(A�A�A��A�!�a�!�e�)�,�,�D��
-���v�
�rc�~�|j�|jd|jg��\}}}|rt	d|jz���|���dd�D][}|�dd��}|j�|d��t|d��|j
|d<�\dS)Nz-vz,Neither python zipfile nor unzip can read %srJ�����)r<�run_commandr4r7r%�
splitlines�splitr@�append�intrB)rF�rc�out�err�line�fieldss      r�_legacy_file_listzZipArchive._legacy_file_listQs����{�.�.��
�t�T�X�/N�O�O���C��
�	\� �!O�RV�RZ�!Z�[�[�[��N�N�$�$�Q�r�T�*�	7�	7�D��Z�Z��a�(�(�F��"�)�)�&��)�4�4�4�(+�F�1�I���D�N�6�!�9�%�%�	7�	7rc��|jr
|j|S	t|j��}	|���D]#}t	|j��|j|j<�$n�#t$r$|���td���wxYw#t$rR}|jd����
d��r|���n�Yd}~nd}~wwxYw|j|S)Nz#Unable to list files in the archiver�bad magic number)rBrr7�infolistra�CRC�filename�	Exception�closer%r�args�lower�
startswithrg)rFr�archive�item�es     r�_crc32zZipArchive._crc32[s-���>�	(��>�$�'�'�	L��d�h�'�'�G�
L�#�,�,�.�.�B�B�D�47���M�M�D�N�4�=�1�1�B���
L�
L�
L��
�
����$�%J�K�K�K�
L������	�	�	��v�a�y��� � �+�+�,>�?�?�
��&�&�(�(�(�(��)�(�(�(�(�����		�����~�d�#�#s#�B�8A$�$.B�
C1�AC,�,C1c�N�|jr|jSg|_	t|j��}	|���D]�}|jrG|jD]>}tj||��r'|j�t|�����?�Pd}|jr#|jD]}tj||��rd}n�|s'|j�t|������nE#t$r8}|�
��tdt|��z���d}~wwxYw|�
��n_#t$rR}|j
d����d��r|���n�Yd}~nd}~wwxYw|jS)NFT�'Unable to list files in the archive: %srri)r@rr7�namelistr?�fnmatchr`r
r=rmrnr%rrorprqrg)rFrr�memberr0�exclude_flagr/rts       r�files_in_archivezZipArchive.files_in_archivers���!�	*��)�)�!#���	��d�h�'�'�G�
_�%�.�.�0�0�
M�
M�F��)�M�'+�'9�Q�Q�G�&��v�w�?�?�Q� $� 6� =� =�i��>O�>O� P� P� P��Q�(-���=�*�+/�=�*�*��#*�?�6�7�#C�#C�!*�37�L�$)�E�!*� ,�M� �2�9�9�)�F�:K�:K�L�L�L��
M���
_�
_�
_��
�
����$�%N�QZ�[\�Q]�Q]�%]�^�^�^�����
_����
�M�M�O�O�O�O��7�	�	�	��v�a�y��� � �+�+�,>�?�?�
��&�&�(�(�(�(��)�(�(�(�(�����		����8�%�%s0�E�B:C'�'
D)�13D$�$D)�
F�AF�Fc
�h�|jr|j|jdd|jg}n|jdd|jg}|jr|�dg|jz��|jr|�|j��|j�|��\}}}|}d}d}|dkrd}nd}tj	d��}tj	|��tj��}	tj��}
tj
��}tj��}	tj|��j}
n#t$t&f$r|}
YnwxYw	t)j|��j}n#t&t.t0f$r|}YnwxYwdx}}|jdr�	tj|jd��}no#t&$rb	tjt7|jd����}n1#t$t&t.f$rtj|��}YnwxYwYnwxYw|j}|j}n	|
}n#t:$rYnwxYw|}dx}}|jd	r�	t)j|jd	��}nv#t.t&f$rb	t)jt7|jd	����}n1#t&t.t0f$rt)j|��}YnwxYwYnwxYw|j}|j}n	|}n#t:$rYnwxYw|}|� ��D�]g}d}|�!dd
��}tE|��dkr�/tE|d��d
krtE|d��dkr�btE|d
��dkr�||dddvs0tG|ddd����$d��s��|dd}|ddd�}|d}|d}t7|d��}tK|d
d���}||jvr
|d|zz
}��*|ddkr|dkr|d|�d|�d�z
}d}n|dkrd}n|dkrd }n|d!krd }tE|��d
kr|ddkrd"}n|d#krd"}nd$}|}nd%|	�&��vr|}nd}tE|��d&kstN�(|��stSd'|z���tj*�+|j,t[|d�����} 	tj.| ��}!nA#t:$r4d}|j/�0|��|d(|zz
}|d)|�d*|�d+�z
}Y��vwxYw|dkrKtcj2|!j3��s2d}|j/�0|��|d,|zz
}|d-|�d*|�d+�z
}���|d krMtcj4|!j3��s4d}d}|j/�0|��|d.|zz
}|d-|�d*|�d+�z
}��|dkrKtcj5|!j3��s2d}|j/�0|��|d/|zz
}|d-|�d*|�d+�z
}��otmd0|z��}"toj7tqj9|d
d1��dd
��}#tqj:|#�;����}$tcj4|!j3��r�|jj<d2r~|$|!j=kr*d}|j/�0|��|d3|zz
}d4|"d5<n�tcj4|!j3��r/|$|!j=kr$|d6|zz
}|j�0|����~n<|$|!j=kr1d}|j/�0|��|d7||$|!j=fzz
}d4|"d5<tcj4|!j3��r"||!j>krd}|d8|||!j>fzz
}d9|"d<tcj4|!j3��rSt| |j@��}%|%|�A|��kr%d}|d:||�A|��|%fzz
}d-|"d<|dk�r_|jd;r�t�|jd;t6��r|jd;}&n�	t7|jd;d��}&n�#t:$r�}'	t�jD|!|jd;��}&nU#t.$rH}'|j�E|d<t�|'��zt�jH���=��Yd}'~'nd}'~'wwxYwYd}'~'n;d}'~'wwxYw|d!kr|�I|d��}&n|�I||��}&|&tcjJ|!j3��kr)d}d>|"d?<|d@||&tcjJ|!j3��fzz
}dx}(})	tj|!jK��j}(n#t$t&f$r
|!jK})YnwxYw|dkr$||
ks||krtSdA|�dB|�dC|
�����|(r|(|krd}|d|�dD|(�dE|�dF�z
}dG|"d
<n|)r|)|krd}|d|�dH|)�dI|�dF�z
}dG|"d
<dx}*}+	t)j|!jL��j}*n$#t&t.t0f$r
|!jL}+YnwxYw|dkr(||ks||kr||
vrtSdJ|�dB|�dC|
�����|*r|*|krd}|d|�dK|*�dL|�dF�z
}dM|"d
<n|+r|+|krd}|d|�dN|+�dO|�dF�z
}dM|"d
<|rA||j/vr|j/�0|��|d�+|"���dP|�d+�z
}��i|j/rd}t�||||||�Q��S)RNz-Tz-s�-xr1rTF�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 � )�
unarchivedrbrcrd�cmd�diff)NrCr6r7r=�extendr?r<r]�osrS�platform�system�	getgroups�getuid�getgid�pwd�getpwuid�pw_name�	TypeError�KeyError�grp�getgrgid�gr_name�
ValueError�
OverflowErrorr9�getpwnamra�pw_uidrm�getgrnam�gr_gidr^r_�len�	frozenset�issubsetrrp�ZIP_FILE_MODE_RE�matchr%r�joinr8r	�lstatr>r`�stat�S_ISDIR�st_mode�S_ISREG�S_ISLNK�list�datetime�time�strptime�mktime�	timetupler:�st_mtime�st_sizerr.ru�
isinstancer�_symbolic_mode_to_octal�	fail_jsonr
�	traceback�
format_excrX�S_IMODE�st_uid�st_gidrA),rFr�rbrcrd�old_outr�r�rS�
systemtype�groups�run_uid�run_gid�	run_owner�	run_group�	fut_owner�fut_uid�tpw�	fut_group�fut_gid�tgrre�change�pcs�ztype�permstr�version�ostype�sizer�ftype�
file_umaskr8�st�itemized�	dt_object�	timestamprrUrtr�uidr��gids,                                            r�
is_unarchivedzZipArchive.is_unarchived�s+����	@��(�$�*:�D�$���Q�C�C��(�$��d�h�?�C��=�	1��J�J��x�$�-�/�0�0�0���	+��J�J�t�)�*�*�*��{�.�.�s�3�3���C��������
��7�7��J�J��J�������
�������_�&�&�
�������)�+�+���)�+�+��	 ���W�-�-�5�I�I���8�$�	 �	 �	 ��I�I�I�	 ����	 ���W�-�-�5�I�I���*�m�4�	 �	 �	 ��I�I�I�	 ����#�"�	�G��>�'�"�	�
0��l�4�>�'�#:�;�;�����
0�
0�
0�0��,�s�4�>�'�+B�'C�'C�D�D�C�C��!�8�Z�8�0�0�0��,�w�/�/�C�C�C�0������
0����
��I��j�G�G�
�%�	�	���
�
�
���
�����G�#�"�	�G��>�'�"�	�
0��l�4�>�'�#:�;�;������)�
0�
0�
0�0��,�s�4�>�'�+B�'C�'C�D�D�C�C�� �*�m�<�0�0�0��,�w�/�/�C�C�C�0������
0������I��j�G�G�
�%�	�	���
�
�
���
�����G��&�&�(�(�[	>�[	>�D��F��*�*�T�1�%�%�C��3�x�x�1�}�}���3�q�6�{�{�a���C��A��K�K�2�$5�$5���3�q�6�{�{�b� � ���1�v�a�y��&�&�i��A��q�r�r�
�.C�.C�.L�.L�Z�.X�.X�&����F�1�I�E��!�f�Q�R�R�j�G��!�f�G���V�F��s�1�v�;�;�D��3�q�6�*?�@�@�@�D��t�}�$�$��9�D�@�@����B�x�3����C�<�<��C�Z^�Z^�Z^�`e�`e�`e�f�f�C�����#�������#�������#������7�|�|�q� � ���8�s�?�?�)�G�G���(�(�)�G�G�)�G�"�
�
��*�*�*�,�,�,�,�"�
�
��
��7�|�|�q� � �(8�(>�(>�w�(G�(G� �$�%I�G�%S�T�T�T�
�W�\�\�$�+�x��EZ�/[�/[�/[�\�\�F�
��X�f�%�%�����
�
�
����
�$�$�T�*�*�*��-��4�4����u�u�u�d�d�d�;�;����
������|�|�D�L���$<�$<�|����
�$�$�T�*�*�*��I�D�P�P����u�u�u�d�d�d�;�;�����|�|�D�L���$<�$<�|���"�
��
�$�$�T�*�*�*��Q�TX�X�X����u�u�u�d�d�d�;�;�����|�|�D�L���$<�$<�|����
�$�$�T�*�*�*��L�t�S�S����u�u�u�d�d�d�;�;����N�U�2�3�3�H�
!�)�D�M�#�a�&�/�,R�,R�ST�UV�SV�,W�Y�I���I�$7�$7�$9�$9�:�:�I��|�B�J�'�'�
*��;�%�l�3�*� �2�;�.�.�!%���
�,�,�T�2�2�2��C�d�J�J��&)�������b�j�1�1�!�i�"�+�6M�6M��C�d�J�J���
�,�,�T�2�2�2� �� �B�K�/�/�!%���
�,�,�T�2�2�2��F�$�PY�[]�[f�Ig�g�g��&)�����|�B�J�'�'�
"�D�B�J�,>�,>����=��t�R�Z�@X�X�X��!�����|�B�J�'�'�
&��F�D�$7�8�8���$�+�+�d�+�+�+�+�!�F��S�W[�]a�]h�]h�im�]n�]n�ps�Vt�t�t�C�"%�H�Q�K�
��|�|��>�&�)�G�!�$�.��"8�#�>�>�	|�#�~�f�5���|�#&�t�~�f�'=�q�#A�#A�D�D��(�|�|�|�|�'4�'L�R�QU�Q_�`f�Qg�'h�'h����#-�|�|�|� $�� 5� 5�4�T�I�VW�L�L�EX�dm�dx�dz�dz� 5� {� {� {� {� {� {� {� {�����|�������������|�����c�\�\��1�1�'�1�=�=�D�D��1�1�'�:�F�F�D��4�<��
�3�3�3�3�!�F�"%�H�Q�K��H�D�RV�X\�Xd�eg�eo�Xp�Xp�Kq�q�q�C���E�C�
 ���R�Y�/�/�7�����x�(�
 �
 �
 ��i����
 �����!�|�|��i�!7�!7�7�g�;M�;M�$�n�Z^�Z^�Z^�`i�`i�`i�kt�kt�%u�v�v�v��
"��)�+�+�����VZ�VZ�VZ�\a�\a�\a�cl�cl�cl�m�m��!������
"���������TX�TX�TX�Z]�Z]�Z]�_f�_f�_f�g�g��!������E�C�
 ���R�Y�/�/�7�����j�-�8�
 �
 �
 ��i����
 �����!�|�|��i�!7�!7�7�g�;M�;M�SZ�bh�Sh�Sh�$�n�`d�`d�`d�fo�fo�fo�qz�qz�%{�|�|�|��
"��)�+�+�����X\�X\�X\�^c�^c�^c�en�en�en�o�o��!������
"���������TX�TX�TX�Z]�Z]�Z]�_f�_f�_f�g�g��!�����
>��t�}�,�,��M�(�(��.�.�.��R�W�W�X�%6�%6�%6�%6����=�=����=�	��J�
�z�b�c�s��RV�W�W�W�Ws&�D3�3E	�E	�
E'�'F�F�F8�8
H$�,G0�/H$�0+H�H$�H�H$�#H$�7H:�:
I�I�I>�>K1�,J=�<K1�=+K+�(K1�*K+�+K1�0K1�L�
L�L�U&�&:V$�#V$�c.�.
e9�9 d�e4�
e,�$>e'�"e4�'e,�,e4�4e9�:h�h4�3h4�#k�k#�"k#c��|jdg}|jr|�|j��|�|j��|jr|�dg|jz��|jr|�|j��|�d|jg��|j�	|��\}}}t||||���S)Nz-or~z-d�r�rbrcrd)r4r;r�r`r7r=r?r8r<r]rA)rFr�rbrcrds     r�	unarchivezZipArchive.unarchive�s����}�d�#���9�	"��J�J�t�y�!�!�!��
�
�4�8����
�=�	/��J�J��v��
�-�.�.�.���	+��J�J�t�)�*�*�*��
�
�D�$�+�&�'�'�'��{�.�.�s�3�3���C�������5�5�5�5rc	��g}|jD]X}	t||dt|d�����.#t$r|�|d��Y�UwxYw|r+dd�d�|�����fS|jd|jg}|j	�
|��\}}}|dkrdSdd	|j�d
|��fS)Nr�rFz7Unable to find required '{missing}' binary in the path.z' or ')�missingz-l�TN�	Command "�" could not handle archive: )rD�setattrr
r�r`�formatr�r4r7r<r])rFr��br�rbrcrds       r�can_handle_archivezZipArchive.can_handle_archive�s������	%�	%�A�
%���a��d�L��1��$6�$6�7�7�7�7���
%�
%�
%����q��t�$�$�$�$�$�
%�����	{��S�Z�Z�ck�cp�cp�qx�cy�cy�Z�z�z�z�z��}�d�D�H�-���{�.�.�s�3�3���C��
��7�7��:��u�T�]�]�]�TW�TW�X�X�Xs�*8�%A �A N)r&r'r(rGrXrgru�propertyr|r�r�r�r)rrr+r+.s�������
�
�
�(���7�7�7�$�$�$�.�#&�#&��X�#&�JrX�rX�rX�h	6�6�6�"Y�Y�Y�Y�Yrr+c�B�eZdZd�Zd�Zed���Zd�Zd�Zd�Z	dS)�
TgzArchivec�t�||_||_||_|jd|_||_|jjr)|j�dd|jjz���d�|jjdD��|_	|jjd|_
d|_d|_d|_
g|_dS)	Nr-Tz>remote module (%s) does not support check mode when using gtar)�skippedr�c�8�g|]}|�d����S)r�)�rstrip)�.0rs  r�
<listcomp>z'TgzArchive.__init__.<locals>.<listcomp>�s$��T�T�T�d����S�)�)�T�T�Trr/r0z-z)r7r8r9r:r;r<�
check_mode�	exit_json�_namer=r?r4�tar_type�zipflagr@rEs     rrGzTgzArchive.__init__�s���������"����M�,�/��	�����;�!�	J��K�!�!�$�4t�w{�xC�xI�5I�!�
J�
J�
J�T�T�d�k�6H��6S�T�T�T��
�!�[�/�	�:�����
���
����!#����rc��|jdg}|j�|��\}}}d}|�d��rd}n|�d��rd|vrd}|S)Nz	--version�bsdtarr��tar�GNU�gnu)r4r<r]rq)rFr�rbrcrdrs      r�
_get_tar_typezTgzArchive._get_tar_typeso���}�k�*����0�0��5�5���S�#����>�>�(�#�#�	��H�H�
�^�^�E�
"�
"�	�u��|�|��H��rc
���|jr|jS|jdd|jg}|jr|�|j��|jr|�dg|jz��|jr$|�d�|jD����|�d|jg��|j	r|�|j	��t|j��}|j�||jt||||������\}}}|dkrtd	|z���|���D]�}t!t#j|��d��}|�d
��r
|dd�}d}|jr#|jD]}t)j||��rd
}n�|s'|j�t!|������|jS)Nz--list�-C�--show-transformed-namesc��g|]}d|z��S�z
--exclude=r)�rrs  rrz/TgzArchive.files_in_archive.<locals>.<listcomp>���@�@�@�Q��q�(�@�@�@r�-f��LANG�LC_ALL�LC_MESSAGES�LANGUAGE��cwd�environ_updaterrwr�r�FT)r@r4r8rr`r;r�r=r7r?rr<r]rAr%r^r
�codecs�
escape_decoderqry)	rFr��localerbrcrdrlr{r/s	         rr|zTgzArchive.files_in_archive
s+���!�	*��)�)��}�h��d�k�:���<�	%��J�J�t�|�$�$�$��9�	A��J�J�2�3�d�i�?�@�@�@��=�	B��J�J�@�@�$�-�@�@�@�A�A�A��
�
�D�$�(�#�$�$�$���	+��J�J�t�)�*�*�*�)�$�+�6�6���{�.�.�s���TX�^d�ms�BH�SY�UZ�UZ�UZ�.�[�[���C��
��7�7� �!J�S�!P�Q�Q�Q����(�(�	C�	C�H�!��!5�h�!?�!?��!B�C�C�H�
�"�"�3�'�'�
(�#�A�B�B�<�� �L��}�
�#�}���G���x��9�9��'+����� �
C��&�-�-�i��.A�.A�B�B�B���%�%rc
��|jdd|jg}|jr|�|j��|jr|�dg|jz��|jdr0|�dt|jd��z��|jdr0|�dt|jd��z��|jj	dr|�d	��|j
r$|�d
�|j
D����|�d|jg��|jr|�|j��t|j��}|j�||jt||||����
��\}}}d}|}d}t!j��}|���|���zD�]?}	t&�|	��r�|dkr/|jds"t*�|	��r||	dzz
}|dkr/|jds"t,�|	��r||	dzz
}|jds"t.�|	��r||	dzz
}t0�|	��r||	dzz
}t2�|	��r||	dzz
}t4�|	��r||	dzz
}t6�|	��r||	dzz
}��A|rd}t|||||���S)Nz--diffrrr�--owner=r��--group=r��--keep-newer-filesc��g|]}d|z��Srr)rs  rrz,TgzArchive.is_unarchived.<locals>.<listcomp>CrrrrrTr1rr�rUF)r�rbrcrdr�)r4r8rr`r;r�r9rr<r:r=r7r?rr]rAr�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�r!rbrcrdr�r�r�res
          rr�zTgzArchive.is_unarchived6sk���}�h��d�k�:���<�	%��J�J�t�|�$�$�$��9�	A��J�J�2�3�d�i�?�@�@�@��>�'�"�	D��J�J�z�E�$�.��*A�$B�$B�B�C�C�C��>�'�"�	D��J�J�z�E�$�.��*A�$B�$B�B�C�C�C��;��l�+�	-��J�J�+�,�,�,��=�	B��J�J�@�@�$�-�@�@�@�A�A�A��
�
�D�$�(�#�$�$�$���	+��J�J�t�)�*�*�*�)�$�+�6�6���{�.�.�s���TX�^d�ms�BH�SY�UZ�UZ�UZ�.�[�[���C���
������)�+�+���&�&�(�(�3�>�>�+;�+;�;�	#�	#�D��#�#�D�)�)�
���!�|�|�D�N�7�$;�|�
�@T�@T�UY�@Z�@Z�|��t�d�{�"���!�|�|�D�N�7�$;�|�
�@T�@T�UY�@Z�@Z�|��t�d�{�"���>�&�)�
#�l�.A�.A�$�.G�.G�
#��t�d�{�"���&�&�t�,�,�
#��t�d�{�"���%�%�d�+�+�
#��t�d�{�"���&�&�t�,�,�
#��t�d�{�"���&�&�t�,�,�
#��t�d�{�"����	��J��z�b�c�s��L�L�L�Lrc
�|�|jdd|jg}|jr|�|j��|jr|�dg|jz��|jdr0|�dt|jd��z��|jdr0|�dt|jd��z��|jj	dr|�d	��|j
r$|�d
�|j
D����|�d|jg��|jr|�|j��t|j��}|j�||jt||||����
��\}}}t||||���S)Nz	--extractrrrr#r�r$r�r%c��g|]}d|z��Srr)rs  rrz(TgzArchive.unarchive.<locals>.<listcomp>yrrrrrr�)r4r8rr`r;r�r9rr<r:r=r7r?rr]rA)rFr�r!rbrcrds      rr�zTgzArchive.unarchivels����}�k�4���=���<�	%��J�J�t�|�$�$�$��9�	A��J�J�2�3�d�i�?�@�@�@��>�'�"�	D��J�J�z�E�$�.��*A�$B�$B�B�C�C�C��>�'�"�	D��J�J�z�E�$�.��*A�$B�$B�B�C�C�C��;��l�+�	-��J�J�+�,�,�,��=�	B��J�J�@�@�$�-�@�@�@�A�A�A��
�
�D�$�(�#�$�$�$���	+��J�J�t�)�*�*�*�)�$�+�6�6���{�.�.�s���TX�^d�ms�BH�SY�UZ�UZ�UZ�.�[�[���C�������5�5�5�5rc��	td��|_n8#t$r+	td��|_n#t$rYYdSwxYwYnwxYw|���|_|jdkrdd|j�d|j�d�fS	|jrd	Sn3#t$r&}dd|j�d
t|����fcYd}~Sd}~wwxYwdd|jzfS)N�gtarr)Fz:Unable to find required 'gtar' or 'tar' binary in the pathr
Fr�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
r4r�rrr|r%r
)rFrts  rr�zTgzArchive.can_handle_archive�sR��	[�(��0�0�D�M�M���	[�	[�	[�
[� ,�U� 3� 3��
�
���
[�
[�
[�Z�Z�Z�Z�
[�����
�	[�����*�*�,�,��
��=�E�!�!��5�W[�Wd�Wd�Wd�fj�fs�fs�fs�t�t�t�	f��$�
"�!�z�
"���	f�	f�	f��5�����Xa�bc�Xd�Xd�Xd�e�e�e�e�e�e�e�e�����	f�����f�im�iv�v�v�vsM��
A�7�A�
A�A�A�A�A�	B�
C�B>�8C�>CN)
r&r'r(rGrr�r|r�r�r�r)rrr�r��s�������
$�
$�
$�����)&�)&��X�)&�V4M�4M�4M�l6�6�6�*w�w�w�w�wrr�c���eZdZ�fd�Z�xZS)�
TarArchivec�l��tt|���||||��d|_dS)Nr1)�superr5rGr�rFr7r8r9r<�	__class__s     �rrGzTarArchive.__init__�s2���
�j�$���(�(��f�i��H�H�H�����r�r&r'r(rG�
__classcell__�r9s@rr5r5�s8���������������rr5c���eZdZ�fd�Z�xZS)�TarBzipArchivec�l��tt|���||||��d|_dS)Nz-j)r7r>rGrr8s     �rrGzTarBzipArchive.__init__�s2���
�n�d�#�#�,�,�S�&�)�V�L�L�L�����rr:r<s@rr>r>��8���������������rr>c���eZdZ�fd�Z�xZS)�TarXzArchivec�l��tt|���||||��d|_dS)Nz-J)r7rBrGrr8s     �rrGzTarXzArchive.__init__�s2���
�l�D�!�!�*�*�3��	�6�J�J�J�����rr:r<s@rrBrB�r@rrBc���eZdZ�fd�Z�xZS)�TarZstdArchivec�l��tt|���||||��d|_dS)Nz--use-compress-program=zstd)r7rErGrr8s     �rrGzTarZstdArchive.__init__�s4���
�n�d�#�#�,�,�S�&�)�V�L�L�L�5����rr:r<s@rrErE�s8�������5�5�5�5�5�5�5�5�5rrEc�(��eZdZ�fd�Z�fd�Z�xZS)�ZipZArchivec�z��tt|���||||��d|_d|_dS)Nz-Z)r2)r3r6)r7rHrGrCrDr8s     �rrGzZipZArchive.__init__�s<���
�k�4� � �)�)�#�v�y�&�I�I�I����
��
�
�
rc���tt|�����\}}|s||fS|j|jg}|j�|��\}}}d|���vrdSdd|zfS)Nr5r�Fz/Command "unzip -Z" could not handle archive: %s)r7rHr�r6rCr<r]rp)rF�unzip_available�	error_msgr�rbrcrdr9s       �rr�zZipZArchive.can_handle_archive�s����%*�;��%=�%=�%P�%P�%R�%R�"����	.�"�I�-�-��$�d�&6�7���{�.�.�s�3�3���C����	�	���#�#��:��G�#�M�M�Mr)r&r'r(rGr�r;r<s@rrHrH�sZ�������
�
�
�
�
�N�N�N�N�N�N�N�N�NrrHc�f�tttttt
tg}t��}|D]B}|||||��}|���\}}	|r|cS|�	|	���Cd�
|��}
|�d|�d|
�����dS)Nr�zFailed to find handler for "zD". Make sure the required command to extract the file is installed.
�r�)r+rHr�r5r>rBrE�setr��addr�r�)r7�destr9r<�handlers�reasons�handler�obj�
can_handle�reason�
reason_msgs           r�pick_handlerrY�s����K��Z��Q]�_m�n�H��e�e�G������g�c�4��F�3�3��"�5�5�7�7���V��	��J�J�J����F��������7�#�#�J�
����EH�EH�EH�JT�JT�U��V�V�V�V�Vrc�2
�tttdd���tdd���tdd���td���tdd���tdd���tdd	g�
��tdd	g�
��tdd	g�
��tdd���tdd���tdd���tdd����
�
�
dddg���}|jd}|jd}t|d���}|jd}|�|j��}t
j�|��sJ|s|�d|z���n.d|vrt||��}n|�d|z���tj
|t
j��s|�d|z���	t
j�|��dkr|�d|z���n@#t$r3}|�d|�dt|�������Yd}~nd}~wwxYwt
j�|��s|�d|z���t!||||��}t|jj||���}|���}	|jr
|	d |d!<nx|	d rd|d!<nj	|���|d"<|d"d#dkr|jd.d$d%|�d&|��i|��d|d!<n%#t,$r|jd.d$d%|�d&|��i|��YnwxYw|	�d'd��r
d(|	d'i|d'<|�d'd���rN|j�sFg}
|jD]�}t
j�|t|d�����|d<	|�||d!d�)��|d!<n=#t,t6f$r)}|jd.d$d*t|��zi|��Yd}~nd}~wwxYwd+|vr4|�d+��d}||
vr|
�|����|
rn|
D]k}
|�d+|
��|d<	|�||d!d�)��|d!<�/#t,t6f$r)}|jd.d$d*t|��zi|��Yd}~�dd}~wwxYw|jd,r
|j|d-<|jd.i|��dS)/NrT)�type�required�boolF)r[�default)r[r��str)r[�elementsr^rai)
r7rQ�
remote_src�creates�
list_filesr�r/r0r-�validate_certsr.�copy�decrypt)r0r/)�
argument_spec�add_file_common_args�supports_check_mode�mutually_exclusiver7rQr�r�razSource '%s' failed to transferrNz://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)rTrQr7r��changed�extract_resultsrbr�zfailed to unpack r�r��prepared)�expandz1Unexpected error when accessing exploded file: %sr�rc�filesr))rrAr:r	�load_file_common_argumentsr�r�existsr�r�access�R_OK�getsizermr
�isdirrYr9r&r�rr��IOError�getr|r��set_fs_attributes_if_different�OSErrorr_r`r)r<r7rQr8rar9rtrT�res_args�
check_results�top_foldersrl�top_folder_pathrs              r�mainr~�s���
���&�4�0�0�0��6�D�1�1�1����7�7�7��f�%�%�%����7�7�7����7�7�7��f�u�b�A�A�A��f�u�b�A�A�A���%��D�D�D��V�T�:�:�:��U�I�>�>�>�
�6�4�0�0�0��f�d�3�3�3�#
�
�
�&"� �2�3�1���F�6�-��
�C��=�� �D�
�d�#8�
9�
9�
9�F���|�,�J��1�1�&�-�@�@�I��7�>�>�#���E��	E����!A�C�!G��H�H�H�H�
�c�\�\��V�S�)�)�C�C����!=��!C��D�D�D�
�9�S�"�'�"�"�?����7�#�=��>�>�>�S�
�7�?�?�3���1�$�$����!L�s�!R��S�S�S����S�S�S�����s�s�s�I�a�L�L�L�Q��R�R�R�R�R�R�R�R�����S�����7�=�=�� � �K����B�T�I��J�J�J��3��	�6�:�:�G��G�-�6�T�s�K�K�K�H��)�)�+�+�M�
��
'�"/��"=�=�����	�|�	$�'�#�����	'�*1�*;�*;�*=�*=�H�&�'��)�*�4�0�A�5�5� �� �[�[�[�C�C�C���%N�[�RZ�[�[�[�#'�H�Y�����	X�	X�	X��F��W�W�W����T�T�!J�W�h�W�W�W�W�W�	X���������'�'�?�&�
�f�(=�>�����|�|�F�D�!�!�y�&�*;�y����0�	8�	8�H� "����V�X�h�Od�5e�5e�5e� f� f�I�f��
u�&,�&K�&K�I�W_�`i�Wj�sx�&K�&y�&y���#�#���W�%�
u�
u�
u� �� �t�t�%X�[d�ef�[g�[g�%g�t�ks�t�t�t�t�t�t�t�t�����
u�����h���"*�.�.��"5�"5�a�"8��"�+�5�5��&�&��7�7�7���	y� �
y�
y��/3�t�t�Q�Q�$7�	�&�!�y�*0�*O�*O�PY�[c�dm�[n�w|�*O�*}�*}�H�Y�'�'����)�y�y�y�$�F�$�x�x�)\�_h�ij�_k�_k�)k�x�ow�x�x�x�x�x�x�x�x�����y�����}�\�"�5�#�4�����F�� � �x� � � � � sZ�(<H%�%
I"�/)I�I"�>M�M(�'M(�+!P
�
Q�Q�Q�!R6�6S0�S+�+S0�__main__)C�
__future__rrrr[�
__metaclass__�
DOCUMENTATION�EXAMPLES�RETURNrrr�ryr�r�r�r�r r�r�r��	functoolsr�zipfilerr�ansible.module_utils._textr	r
r�ansible.module_utils.basicr�#ansible.module_utils.common.processr
�"ansible.module_utils.common.localer�ansible.module_utils.urlsr�shlexr�ImportError�pipes�compiler)r*r+r,r'r-r�r.r/rr#rmr%�objectr+r�r5r>rBrErHrYr~r&r)rr�<module>r�s��A�@�@�@�@�@�@�@�@�@��
�L�
�\��6:
��x����
�
�
�
���������
�
�
�
�	�	�	�	�����
�
�
�
�	�	�	�	�������������������'�'�'�'�'�'�'�'�C�C�C�C�C�C�C�C�C�C�4�4�4�4�4�4�<�<�<�<�<�<�G�G�G�G�G�G�0�0�0�0�0�0��������������������������
��
�,�-�-�
���
�,�-�-�
��r�z�,�-�-���2�:�4�5�5����
�R�S�S�
��"�*�R�S�S���2�:�6�7�7���2�:�0�1�1���2�:�0�1�1�����7�7�7�
	�	�	�	�	�Y�	�	�	�~Y�~Y�~Y�~Y�~Y��~Y�~Y�~Y�Biw�iw�iw�iw�iw��iw�iw�iw�Z��������������Z���������:����	5�	5�	5�	5�	5�Z�	5�	5�	5�N�N�N�N�N�*�N�N�N�0
V�
V�
V�t!�t!�t!�n�z����D�F�F�F�F�F��s�4A;�;B	�B	

Youez - 2016 - github.com/yon3zu
LinuXploit