[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@18.222.110.240: ~ $
�

2�Dg~��v�dZddlZddlZddlZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lmZddlm
Z
ddlmZd
�Zd�Zd�Zejed��Gd�de����Zejed��Gd�de����ZedkrddlmZee��dSdS)zmacOS specific tests.�N)�MACOS)�HAS_BATTERY)�PsutilTestCase)�retry_on_failure)�sh)�spawn_testproc)�	terminate)�TOLERANCE_DISK_USAGE)�TOLERANCE_SYS_MEM)�unittestc��t|��}|���d}	t|��S#t$r|cYSwxYw)zmExpects a sysctl command with an argument and parse the result
    returning only the value of interest.
    �)r�split�int�
ValueError)�cmdline�out�results   �w/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib64/python3.11/site-packages/psutil/tests/test_osx.py�sysctlrsU��
�W�+�+�C�
�Y�Y�[�[��^�F���6�{�{��������
�
�
����s�:�A	�A	c��ddlm}td��}|�d��D]}||vrn�	t	d���tt
jd|���d����|��zS)z)Wrapper around 'vm_stat' cmdline utility.r)�getpagesize�vm_stat�
zline not foundz\d+)	�psutil._psutil_posixrrrrr�re�search�group)�fieldrr�lines    rrr%s���0�0�0�0�0�0�
�Y�-�-�C��	�	�$���+�+���D�=�=��E���)�*�*�*��r�y���&�&�,�,�Q�/�/�0�0�;�;�=�=�@�@�c�v�ddi}|}d}|r|dd����s|dd�dkrA||dz
}|dd�}|r|dd�����3|dd�dk�At|��}|���}|���D]\}}||vrn6�|dkr|d}|���}ntd|z���|ddi}t
|dd���D]\}}d|dzd	zz||<�t|||z��S)
N�	customary)	�B�K�M�G�T�P�E�Z�Y�rr�.�kzcan't interpret %r�
)�isdigit�float�strip�items�upperr�	enumerater)	�s�SYMBOLS�init�num�letter�name�sset�prefix�is	         r�human2bytesr@3sx���B��G�
�D�
�C�
���!�A�#���� � ��A�a��c�F�c�M�M��q��t���
�a�b�b�E�����!�A�#���� � ��A�a��c�F�c�M�M���*�*�C�
�W�W�Y�Y�F��m�m�o�o�:�:�
��d��T�>�>��E���S�=�=��;�'�D��\�\�^�^�F�F��1�D�8�9�9�9��1�g�q�\�F��$�q�r�r�(�#�#�&�&���1��!�a�%�2��%��q�	�	��s�V�F�^�#�$�$�$r!z
MACOS onlyc�@�eZdZed���Zed���Zd�ZdS)�TestProcessc�6�t��j|_dS�N)r�pid��clss r�
setUpClasszTestProcess.setUpClassPs�� �"�"�&����r!c�.�t|j��dSrD)r	rErFs r�
tearDownClasszTestProcess.tearDownClassTs���#�'�����r!c	�2�td|jz��}|�dd�����}|�d��d}|�d��d}tj|j�����}|�|tj
dtj|������|�|tj
dtj|������dS)	Nzps -o lstart -p %s�STARTEDr-� ������z%H:%M:%Sz%Y)rrE�replacer3r�psutil�Process�create_time�assertEqual�time�strftime�	localtime)�self�output�start_ps�hhmmss�year�start_psutils      r�test_process_create_timez$TestProcess.test_process_create_timeXs����(�4�8�3�4�4���>�>�)�R�0�0�6�6�8�8������$�$�R�(���~�~�c�"�"�2�&���~�d�h�/�/�;�;�=�=�������M�*�d�n�\�&B�&B�C�C�	E�	E�	E�	
�����M�$���|� <� <�=�=�	?�	?�	?�	?�	?r!N)�__name__�
__module__�__qualname__�classmethodrHrJr^�r!rrBrBMsY�������'�'��[�'�����[��?�?�?�?�?r!rBc�l�eZdZe��d���Zd�Zd�Zd�Zd�Ze��d���Z	e��d���Z
e��d���Ze��d	���Ze��d
���Z
e��d���Zd�Zejed
��d���ZdS)�TestSystemAPIsc��d�}tjd���D]�}tj|j��}||j��\}}}}|�|j|��|�|j|��|�|j|t���|�|j
|t�����dS)Nc��td|z�����}|�d��}|�d��|�d��}|���dd�\}}}}|dkrd}t	|��dz}t	|��dz}t	|��dz}||||fS)Nz
df -k "%s"rr��noner-i)rr3r�popr)�pathr�linesr �dev�total�used�frees        r�dfz%TestSystemAPIs.test_disks.<locals>.dfos����\�D�(�)�)�/�/�1�1�C��I�I�d�O�O�E��I�I�a�L�L�L��9�9�Q�<�<�D�%)�Z�Z�\�\�"�1�"�%5�"�C���d��f�}�}�����J�J��%�E��t�9�9�t�#�D��t�9�9�t�#�D���t�T�)�)r!F)�all��delta)rQ�disk_partitions�
disk_usage�
mountpointrT�devicern�assertAlmostEqualrpr
ro)rXrq�part�usagermrnrorps        r�
test_diskszTestSystemAPIs.test_disksks���	*�	*�	*��*�u�5�5�5�	?�	?�D��%�d�o�6�6�E�%'�R���%8�%8�"�C���d����T�[�#�.�.�.����U�[�%�0�0�0��"�"�5�:�t�)=�
#�
?�
?�
?��"�"�5�:�t�)=�
#�
?�
?�
?�
?�	?�	?r!c�v�td��}|�|tjd�����dS)Nzsysctl hw.logicalcpuT��logical�rrTrQ�	cpu_count�rXr:s  r�test_cpu_count_logicalz%TestSystemAPIs.test_cpu_count_logical�s:���+�,�,������f�.�t�<�<�<�=�=�=�=�=r!c�v�td��}|�|tjd�����dS)Nzsysctl hw.physicalcpuFr~r�r�s  r�test_cpu_count_physicalz&TestSystemAPIs.test_cpu_count_physical�s:���,�-�-������f�.�u�=�=�=�>�>�>�>�>r!c�@�tj��}|�|jdzdzt	d����|�|jdzdzt	d����|�|jdzdzt	d����dS)Ni�zsysctl hw.cpufrequencyzsysctl hw.cpufrequency_minzsysctl hw.cpufrequency_max)rQ�cpu_freqrT�currentr�min�max)rX�freqs  r�
test_cpu_freqzTestSystemAPIs.test_cpu_freq�s����� � ������L�4��$�&��/G�(H�(H�	J�	J�	J�����H�t�O�d�"�F�+G�$H�$H�	J�	J�	J�����H�t�O�d�"�F�+G�$H�$H�	J�	J�	J�	J�	Jr!c�|�td��}|�|tj��j��dS)Nzsysctl hw.memsize)rrTrQ�virtual_memoryrn)rX�sysctl_hwphymems  r�test_vmem_totalzTestSystemAPIs.test_vmem_total�s8�� �!4�5�5������&�*?�*A�*A�*G�H�H�H�H�Hr!c��td��}tj��j}|�||t
���dS)Nrprs)rrQr�rpryr�rX�
vmstat_val�
psutil_vals   r�test_vmem_freezTestSystemAPIs.test_vmem_free�s@���V�_�_�
��*�,�,�1�
����z�:�=N��O�O�O�O�Or!c��td��}tj��j}|�||t
���dS)N�activers)rrQr�r�ryrr�s   r�test_vmem_activezTestSystemAPIs.test_vmem_active�sB���X�&�&�
��*�,�,�3�
����z�:�=N��O�O�O�O�Or!c��td��}tj��j}|�||t
���dS)N�inactivers)rrQr�r�ryrr�s   r�test_vmem_inactivez!TestSystemAPIs.test_vmem_inactive�sB���Z�(�(�
��*�,�,�5�
����z�:�=N��O�O�O�O�Or!c��td��}tj��j}|�||t
���dS)N�wiredrs)rrQr�r�ryrr�s   r�test_vmem_wiredzTestSystemAPIs.test_vmem_wired�sB���W�%�%�
��*�,�,�2�
����z�:�=N��O�O�O�O�Or!c��td��}tj��j}|�||��dS)N�Pageins)rrQ�swap_memory�sinrTr�s   r�test_swapmem_sinzTestSystemAPIs.test_swapmem_sin�s<���Y�'�'�
��'�)�)�-�
�����Z�0�0�0�0�0r!c��td��}tj��j}|�||��dS)N�Pageout)rrQr��soutrTr�s   r�test_swapmem_soutz TestSystemAPIs.test_swapmem_sout�s<���Y�'�'�
��'�)�)�.�
�����Z�0�0�0�0�0r!c
�b�tj�����D]�\}}	td|z��}|�|jd|v|���|�|jttj	d|��d�����y#t$rY��wxYwdS)Nzifconfig %s�RUNNING)�msgz	mtu (\d+)r)rQ�net_if_statsr4rrT�isup�mturr�findall�RuntimeError)rXr<�statsrs    r�test_net_if_statsz TestSystemAPIs.test_net_if_stats�s���!�.�0�0�6�6�8�8�	H�	H�K�D�%�
H����-�.�.��� � ���Y�#�-=�3� �G�G�G�� � ���!$�R�Z��c�%B�%B�1�%E�!F�!F�H�H�H�H��	 �
�
�
���
����	H�	Hs�B�
B,�+B,z
no batteryc�|�td��}tjd|���d��}tjd|���d��}|dk}t	j��}|�|j|��|�|jt|����dS)Nz
pmset -g battz(\d+)%rzNow drawing from '([^']+)'zAC Power)
rrrrrQ�sensors_batteryrT�
power_plugged�percentr)rXrr��drawing_fromr��
psutil_results      r�test_sensors_batteryz#TestSystemAPIs.test_sensors_battery�s�����!�!���)�I�s�+�+�1�1�!�4�4���y�!=�s�C�C�I�I�!�L�L��$�
�2�
��.�0�0�
�����4�m�D�D�D�����.��G���=�=�=�=�=r!N)r_r`rarr|r�r�r�r�r�r�r�r�r�r�r�r�skipIfrr�rcr!rrerefs�������
����?�?���?�8>�>�>�?�?�?�J�J�J�I�I�I�����P�P���P�
����P�P���P�
����P�P���P�
����P�P���P�����1�1���1�
����1�1���1�"	H�	H�	H��X�_��_�l�3�3�>�>�4�3�>�>�>r!re�__main__)�
run_from_name)�__doc__rrUrQr�psutil.testsrrrrrr	r
rrrrr@r�rBrer_�psutil.tests.runnerr��__file__rcr!r�<module>r�s�����	�	�	�	�����
�
�
�
�������$�$�$�$�$�$�'�'�'�'�'�'�)�)�)�)�)�)�������'�'�'�'�'�'�"�"�"�"�"�"�-�-�-�-�-�-�*�*�*�*�*�*�!�!�!�!�!�!�	�	�	�
A�
A�
A�%�%�%�4���U��L�)�)�?�?�?�?�?�.�?�?�*�)�?�0���U��L�)�)�>�>�>�>�>�^�>�>�*�)�>�D�z���1�1�1�1�1�1��M�(�������r!

Filemanager

Name Type Size Permission Actions
__init__.cpython-311.pyc File 88.05 KB 0644
__main__.cpython-311.pyc File 395 B 0644
runner.cpython-311.pyc File 19.78 KB 0644
test_aix.cpython-311.pyc File 6.38 KB 0644
test_bsd.cpython-311.pyc File 39.97 KB 0644
test_connections.cpython-311.pyc File 34.39 KB 0644
test_contracts.cpython-311.pyc File 52.41 KB 0644
test_linux.cpython-311.pyc File 154.4 KB 0644
test_memleaks.cpython-311.pyc File 37.53 KB 0644
test_misc.cpython-311.pyc File 51.58 KB 0644
test_osx.cpython-311.pyc File 13.74 KB 0644
test_posix.cpython-311.pyc File 25.72 KB 0644
test_process.cpython-311.pyc File 111.08 KB 0644
test_sunos.cpython-311.pyc File 2.78 KB 0644
test_system.cpython-311.pyc File 62.06 KB 0644
test_testutils.cpython-311.pyc File 34.2 KB 0644
test_unicode.cpython-311.pyc File 19.95 KB 0644
test_windows.cpython-311.pyc File 59.02 KB 0644