����C %# , #&')*)-0-(0%()(��C (((((((((((((((((((((((((((((((((((((((((((((((((((����"�������@�@�hC��}!���Ѱ��<"� 9iׂIIIHk�+?�c?��*Y�����!�du)b�T�9вU�$8G��I.�澬��D���Sq� q�}.<��Z�l�V!X� *x�-�\����t3i�Ũ�sNv71�ƛ\��z|t�L���$�����*f��kʮ��7�H;���~F%�'3�@�H�q�` 9mOL����/x@ @��G
d�8F�ه��Ka�Kdr�Fh.�]y4 JЛ��]�K�B�E$��$ $ �PR�����G�]��u�i$�$���'! "#031���C/Td=S�Q?���62Ccj{ ����̏d�چ/c�V�`��Wz͈�{Y`�d�h�L �]OB���l���o���mr���n��s-ڗEZ��N�_��1%b���H�ϣ������V�7):�ӷ)�}�~�(�;�!�b1�5K��[E�vϻ>��q.%� ���O���(�c�#x�$�'+��`٥v��v(�����M�"�v��B��.�a ���T�~�ϕ�hy(6nݱl��1yNɓx�������AR�8�rqv1.cS�+��_���&@�� �u�M�5Ĉ�Xm���eL�X�q��y#�9]�c�}ɄL��d�eJ몓���I1T�d��CaM�$��T�,�X �bʭ�!�%F5��X1x#���!�q��\��F��2��&Rq���C�ol~�̱�.0ϦL�d�`.������ ���m{�Y~k{C��}bv�;U��c<�r�~ɜs�1�j��]W�l��*նCr��Q�N9�-������d��E؛��nF��eړ�8(q��5UgRȱGTA��*������̆��V�珰����ezN��h�U]�T�FG�^���<��ay�,!���5.� �u�bΚ�V�J%��m�Dxn'�����6�@BPa�`��Hts� �ɮ���Ŏ�Zɬ��%B�X��d5Z���hC}�䅸�p+ k=��ʒ(�aՏFG&�%@/�{+�Yu+�ȣGѩ"O%�|vȲxF>�N(��ou�h6 &Y5��8�7�E$-��']n,@TD\��+���Ry�U��U^�Q,f>��1�����q��f��U��� ����F���ڥ��>I�����fNUw�u��#OMMQ6� N�*��_�� k� ����rS��`���1�:��!�F'<+� � b?O��2 !Q12A��� "3a������#$��?�,�7�!`yǮ(�1�6w��a���� �F�#��?*"s���v>��Ⱥ����f�v��͑���s����������]Gn��S ���ȥpG ы�E�g�)Z���x�rY�q�]�@f�_܃�pչEڎّC ����Ŝ*/ �h�O�Sv�و\��5��U��y��|o�Hm2C�S�BW����)��5��{T��W���=o*RA��<����L0g4{��쁢�ep�rw�8��7��U���t<Ԍѻ7�fGf�k}���Ê�㛆Gռz�Q@��{C��'G��8�!�S$�j��x���|���צV<��,����u�k�uu�rM�f�_dϣi ߫�ԟn�!K����mxu�=�槻�'j�X�����������%!A "1QR#Br��?�R:��R�n�b[�II?#��6<:�$gN����lGNlrr��dעMMn`ɿy�,�%B�e�W��dVS��r���� %�tT��(�ɷ��S�]�O]#�_LEMHN�M���kv���~X���O6�U�V_�����b���J�t�774����D!1AQa"2q�#3BRb����0���� 4CSr����cst�����?��^q���7�dG�U�"p��moz��'��n_x���唹e������<6��O�t���R>k��s=�Cr���e�?�i��� ����/��ں$be���o`ޮ�GHy�;fNAl�8��.�\�S������"���a�úF�YvNk�-*`v�k�ʈ2f�EE��Wa�,� �fF^#�;��[9��^~������Y$:0#W3������Z*���I�Z�ڹ�k�n--9=��G��;7F)m{T�Ɇ��=�����Ȭ5�5�B�aڞ5M����#m�5Ʀ��m�8��+Hh���$�}�:&�e�Q�[;i]С�:�:��o����$<~��5RB�?�s3�5�r��O��ֿ�w�P/��̅���(�Z6�R>)��N��4�!ʊ�wz�-�r�w+�yk���q�1�bKhƸ�4N�Ӑ�X����Q��_��})�+e1�5��n��q?��[�^�9�<�z3Fsi�8�'�)9p)�{��RP�Z+�*��p(aY��V����6l�g�9��;���d�u���Nt@�3�sTwzaŇ�GT�b�H��(#��*zc�������9K�b1�����t����Ê��
�Z?g�iD���H�R���B���^M����v���O���L�D,'d�q�C�P�����$Δ��U�֟֊=�s��F�$��J�ދZ?�N��������A�N�WP��,�� �¦�&;�x��dup�����i���Ipd���;�Dž!��ֿѮAb%�u��}j��-p��>I�[�N�bi����G�'�;4w�m]H�]����#LӘNN��R��������s�.]��en��-�8e��Ps����Q��;���ț�E�ݫ���7��g�_L��W��EZ:/��I���a�g�n�ܤ��iٹ���ŷ�T���H~i�a�����֎�~KV������ A-2m]�F"�m�9-Zbǰ�״ @����~�4�N�[�Uxč�tl>������u#r�gѐ�3���;M9�<�J�����1�vfL8����1�P�HgP�Xv��������{����O�}�n��KQ؋����7<�l�fey<�}�>�bX���4<`Y7���si��V)�s�:�{�rO�h�z �@4VW�B���&�������ɡob܋�F��4>y�s�fXWS�N�O$�,.u:�ԫ��g�yao4��$h��D#��ٸf^kh�7�#1Z�֥&���*�v-��;bޭ����Q�����h�ow�y]�ه.+�7�M�ⴻ �JY��g�f�i3q��KC��3�¹�?5�Z.N��^Z w���KF͂���7��ރ۞��wj��T�J.�q��\Sv1U����R��욽&�N����pЖ`�`у��m`v�n#z��4��>e��V�`'���h�����'�j�AҔ�-�4:H���n]9�h<��n����U�6m��2c�E�1/�Y�%���I��~ʏ�|VBƟ@����;�������%�M9M���}��1�D��d����%g���O��]��у&�r��f�7�uܲ���(!1AQaq�������0� ���?!��*��@)�Je�G��j��{�['��v+���������)���(�/����д%젍Z��kk�Lu�Rm���j.c���@Z� V�J��d��j���h6���2AO�� a;oBu���H�=���nK�W8�B�ɰ�u?��бأm,�sr����|����8˨i��qI2tZ�ۄJP��XE��������zޔj~]UMu����zv!����N�&�1�Y��zJ�ՠ��\p��o'ሸ�C؊Y��TD"HM5�Ъ��i߯a���F����A)�����ڮ����z�E���@�hg�֝8�1jk��\�M�3�8ܢ�� ������s�7����N}�ޭ������GN�Bc���L pk�;�J�δ3�e�iU�gAYW]\�>�GyگQ=��f�KA;T�a`eM+Q �� �Ln���̌]GM�����<Ħ�j���H��N�M�x�}aX{̣S� ��ԅ��n�MA�S�r�(����(�L��zo9���.�;
�ӳf������`Ӕ٢3�� IW��\9~_���saa�\ԊW�ܭX:���ӆ�38�ty*����N�qP����BI�Y��jE��>DP�!�R%-��4��'�皺;��~J�!�7m���X��h�P!曭���$�\�AYj�.lC��4��+�jD�dgC0-*���|��`ZD�+л�C"��)��s��8Kq�pq���Ms��4� ��7\U`�.��[Ey8��AH!/��,���(:M -�T䓥�~O�4-���Ԓn��}HDN7���K���$�_Ԕ䚞`�R�hB�_aX?4V��ŗ�@ه�u�a�;�{PcT+�������7YBo�?��r-ͩ{�ĎA�� ����˼n��M286��G���1���V�˜Jв"l��V5���5�C]h���̊�A���%� �'p���Ԃ���Ր��9=�d�=�e�{�'<3�_ �:^�~��4�(�n�-C�s��5m![�jmIqU�~�Tw8��`���p�H8�u�Д l m�aP�0�������9y����CM��F1G糞�.�U~�������FC�{�!e(Y�:���P����7~;�L�N^{�1r�\���ԬG(���0d�ÏO�qK�Z�⑼�T�{ 2��s��Kd�Տ?mMQ��=���6�7�i�����H+����9��d��=��;�QؤH8n�Lb�D��yS%�(�{b���Cu���p�t#C���$A"�H{���jqᶯ�:�n=E����hH�`�!�m��MA������?�v6���+MԿ⟚qK�i�D�*Q5��CZ���2�|]�:Xd+�t�:o@��M��� :�32��b����[\5=�ֵ7])�|t��Ϻ����w�B�ń�e���!`�:��I,��9:����j@/a 8����+<�u�(T^ۺ~��2oE�B�%b)��z��ݳځ�)��i�j��&��Fi`qr��w���7�@��P�� �3Z&<�m�S�C����7t�T����ƴ�q~J�e�r6�Z]�rL���ه�E17'�x���+[�ܜTc6�/�����W�`�qpMJ���N5^����x�}{l�Fm������1�oZ\�����/d�/6� �uӸ�0elXuX;M��$M�}mB��������Z%e���3f�js����O�J~2�z�86�*PB��v�Ν��e-��.�/��L�O����2����9���4}|��T5M���hÐ7�F*��l+y0����:|��=k[�d�;|�ԉe�=w�<��õ�<��'!1AQaq����� ������?��5����)�(���+>v����6&{���Ǹ@����M�����v��iA 6T'�w��h�s �E}�x��G&'g�� J~1q�f�f���&��q˘���-���vYm
�/i1 �I��6��u,)�#�,����l}*&`�$�ͬe�%�w3�x�Ѥ�Xc�D��执g�峕�5B/�|$��=���%8 a��2.l� c�@G� �\�/x[өq�]�v5?�����N|�!���\��,>��{�"r�/��?��&!1QAa�� ��ᑱ����?ĊD�肭�� nv@�yޝ (�����I ����U - ���b�m�E>,��1v!�d�&�� ���&�檔�5D�&0P��Ԕ�͒@Z��:E"� Q��`>PH:~�O�����P�3W��@hM��k�U��\�O��R�������5ʄ�,��f�|��r���}јxo)�"+h�QK���/��0�`�5�{M~�� ���'!1AQaq���0 �������?�?�k��#^�~�G��#V,������#Z�1'ܤ����������~p�O%O�O�\�q�`�~��}��E�Ű5 �輸�du����x\�$���s[�{T2t`B��gq�4Z]b� 㛪�3,(@����bAp�r)9:@|b�!r�g:N�^�Ʌ��� �x_�\��pm7I��0?>^k��������w���|.K�[sF@�]Gn*L �yO� le�P�.p��֍�j�S�=�ʨ�ןQF�"��5zʼn���k�*8�u" ����Fg��� �cSy�V������Ƈ��N��ؐ(�����48hV�A�ӎ^��^ ���jyB� ��p"�����y]�ļlU�(�7�U`3�pCGF'&yg������o��z������X��ν:�P"@�G@x[��o&MJ�$F.����hi w;}�/^͇q���n�mN�/�TQ���އ��O1\,}��bQ #¯^S!)��X���#GPȏ�t�� c^\��' }iIZ���a�)��������z��4͊�Ξy��48,��f���#�����KP!Jx�|w�ʆ�������������#��Z�������< �~K��r�p&qH/;�R���沽�+�E�R���~0v���V#ʀ�T��S(-ڝ��B�y�b�C�D������b��������8��~�= �Y�ͧ]��@n����M�k2�%�;�%,�r6�LR腻?^��;KŇ=�ք ���=`�ɥ��/����z�&�I{���#J��M���C��}�H9^UJ�,P ��pS����G�d69Ϭu���%"��ˢP��K�"k)��=��9� ����㇌,��Oli��Xzh� " � ������R��^�s����N�k��Q>�63(���� ��PQ�Py�����3����$f+W՛=4�ǁ`*��^��Eb�K�t�6��^��!�籷��ȭ��K{/;�L���p�x�����;a���Oلz�[�.NP4�]Gc�T�v����~sg'LED��]j��'�G�]�6rY����UPw�*O�İՋi�'8�۴�#g�Xx+=�eU6�R��c�"�u2��~�?n�y�;�u��3�'��6�f������b��߬M�$*��k&?6���*^1n����ێz)<��Gz� �����7����Y� ��ۃ)$A��2�L6� ե�H�<�r��#ʽ2��O��R���z�A��XW��@���������<�G� Ϥ�^�˓i�M�W���6 ��0��m){c�;ݧ�>R�a����}1�ٯ%�EY2�Q��Ep���$ ��E��qS��t#+x� *�h�UI��XM?�'//��a'�G�����q@���<��z��؟����cd��z�ˬT_u�Ѯ����&�z�k ��n ]�a%�py»�`Qd�xc������n�� ��*��oTd�;'j�<�!j���'�(~�ʹW�M� P�mȘ��@֨V+��R�`�$��`�+@��_[�kG����P���Zh9�R����&5b�v���Z���#p�&�Ա+��8�etZ7G���;��@"�e0���v7����?��z�?_���_�q1�T�"�p�ˎ/U 6_�B�>��0( ��}G#������Ȣ�p�� �9��;/& `�B&$�y��t(�*z�x���Ӕ������S�?Kȏ3���{p� b � ۍ-�z܈֦��6?<���ǬP�N�G �更� �6�/h�����0Z���������i�ua��e�*M'A� �x��v�q.>�F� oN{��Q���{gD��L��u��=|���O xN���d���q�8(��E�Uu��,��O� t�DJ ����;��G����e���C��VYZ�� ���T4{����(�Ӳ'c�t�f��w�c�jr�e�m �#7,�6��B�E4Q�P�.P�(&��^{9H-�m�o ��q�g1���=��>p�)/"p0!4�mS6ú�FN���h��D �)��XdT �FؤZ⸚�k���H�c8v� <���u�P�Հ���:��_�EN��|�ӛ��u?-�/�o�Lhk�ܸ�S�;�Rī�����T"�N����M��px7<�� j�$��`�Y)Pjh 5` K�Qf�4�C�bX"�D���;HD�Z�9R b�F)�UA����v�#��HD�!{������>I� �`�ԁ i�4�)t*�ç�Le�_���>ru�GEQg��ǔct��ō0��l6v���d�� ��GG8���v^�|�#JyZPSO�� Y�CuAߐ�"�x���OfHF@�K�V�!少Eҕ]h� ��[���)��.q����*0I<8��^�6�}p��^tho���ig�i����DK���p,��2�3�I��5����쓄OY�6s7Qs�Ow^�w�J/�A➰������0������g(Մ��y��Kԇ����QS��?H���w�X�=��ҞX�~���Q=�'���p?7�@g�~�G�}�r��g�T?���
One Hat Cyber Team
star
One Hat Cyber Team
star
Your IP :
3.138.37.173
Server IP :
50.6.170.23
Server :
Linux 50-6-170-23.bluehost.com 5.14.0-503.35.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 4 05:23:43 EDT 2025 x86_64
Server Software :
Apache
PHP Version :
8.2.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
lib
/
python3.9
/
site-packages
/
sos
/
__pycache__
/
View File Name :
archive.cpython-39.opt-1.pyc
a ����-�_gr����������������������@���s����d�dl�Z�d�dlZd�dlZd�dlZd�dlZd�dlZd�dlZd�dlZd�dlmZ�d�dl m Z �d�dlmZ�d�dl mZ�zd�dlZW�n�ey����Y�n0�dZdZdZd ZG�d d��d�ZG�dd ��d e�ZG�dd��de�ZdS�)�����N)�datetime)�Lock)� find_spec)�sos_get_command_output�file�linkZnode�dirc�������������������@���s����e�Zd�ZdZedd���Ze�d�ZdZ dZ e��Zdd��Z d d ��Zdd��Zd d��Zdd��Zdd��Zdd��Zd-dd�Zd.dd�Zdd��Zdd��Zdd ��Zd!d"��Zd#d$��Zd%d&��Zd'd(��Zd)d*��Zd+d,��ZdS�)/�Archivez!Abstract base class for archives.c�����������������C���s���|�j�S�)z6Returns the archive class's name as a string. )�__name__)�cls��r����//usr/lib/python3.9/site-packages/sos/archive.py�archive_type+���s����zArchive.archive_typeZsosZunsetFc�����������������C���s���d|�������d|���S�)Nz [archive:z] )r�����self�msgr���r���r ����_format_msg8���s����zArchive._format_msgc�����������������C���s ���||�_�d�S��N)�_debug)r����debugr���r���r ���� set_debug;���s����zArchive.set_debugc�����������������C���s���|�j��|��|���d�S�r���)�log�errorr���r���r���r���r ���� log_error>���s����zArchive.log_errorc�����������������C���s���|�j��|��|���d�S�r���)r���Zwarningr���r���r���r���r ����log_warnA���s����zArchive.log_warnc�����������������C���s���|�j��|��|���d�S�r���)r����infor���r���r���r���r ����log_infoD���s����zArchive.log_infoc�����������������C���s ���|�j�s d�S�|�j�|��|���d�S�r���)r���r���r���r���r���r���r���r ���� log_debugG���s����zArchive.log_debugc�����������������C���s���|�j�S�r���)�_name�r���r���r���r ����nameL���s����zArchive.nameNc�����������������C���s���t��d�S�r�����NotImplementedError)r����src�dest�forcer���r���r ����add_fileR���s����zArchive.add_file�wc�����������������C���s���t��d�S�r���r!���)r����contentr$����moder���r���r ���� add_stringU���s����zArchive.add_stringc�����������������C���s���t��d�S�r���r!���)r���r(���r$���r���r���r ���� add_binaryX���s����zArchive.add_binaryc�����������������C���s���t��d�S�r���r!���)r����source� link_namer���r���r ����add_link[���s����zArchive.add_linkc�����������������C���s���t��d�S�r���r!����r����pathr���r���r ����add_dir^���s����zArchive.add_dirc�����������������C���s���t��d�S�r���r!���)r���r0���r)����devicer���r���r ����add_nodea���s����zArchive.add_nodec�����������������C���s���t��dS�)z�Return a temporary directory that clients of the archive may use to write content to. The content of the path is guaranteed to be included in the generated archive.Nr!���r���r���r���r ����get_tmp_dird���s����zArchive.get_tmp_dirc�����������������C���s���t��dS�)z�Return the maximum file name length this archive can support. This is the lesser of the name length limit of the archive format and any temporary file system based cache.Nr!���r���r���r���r ����name_maxj���s����zArchive.name_maxc�����������������C���s���t��dS�)aT��Return a string representing the path to the temporary archive. For archive classes that implement in-line handling this will be the archive file itself. Archives that use a directory based cache prior to packaging should return the path to the temporary directory where the report content is locatedNr!���r���r���r���r ����get_archive_pathp���s����zArchive.get_archive_pathc�����������������C���s���t��dS�)z:Clean up any temporary resources used by an Archive class.Nr!���r���r���r���r ����cleanupy���s����zArchive.cleanupc�����������������C���s���t��dS�)a��Finalize an archive object via method. This may involve creating An archive that is subsequently compressed or simply closing an archive that supports in-line handling. If method is automatic then the following methods are tried in order: xz, gzipNr!����r����methodr���r���r ����finalize}���s����zArchive.finalize)NF)r'���)r ���� __module__�__qualname__�__doc__�classmethodr����loggingZ getLoggerr���r���r���r���� _path_lockr���r���r���r���r���r���r ���r&���r*���r+���r.���r1���r3���r4���r5���r6���r7���r:���r���r���r���r ���r ���(���s2��� r ���c�������������������@���s����e�Zd�ZdZdZdZdZd7dd�Zdd��Zdd ��Z d8dd�Z d9dd�Zdd��Zd:dd�Z d;dd�Zdd��Zdd��Zdd��Zdd��Zdd ��Zd!d"��Zd#d$��Zd<d%d&�Zd'd(��Zd)d*��Zd+d,��Zd-d.��Zd/d0��Zd1d2��Zd3d4��Zd5d6��ZdS�)=�FileCacheArchivezd Abstract superclass for archive types that use a temporary cache directory in the file system. ��Nc�����������������C���s����||�_�tj�|�j�|g�|kr,tj�||�|�_�||�_||�_||�_||�_|pJd|�_ ||�_ tj�||�|�_|�j ��t�|�jd��W�d�����n1�s�0����Y��|��d|�j��d���d�S�)N�/���z'initialised empty FileCacheArchive at '�')r����osr0����commonprefix�relpath�_tmp_dirZ_policyZ_threads�enc_opts�sysroot�manifest�join� _archive_rootr@����makedirsr����r���r ���ZtmpdirZpolicy�threadsrJ���rK���rL���r���r���r ����__init__����s���� ,�zFileCacheArchive.__init__c�����������������C���s(���t�j�|�r|�t�j�}t�j�|�j|�S�r���)rF���r0����isabs�lstrip�seprM���rN���)r���r ���r���r���r ���� dest_path����s����zFileCacheArchive.dest_pathc�����������������C���s@���|�j�r|�|�j��r|S�|d�tjkr0|dd���}tj�|�j�|�S�)Nr�������)rK���� startswithrF���rU���r0���rM���r/���r���r���r ����join_sysroot����s ����zFileCacheArchive.join_sysrootrD���c��������������������s���|���d|�����|�j��|}��fdd�}|�d�s6|}n&tj�|��|��rL|ntj�|�d�}|}g�}|dvr�tj�|�\}} |�| ��|}qd|� �����} d}|D��]}tj� | |�} || �s�q�tj� ||�}tj�| �s�|���d| �����tj�|��r�tj�|��r�t� |�} tj�|�d�}tj� || �}|�j||d�}tj�|�}tj�| ��rbtj�| |�} |���d | ��d | ��d���t�| | ��q�|���d| �����t�| |��|}q�|S�) a���Create leading path components The standard python `os.makedirs` is insufficient for our needs: it will only create directories, and ignores the fact that some path components may be symbolic links. :param src: The source path in the host file system for which leading components should be created, or the path to an sos_* virtual directory inside the archive. Host paths must be absolute (initial '/'), and sos_* directory paths must be a path relative to the root of the archive. :param mode: An optional mode to be used when creating path components. :returns: A rewritten destination path in the case that one or more symbolic links in intermediate components of the path have altered the path destination. zMaking leading paths for c��������������������s���|���tj���d��S�)z>Test whether path ``path`` is inside the archive. rB���)rX���rF���r0���rM���)r0�����rootr���r ���� in_archive����s����z8FileCacheArchive._make_leading_paths.<locals>.in_archiverC���r���)rC���rB���zMaking path �r)���zMaking symlink '�' -> 'rE���zMaking directory )r���rN���rX���rF���r0����isdirrY����split�append�reverserM����exists�islink�readlink�_make_leading_paths�normpathrS���rH����symlink�mkdir)r���r#���r)���r$���r\����src_dirr0���Z path_comps�head�tailZabs_pathZsrc_path�comp�targetZ target_dirZ target_srcr���rZ���r ���rf�������sR���� � � z$FileCacheArchive._make_leading_pathsFc����������� ������C���s\��|p|���|�}|tkr|}ntj�|�d�}|s4|S�tj�|�r\tj�|�s\td|��d���tj�|�s�|tkrt|ntj�|�d�}|��|��dd��}|r�|S�tj�|��rXt� |�}d} |t kr�t�|j �s�t| |df���|tk�rt�|j ��st| |df���|tk�r,||j ��s,t| |d f���|tk�rTt�|j ��sTt| |d f���dS�|S�)a4��Check a new destination path in the archive. Since it is possible for multiple plugins to collect the same paths, and since plugins can now run concurrently, it is possible for two threads to race in archive methods: historically the archive class only needed to test for the actual presence of a path, since it was impossible for another `Archive` client to enter the class while another method invocation was being dispatched. Deal with this by implementing a locking scheme for operations that modify the path structure of the archive, and by testing explicitly for conflicts with any existing content at the specified destination path. It is not an error to attempt to create a path that already exists in the archive so long as the type of the object to be added matches the type of object already found at the path. It is an error to attempt to re-create an existing path with a different path type (for example, creating a symbolic link at a path already occupied by a regular file). :param src: the source path to be copied to the archive :param path_type: the type of object to be copied :param dest: an optional destination path :param force: force file creation even if the path exists :returns: An absolute destination path if the path should be copied now or `None` otherwise r���zpath 'z' exists and is not a directoryc�����������������S���s(���t�t�|��t�|��t�|��t�|��g�S�r���)�any�stat�S_ISBLK�S_ISCHR�S_ISFIFO�S_ISSOCKr]���r���r���r ���� is_special7��s�����z/FileCacheArchive.check_path.<locals>.is_specialz path '%s' exists and is not a %szregular filez symbolic linkzspecial fileZ directoryN)rV����P_DIRrF���r0���r`���rc���r_���� ValueErrorrf����lstat�P_FILErp����S_ISREG�st_mode�P_LINK�S_ISLNK�P_NODE�S_ISDIR) r���r#���� path_typer$���r%����dest_dirrj���ru����stZve_msgr���r���r ���� check_path��s6���� zFileCacheArchive.check_pathc�������������� ���C���s����zdt��|�}|�d�s |�d�rDt�||��t�j||j|jfd��nt�||��t�� ||j |j��W�n<�ty��}�z$|�� d|��d|��d���W�Y�d�}~n d�}~0�0�d�S�)N�/sys/�/proc/)�nszcaught 'z' setting attributes of 'rE���)rF���rp���rX����shutil�copymode�utime�st_atime_ns�st_mtime_ns�copystat�chown�st_uid�st_gid� Exceptionr���)r���r#���r$����_stat�er���r���r ����_copy_attributesS��s���� z!FileCacheArchive._copy_attributesc�����������������C���sP��|�j���2�|s|}|�j|t|d�}|s6W�d�����d�S�t|dd��s�zt�||��W�nR�ty��}�z:|�d�s�|�d�rxn|��d|��d|��d���W�Y�d�}~n d�}~0�0�|�� ||��d|��d�}nR|� d��t|d d d��$}|D�]}|�|��q�W�d�����n1��s0����Y��d}|�� d |��d|�j��d���W�d�����n1��sB0����Y��d�S�)N�r%����readr����r����zFile z not collected: 'rE���r���r'����utf-8��encodingz open filezadded z to FileCacheArchive ')r@���r����ry����getattrr�����copy�OSErrorrX���r���r�����seek�open�writer���rN���)r���r#���r$���r%���r����� file_name�f�liner���r���r ���r&���`��s.���� . ,�zFileCacheArchive.add_filer'���c�������������� ���C���s����|�j����|}|�j|tdd�}tj||dd��b}t|t�rD|�dd�}|�|��t j �|�rf|��||��|�� d|��d|�j��d ���W�d�����n1�s�0����Y��W�d�����n1�s�0����Y��d�S�) NTr����r����r�����utf8�ignorezadded string at 'z' to FileCacheArchive 'rE���)r@���r����ry����codecsr����� isinstance�bytes�decoder����rF���r0���rc���r����r���rN���)r���r(���r$���r)���r#���r����r���r���r ���r*������s���� �zFileCacheArchive.add_stringc�������������� ���C���s����|�j����|��|t�}|s(W�d�����d�S�tj|dd�d��}|�|��W�d�����n1�sX0����Y��|��d|��d|�j��d���W�d�����n1�s�0����Y��d�S�)N�wbr����zadded binary content at 'z' to archive 'rE���)r@���r����ry���r����r����r����r���rN���)r���r(���r$���r����r���r���r ���r+������s����(�zFileCacheArchive.add_binaryc����������� ��� ���C���s���|���d|��d|��d���|�j�h�|��|t�}|s@W�d�����d�S�tj�|�sxt�||��|���d|��d|��d|�j��d���W�d�����n1�s�0����Y��|���d|��d|��d |�����tj� |�}tj� tj�||��}|��|�}d d��}tj� |��s�tj�|��r�|}tj� |�}tj�|t�|��}tj�||�}|||��r\|���d|��d |��d���d�S�|���d|��d|��d���|��||��nntj�|��r�|���d|��d���|��|��nBtj�|��r�|���d|��d���|��|��n|���d|��d|�����d�S�)Nzadding symlink at 'r^���rE���zadded symlink at 'z' to 'z' in archive 'zLink follow up: source=z link_name=z dest=c�������������� ���S���s����t�j�|��}t�j�|�s.t�j�t�j�||��}t�j�|��}�|�|krFdS�zt��|���W�n>�ty��}�z&|jdkr|W�Y�d}~dS���W�Y�d}~n d}~0�0�dS�)z�Return ``True`` if the symbolic link ``link_name`` is part of a file system loop, or ``False`` otherwise. T�(���NF) rF���r0����dirnamerS����realpathrM���rp���r�����errno)r-���r,���Zlink_dirr����r���r���r ����is_loop���s���� z*FileCacheArchive.add_link.<locals>.is_loopzLink 'z' - 'z' loops: skipping...zAdding link z -> z for link follow upzAdding dir zAdding file zNo link follow up: source=)r���r@���r����r|���rF���r0����lexistsrh���rN���r����r����rM���rV���rc���rd���re���rH���r.���r_���r1����isfiler&���) r���r,���r-���r$���Z source_dirZhost_path_nameZdest_path_namer����r����r���r���r ���r.������sJ�����(� �zFileCacheArchive.add_linkc�����������������C���s6���|�j���|��|t��W�d����n1�s(0����Y��dS�)zmCreate a directory in the archive. :param path: the path in the host file system to add N)r@���r����rv���r/���r���r���r ���r1������s����zFileCacheArchive.add_dirc�������������� ���C���s����|���|t�}|sd�S�tj�|�s�zt�|||��W�n^�ty��}�zF|jtjkrxd}|�� d|��d|��d���W�Y�d�}~d�S�|�W�Y�d�}~n d�}~0�0�|�� ||��d�S�)NzOperation not permittedz add_node: z - mknod 'rE���)r����r~���rF���r0���rc����mknodr����r�����EPERMr���r����)r���r0���r)���r2���r$���r����r���r���r���r ���r3������s����zFileCacheArchive.add_nodec�����������������C���s&���dt�jv�r"t�jd�}t��|�j|�S�dS�)N�PC_NAME_MAX����)rF����pathconf_names�pathconfrN���)r���Zpc_name_maxr���r���r ���r5�����s���� zFileCacheArchive.name_maxc�����������������C���s���|�j�S�r����rN���r���r���r���r ���r4��� ��s����zFileCacheArchive.get_tmp_dirc�����������������C���s���|�j�S�r���r����r���r���r���r ���r6�����s����z!FileCacheArchive.get_archive_pathc�����������������C���s8���t�jt�j�|�j|�|d��|��d|��d|�j��d���dS�)zsCreate path, including leading components. Used by sos.sosreport to set up sos_* directories. r]���zcreated directory at 'z' in FileCacheArchive 'rE���N)rF���rO���r0���rM���rN���r���)r���r0���r)���r���r���r ���rO�����s�����zFileCacheArchive.makedirsc�����������������C���s���|���|�}tj|dddd�S�)N�rr����r����)r�����errors)rV���r����r����r/���r���r���r ���� open_file��s���� zFileCacheArchive.open_filec�����������������C���s���t�j�|�j�rt�|�j��d�S�r���)rF���r0���r_���rN���r�����rmtreer���r���r���r ���r7�����s����zFileCacheArchive.cleanupc�����������������C���sf���t����}|�jj}||�}|�j�d|��|�j�d|��|�j�d|��|��|�jjdd�tj� dd���dS�) z�Adds component-agnostic data to the manifest so that individual SoSComponents do not need to redundantly add these manually Zend_time�run_time�compression����)�indent�sos_reportsz manifest.jsonN) r���ZnowrL���Z start_timeZ add_fieldr*���Zget_jsonrF���r0���rM���)r���r9����end�startr����r���r���r ����add_final_manifest_data ��s�����z(FileCacheArchive.add_final_manifest_datac�����������������C���sN���|��|�j�|�_tj�|�j|�j�}t�|�j|��||�_tj�|�j|�����|�_ dS�)zeRename the archive to an obfuscated version using an initialized SoSCleaner instance N) Zobfuscate_stringr���rF���r0���rM���rI����renamerN���r ���� _archive_name)r���ZcleanerZ _new_rootr���r���r ����rename_archive_root-��s ����z$FileCacheArchive.rename_archive_rootc�����������������C���s����t�jt�jB�}t|d�r(|j}|j|B�}n|}|}d}|��|��}|���}W�d����n1�s\0����Y��t|t �s||� dd�}t�j||||d�\} } | r�|��| |��nd} | S�)a���Apply a regexp substitution to a file in the archive. :param path: Path in the archive where the file can be found :type path: ``str`` :param regexp: A regex to match the contents of the file :type regexp: ``str`` or compiled ``re`` object :param subst: The substitution string to be used to replace matches within the file :type subst: ``str`` :returns: Number of replacements made :rtype: ``int`` �patternrB���Nr����r����)�flagsr���) �re� IGNORECASE� MULTILINE�hasattrr����r����r����r����r�����strr�����subnr*���)r���r0���Zregexp�substZcommon_flagsr����r����r(����readable�resultZreplacementsr���r���r ����do_file_sub7��s$���� & � zFileCacheArchive.do_file_subc�������������� ���C���s����|���d|�j��d|��d���z|��|�}W�n<�tyd�}�z$|��d|�����|����W��Y�d�}~S�d�}~0�0�|�����|���d|�j��dt� |�j�j ��d���|�jd���r�z|��|�W�S��t��y��}�z(d }|��|��d |�����|W��Y�d�}~S�d�}~0�0�n|S�d�S�)Nzfinalizing archive 'z' using method 'rE���z+An error occurred compressing the archive: zbuilt archive at 'z' (size=�)Zencryptz)An error occurred encrypting the archive:� ) r���rN����_build_archiver����r���r ���r7���r����rF���rp����st_sizerJ����_encrypt)r���r9����res�errr����Zexp_msgr���r���r ���r:���\��s(����� � zFileCacheArchive.finalizec�����������������C���s����|��dd�}|d7�}d|��d�}d}|�jd�rL|d|�jd���d�7�}||7�}|�jd �r�|�jd ���d d�}d|i}|d 7�}d|��d�}||7�}t|d|d�}|d�dkr�|S�|d�dkr�|�jd�r�d}q�d}nd|d����}t|��dS�)a���Encrypts the compressed archive using GPG. If encryption fails for any reason, it should be logged by sos but not cause execution to stop. The assumption is that the unencrypted archive would still be of use to the user, and/or that the end user has another means of securing the archive. Returns the name of the encrypted archive, or raises an exception to signal that encryption failed and the unencrypted archive name should be used. z sosreport-zsecured-sosreport-z.gpgzgpg --batch -o r����N�keyz--trust-model always -e -r �passwordz'"rB���Zsos_gpgz-c --passphrase-fd 0 z/bin/bash -c "echo $sos_gpg | �"r���)�timeout�env�status����zSpecified key not in keyringzCould not read passphrasezgpg exited with code )�replacerJ���r���r����)r����archiveZarc_nameZenc_cmdr�����passwdr����r���r���r���r ���r����s��s,���� zFileCacheArchive._encryptc�����������������C���s���|�����S�r���)r ���r8���r���r���r ���r�������s����zFileCacheArchive._build_archive)N)rD���)NF)NF)r'���)rD���)r ���r;���r<���r=���rI���rN���r����rR���rV���rY���rf���r����r����r&���r*���r+���r.���r1���r3���r5���r4���r6���rO���r����r7���r����r����r����r:���r����r����r���r���r���r ���rA�������s:����� ] K $ G %+rA���c�����������������������sT���e�Zd�ZdZdZdZd��fdd� Zddd�Zdd ��Zd d��Z dd ��Z dd��Z���ZS�)�TarFileArchivez: archive class using python TarFile to create tar archivesNFc�������������� ������s6���t����|||||||��d|�_tj�||�����|�_d�S�)N�tar)�superrR����_suffixrF���r0���rM���r ���r����rP����� __class__r���r ���rR������s������zTarFileArchive.__init__c�����������������C���sP���|j�|_|jd�|jd<�|jd�|jd<�|r4||_n|j|_|j|_|j |_ d�S�)Nz.9fZatime�ctime)�st_mtime�mtime�st_atime�pax_headers�st_ctimer)���r{���r�����uidr�����gid)r���Ztar_info�fstatr)���r���r���r ����set_tarinfo_from_stat���s����z$TarFileArchive.set_tarinfo_from_statc��������������������s����|j�ttj�|�j�d��d�������s*|�j��g�d�}t��fdd�|D���rLd�S�zt����}W�n�typ���|�Y�S�0�|�j r�|�� ���}|r�||jd<�|��||��|S�)N���)z /version.txt$z/sos_logs(/.*)?z/sos_reports(/.*)?c�����������������3���s���|�]}t��|���V��qd�S�r���)r�����match)�.0�skip�� orig_pathr���r ���� <genexpr>��������z9TarFileArchive.copy_permissions_filter.<locals>.<genexpr>zRHT.security.selinux) r ����lenrF���r0���r`���rN���ro���rp���r�����_with_selinux_context�get_selinux_contextr����r����)r����tarinfoZskipsr�����contextr���r����r ����copy_permissions_filter���s ���� z&TarFileArchive.copy_permissions_filterc�����������������C���s.���zt��|�\}}|W�S��ty(���Y�d�S�0�d�S�r���)�selinuxZ getfileconr����)r���r0����_�cr���r���r ���r�������s ����z"TarFileArchive.get_selinux_contextc�����������������C���s���|�j���d|�j���S�)N�.)rN���r����r���r���r���r ���r ������s����zTarFileArchive.namec�����������������C���s ��|dkrt�d�d�urdnd}|�d�}|�j��d|���|�_|dkrJddi}nd d i}tj|�jfdd|���i|���n}d D�]B}tj�tj�|�j |��rv|j tj�|�j |�|�j��d|���d��qv|j |�j |�j|�jd��W�d�����n1�s�0����Y��|��j d|���7��_ |����S�)N�auto�lzma�xz�gzip�ipr��� compresslevel�����preset����r)���zw:)zversion.txtr����Zsos_logsrC���)�arcname)r���filter)r����stripr�����tarfiler����rF���r0���rc���rM���rN����addr���r���r����r ���)r���r9���Z _comp_mode�kwargsr����Z_contentr���r���r ���r�������s,���� ���$zTarFileArchive._build_archive)N)N) r ���r;���r<���r=���r9���r����rR���r����r���r����r ���r����� __classcell__r���r���r����r ���r�������s����� r����)rF���r��r����r?���r����r����rp���r����r���� threadingr����importlib.utilr���Z sos.utilitiesr���r���ImportErrorry���r|���r~���rv���r ���rA���r����r���r���r���r ����<module>���s4���]����!