Your IP : 18.188.211.246


Current Path : /opt/imunify360/venv/lib64/python3.11/site-packages/psutil/__pycache__/
Upload File :
Current File : //opt/imunify360/venv/lib64/python3.11/site-packages/psutil/__pycache__/_pswindows.cpython-311.pyc

�

P�Dg�����dZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlmZddlm
Z
ddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddlm#Z#ddlm$Z$ddlm%Z%	ddl
mZ&nn#e'$rfZ(e)e(���*���+d��r0ej,��dd krd!Z-e-d"z
Z-e-d#z
Z-e.e-����dZ([(wwxYwej/d$krddl0Z0ndZ0gd%�Z1d&Z2d'Z3d(ej4vZ5e0�d)Z6ne0j7d*d+d)i��Z8e8j6Z6e&j9ej:e&j;ej<e&j=ej>e&j?ej@e&jAejBe&jCejDe&jEejFe&jGejHe&jIejJe&jKejLe&jMejNe&jOe2e&jPejQi
ZRe0�5Gd,�d-e0j7��ZSeT���UeSjV��e0�	dZWdZXd.ZYd/ZZn5Gd0�d1e0j7��Z[eT���Ue[jV��e\d�id2d�d3d�d4d.�d5d/�d6d7�d8d9�d:d �d;d<�d=d>�d?d@�dAdB�dCdD�dEdF�dGdH�dIdJ�dKdL�dMdN�dOdP�dQdR�dSdT�dUdV�dWdX��Z]e	dYgdZ���Z^e	d[gd\���Z_e	d]gd^���Z`e	d_e`jad`z��Zbe	dadbdcg��Zce	dddedf�decja��z��Zee	dggdh���Zfedi�j��dk���Zgdl�Zhedm���Zidn�Zjdo�Zke&jlZldp�Zmdq�Zndr�Zods�Zpdt�Zqdu�Zrdv�Zsdw�Ztdxaudy�Zvd�dz�Zwd{�Zxd|�Zyd}�Zzd~�Z{da|d�Z}d��Z~d��Zd��Z�Gd��d�e���Z�e&j�Z�e&j�Z�e&j�Z�d��Z�d�d��Z�d��Z�d��Z�Gd��d�e���Z�dS)�z Windows platform implementation.�N)�
namedtuple�)�_common)�AccessDenied)�	conn_tmap)�conn_to_ntuple)�debug)�ENCODING)�
ENCODING_ERRS)�
isfile_strict)�memoize)�memoize_when_activated)�
NoSuchProcess)�parse_environ_block)�TimeoutExpired)�
usage_percent)�long)�	lru_cache)�PY3��range)�unicode)�ABOVE_NORMAL_PRIORITY_CLASS)�BELOW_NORMAL_PRIORITY_CLASS)�HIGH_PRIORITY_CLASS)�IDLE_PRIORITY_CLASS)�NORMAL_PRIORITY_CLASS)�REALTIME_PRIORITY_CLASS)�_psutil_windowszdll load failed�z3this Windows version is too old (< Windows Vista); z:psutil 3.4.2 is the latest version which supports Windows z2000, XP and 2003 server)��)�win_service_iter�win_service_getrrrrrr�IOPRIO_VERYLOW�
IOPRIO_LOW�
IOPRIO_NORMAL�IOPRIO_HIGH�CONN_DELETE_TCB�AF_LINK�
DELETE_TCBi+�__pypy__����
AddressFamilyr*c�&�eZdZeZeZeZeZeZeZdS)�PriorityN)	�__name__�
__module__�__qualname__rrrrrr���s/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib64/python3.11/site-packages/psutil/_pswindows.pyr0r0ms4������&A�#�&A�#�1��1�� 5��"9���r5r0�r!c��eZdZdZdZdZdZdS)�
IOPriorityrrr7r!N)r1r2r3r%r&r'r(r4r5r6r9r9}s"���������
��
����r5r9�num_handles�ctx_switches�	user_time�kernel_time�create_timer"�num_threads��	io_rcount�	io_wcount��	io_rbytes��	io_wbytes�	�io_count_others�
�io_bytes_others��num_page_faults��	peak_wset�
�wset��peak_paged_pool��
paged_pool��peak_non_paged_pool��non_paged_pool��pagefile��
peak_pagefile��mem_private��	scputimes)�user�system�idle�	interrupt�dpc�svmem)�total�	available�percent�used�free�pmem)�rss�vmsrLrNrPrRrT�peak_nonpaged_pool�
nonpaged_poolrZr\�private�pfullmem)�uss�
pmmap_grouped�pathrm�	pmmap_extzaddr perms � �pio)�
read_count�write_count�
read_bytes�write_bytes�other_count�other_bytesi)�maxsizec��d�|�d��dd���}tj|��}|t	|��d�}t
j�||��S)z�Convert paths using native DOS format like:
        "\Device\HarddiskVolume1\Windows\systemew\file.txt"
    into:
        "C:\Windows\systemew\file.txt"
    �\Nr!)�join�split�cext�win32_QueryDosDevice�len�osru)�s�rawdrive�driveletter�	remainders    r6�convert_dos_pathr��sb���y�y�������r��r�*�+�+�H��+�H�5�5�K��#�h�-�-�.�.�!�I�
�7�<�<��Y�/�/�/r5c��tr|St|t��r|S|�tt
��S)zmEncode a unicode string to a byte string by using the default fs
    encoding + "replace" error handler.
    )r�
isinstance�str�encoder
r)r�s r6�
py2_strencoder��s<���5����a����	5��H��8�8�H�m�4�4�4r5c�(�tj��S�N)r��getpagesizer4r5r6r�r��s������r5c��tj��}|\}}}}}}|}|}|}	||z
}
t||z
|d���}t||||
|	��S)z&System virtual memory as a namedtuple.r��round_)r��virtual_memrrf)�mem�totphys�	availphys�totpagef�
availpagef�totvirt�freevirtrg�availrkrjris            r6�virtual_memoryr��sh��
�
�
�
�C�BE�?�G�Y��*�g�x��E��E��D��5�=�D��U�U�]�U�1�=�=�=�G����w��d�3�3�3r5c��tj��}|d}|d}||z
}t||d���}tj||||dd��S)z=Swap system memory as a (total, used, free, sin, sout) tuple.r7r!rr�r)r�r�rr�sswap)r�rgrkrjris     r6�swap_memoryr��sY��
�
�
�
�C���F�E��q�6�D��4�<�D��D�%��2�2�2�G��=���d�G�Q��:�:�:r5c��tr1t|t��r|�td���}tj|��\}}||z
}t||d���}tj	||||��S)z'Return disk usage associated with path.�strict)�errorsrr�)
rr��bytes�decoder
r��
disk_usagerr�
sdiskusage)rurgrkrjris     r6r�r�sy��
�6�z�$��&�&�6��{�{�8�H�{�5�5���/�$�'�'�K�E�4��4�<�D��D�%��2�2�2�G���e�T�4��9�9�9r5c�B�tj|��}d�|D��S)zReturn disk partitions.c�*�g|]}tj|���Sr4)r�	sdiskpart��.0�xs  r6�
<listcomp>z#disk_partitions.<locals>.<listcomp>s ��3�3�3�a�G��q�!�3�3�3r5)r��disk_partitions)�all�rawlists  r6r�r�s&���"�3�'�'�G�3�3�7�3�3�3�3r5c��tj��\}}}td�ttj���D���}t||||j|j��S)z)Return system CPU times as a named tuple.c�,�g|]}t|����Sr4)�sum)r��ns  r6r�zcpu_times.<locals>.<listcomp> s��K�K�K�1��A���K�K�Kr5)r��	cpu_timesr`�zip�
per_cpu_timesrdre)rarbrc�
percpu_summeds    r6r�r�se����)�)��D�&�$��K�K��T�5G�5I�5I�0J�K�K�K�L�M��T�6�4�"�,�m�.?�A�A�Ar5c��g}tj��D]0\}}}}}t|||||��}|�|���1|S)z6Return system per-CPU times as a list of named tuples.)r�r�r`�append)�retrarbrcrdre�items       r6r�r�%sY��
�C�.2�.@�.B�.B���*��f�d�I�s���v�t�Y��<�<���
�
�4������Jr5c�(�tj��S)z0Return the number of logical CPUs in the system.)r��cpu_count_logicalr4r5r6r�r�.s���!�#�#�#r5c�(�tj��S)z6Return the number of physical CPU cores in the system.)r��cpu_count_physr4r5r6�cpu_count_physicalr�3s���� � � r5c�d�tj��\}}}}d}tj||||��S)zReturn CPU statistics.r)r��	cpu_statsr�	scpustats)r;�
interrupts�dpcs�syscalls�soft_interruptss     r6r�r�8s;��/3�~�/?�/?�,�L�*�d�H��O���\�:��%�'�'�'r5c��tj��\}}d}tjt	|��|t	|����gS)zMReturn CPU frequency.
    On Windows per-cpu frequency is not supported.
    �)r��cpu_freqr�scpufreq�float)�curr�max_�min_s   r6r�r�@s<������J�D�$��D���U�4�[�[�$��d���<�<�=�=r5Fc��tstj��datj��}t	d�|D����S)z~Return the number of processes in the system run queue averaged
    over the last 1, 5, and 15 minutes respectively as a tupleTc�.�g|]}t|d����S)r7)�round)r��loads  r6r�zgetloadavg.<locals>.<listcomp>Ws ��7�7�7�T�%��a�.�.�7�7�7r5)�_loadavg_inititializedr��init_loadavg_counter�
getloadavg�tuple)�	raw_loadss r6r�r�LsM��
"�&��!�#�#�#�!%����!�!�I��7�7�Y�7�7�7�8�8�8r5c��|tvr7td|�dd�d�tD���������t|\}}tj|||��}t��}|D]E}|\}}}	}
}}}
t
|||	|
||t|dkr|
nd���}|�|���Ft|��S)z�Return socket connections.  If pid == -1 return system-wide
    connections (as opposed to connections opened by one process only).
    zinvalid z kind argument; choose between z, c�,�g|]}t|����Sr4)�reprr�s  r6r�z#net_connections.<locals>.<listcomp>es��,H�,H�,H��T�!�W�W�,H�,H�,Hr5r-N)�pid)
r�
ValueErrorr�r��net_connections�setr�TCP_STATUSES�add�list)�kind�_pid�families�typesr�r�r��fd�fam�type�laddr�raddr�statusr��nts               r6r�r�_s����9����j� �D�D�$�)�)�,H�,H�i�,H�,H�,H�"I�"I�"I�K�L�L�	L���o�O�H�e��"�4��5�9�9�G�

�%�%�C�����37�0��C��u�e�V�S�
�B��T�5�%���'+�r�z�z���t�=�=�=������������9�9�r5c�|�i}tj��}|���D]�\}}ts;t	|t
��sJt
|�����t|��}|\}}}}ttd��rtj
|��}tj||||��||<��|S)z)Get NIC stats (isup, duplex, speed, mtu).�	NicDuplex)r��net_if_stats�itemsrr�rr�r��hasattrrr��	snicstats)r��rawdict�namer��isup�duplex�speed�mtus        r6r�r�qs���
�C���!�!�G��}�}���@�@���e��	'��d�G�,�,�8�8�d�4�j�j�8�8�,� ��&�&�D�#(� ��f�e�S��7�K�(�(�	/��&�v�.�.�F��%�d�F�E�3�?�?��D�	�	��Jr5c�~�tj��}td�|���D����S)zsReturn network I/O statistics for every network interface
    installed on the system as a dict of raw tuples.
    c�6�g|]\}}t|��|f��Sr4�r�)r��k�vs   r6r�z#net_io_counters.<locals>.<listcomp>�s)��?�?�?�4�1�a�-��"�"�A�&�?�?�?r5)r��net_io_counters�dictr��r�s r6rr�s7���
�
 �
 �C��?�?�3�9�9�;�;�?�?�?�@�@�@r5c��g}tj��D]>}t|��}t|d��|d<|�|���?|S)z,Return the addresses associated to each NIC.r)r��net_if_addrsr�r�r�)r�r�s  r6r	r	�sY��
�C��"�$�$�����U���� ��q��*�*��a���
�
�5������Jr5c��tj��\}}}}|dk}t|dz��}t|dz��}|rdS|s|r
tj}n|dkrtj}tj|||��S)zReturn battery information.r�rENr-)r��sensors_battery�boolr�POWER_TIME_UNLIMITED�POWER_TIME_UNKNOWN�sbattery)�
acline_status�flagsri�secsleft�
power_plugged�
no_battery�chargings       r6rr�s���
/3�.B�.D�.D�+�M�5�'�8�!�Q�&�M��e�c�k�"�"�J��E�A�I���H����t��.��.��/���	�R����-����G�X�}�=�=�=r5c��ttj����}t|tz
��dkrtS|a|S)z:The system boot time expressed in seconds since the epoch.r)r�r��	boot_time�abs�_last_btimers r6rr�sA����� � �
!�
!�C�
�3������"�"������
r5c��g}tj��}|D]D}|\}}}t|��}tj|d||d��}|�|���E|S)z:Return currently connected users as a list of namedtuples.N)r��usersr�r�suserr�)�retlistr�r�ra�hostname�tstampr�s       r6rr�sk���G��j�l�l�G�����!%���h���T�"�"��
�]�4��x���
>�
>�����r������Nr5c#�K�tj��D]1\}}tt|��t|����V��2dS)z*Yields a list of WindowsService instances.N)r��winservice_enumerate�WindowsServicer�)r��display_names  r6r#r#�sZ����"�7�9�9�O�O���l��]�4�0�0�-��2M�2M�N�N�N�N�N�N�O�Or5c�d�t|d��}|���d|_|S)zBOpen a Windows service and return it as a WindowsService instance.Nr$)r#�
_query_config�
_display_name)r��services  r6r$r$�s/���T�4�(�(�G�#�1�1�3�3�N�C�G���Nr5c��eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
ejd	���Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�ZdS)r#z(Represents an installed Windows service.c�"�||_||_dSr�)�_namer')�selfr�r$s   r6�__init__zWindowsService.__init__�s����
�)����r5c�H�d|j�d|j�d�}|jj�|��S)Nz(name=z, display_name=�))r+r'�	__class__r1)r,�detailss  r6�__str__zWindowsService.__str__�s4����J�J�J��*�*�*�,����0�0�'�'�:�:r5c�R�d|����dt|���d�S)N�<z at �>)r2�id�r,s r6�__repr__zWindowsService.__repr__�s%���#�|�|�~�~�~�~�r�$�x�x�x�x�8�8r5c�Z�t|t��stS|j|jkSr�)r�r#�NotImplementedr+�r,�others  r6�__eq__zWindowsService.__eq__�s+���%��0�0�	"�!�!��z�U�[�(�(r5c��||kSr�r4r;s  r6�__ne__zWindowsService.__ne__�s���5�=� � r5c�$�|���5tj|j��\}}}}ddd��n#1swxYwYt	t|��t|��t|��t|�����S)N)r$�binpath�username�
start_type)�_wrap_exceptionsr��winservice_query_configr+rr�)r,r$rArBrCs     r6r&zWindowsService._query_config�s���
�
"�
"�
$�
$�	9�	9��,�T�Z�8�8�
8�L�'�8�Z�	9�	9�	9�	9�	9�	9�	9�	9�	9�	9�	9����	9�	9�	9�	9��&�|�4�4�!�'�*�*�"�8�,�,�$�Z�0�0�	2�2�2�	2s�A�A�Ac���|���5tj|j��\}}ddd��n#1swxYwY|dkrd}t	||���S)Nr)r�r�)rDr��winservice_query_statusr+r)r,r�r�s   r6�
_query_statuszWindowsService._query_statuss���
�
"�
"�
$�
$�	C�	C��6�t�z�B�B�K�F�C�	C�	C�	C�	C�	C�	C�	C�	C�	C�	C�	C����	C�	C�	C�	C��!�8�8��C��6�s�+�+�+�+s�>�A�Ac#�K�	dV�dS#t$rr}t|��rtd|jd|jz����|jt
jt
jfvrtd|jd|jz�����d}~wwxYw)z{Ctx manager which translates bare OSError and WindowsError
        exceptions into NoSuchProcess and AccessDenied.
        Nz2service %r is not querable (not enough privileges)�r�r��msgzservice %r does not exist))	�OSError�is_permission_errrr+�winerrorr��ERROR_INVALID_NAME�ERROR_SERVICE_DOES_NOT_EXISTr�r,�errs  r6rDzWindowsService._wrap_exceptions
s�����
	��E�E�E�E�E���	�	�	� ��%�%�
�"��4�:�L��
�#�$�$�$�$���$�"9�"&�"C�"E�E�E�#��4�:�4�t�z�A�C�C�C�C������	���s�
�
B�A-B�Bc��|jS)z�The service name. This string is how a service is referenced
        and can be passed to win_service_get() to get a new
        WindowsService instance.
        )r+r7s r6r�zWindowsService.name!s��
�z�r5c��|jS)z_The service display name. The value is cached when this class
        is instantiated.
        )r'r7s r6r$zWindowsService.display_name(s
���!�!r5c�6�|���dS)zwThe fully qualified path to the service binary/exe file as
        a string, including command line arguments.
        rA�r&r7s r6rAzWindowsService.binpath.s���!�!�#�#�I�.�.r5c�6�|���dS)z,The name of the user that owns this service.rBrVr7s r6rBzWindowsService.username4s���!�!�#�#�J�/�/r5c�6�|���dS)zRA string which can either be "automatic", "manual" or
        "disabled".
        rCrVr7s r6rCzWindowsService.start_type8s���!�!�#�#�L�1�1r5c�6�|���dS)zzThe process PID, if any, else None. This can be passed
        to Process class to control the service's process.
        r��rHr7s r6r�zWindowsService.pid@s���!�!�#�#�E�*�*r5c�6�|���dS)zService status as a string.r�rZr7s r6r�zWindowsService.statusFs���!�!�#�#�H�-�-r5c�h�ttj|�������S)zService long description.)r�r��winservice_query_descrr�r7s r6�descriptionzWindowsService.descriptionJs#���T�8������E�E�F�F�Fr5c��|���}|�|�����|���|d<|���|d<|���|d<|S)zUUtility method retrieving all the information above as a
        dictionary.
        r�r$r^)r&�updaterHr�r$r^)r,�ds  r6�as_dictzWindowsService.as_dictPsu��
��� � ��	����#�#�%�%�&�&�&��I�I�K�K��&�	� �-�-�/�/��.���+�+�-�-��-���r5N)r1r2r3�__doc__r-r2r8r=r?r&rH�
contextlib�contextmanagerrDr�r$rArBrCr�r�r^rbr4r5r6r#r#�s,������2�2�*�*�*�;�;�;�
9�9�9�)�)�)�!�!�!�	2�	2�	2�,�,�,��������,���"�"�"�/�/�/�0�0�0�2�2�2�+�+�+�.�.�.�G�G�G�	�	�	�	�	r5r#c���t|t��s
J|���|jtjtjfvp(t|dd��tjtjfvS)z*Return True if this is a permission error.rNr-)	r�rL�errno�EPERM�EACCES�getattrr��ERROR_ACCESS_DENIED�ERROR_PRIVILEGE_NOT_HELD)�excs r6rMrM�sg���c�7�#�#�(�(�S�(�(�#��9���e�l�3�3�H���Z��$�$��)A�)-�)F�)H�	H�Hr5c���t|t��s
J|���t|��rt||���S|jtjkrt
||���S|�)z3Convert OSError into NoSuchProcess or AccessDenied.�r�r�)r�rLrMrrg�ESRCHr)rmr�r�s   r6�convert_oserrorrq�sj���c�7�#�#�(�(�S�(�(�#�����0���$�/�/�/�/�
�y�E�K�����4�0�0�0�0�

�Ir5c�F��tj����fd���}|S)zDDecorator which converts OSError into NoSuchProcess or AccessDenied.c�z��	�|g|�Ri|��S#t$r!}t||j|j����d}~wwxYw)Nro)rLrqr�r+)r,�args�kwargsrR�funs    �r6�wrapperz wrap_exceptions.<locals>.wrapper�se���	F��3�t�-�d�-�-�-�f�-�-�-���	F�	F�	F�!�#�4�8�$�*�E�E�E�E�����	F���s��
:�5�:��	functools�wraps�rvrws` r6�wrap_exceptionsr|�s=����_�S���F�F�F�F���F�
�Nr5c�F��tj����fd���}|S)z�Workaround for https://github.com/giampaolo/psutil/issues/875.
    See: https://stackoverflow.com/questions/4457745#4457745
    c�:��d}d}t|��D]a}	�	|g|�Ri|��cS#t$rD}|}|jtkr,t	j|��t
|dzd��}Yd}~�Y�d}~wwxYw�	�d|�d|��}t|j|j	|����)N�-C��6?�!r7�{�G�z�?z	 retried z: times, converted to AccessDenied as it's still returning rJ)
r�WindowsErrorrN�ERROR_PARTIAL_COPY�time�sleep�minrr�r+)
r,rtru�delay�timesr��_rRrKrvs
         �r6rwz)retry_error_partial_copy.<locals>.wrapper�s���������u���	G�	G�A�	
��s�4�1�$�1�1�1�&�1�1�1�1�1���
�
�
����<�#5�5�5��J�u�%�%�%����	�4�0�0�E��H�H�H�H������
����),���U�U�U�C�C�9�C��4�8�$�*�#�F�F�F�Fs�&�
A4�9A/�.A/�/A4rxr{s` r6�retry_error_partial_copyr��s?����_�S���G�G�G�G���G�$�Nr5c��eZdZdZgd�Zd�Zd�Zd�Zed���Z	d�Z
eed�����Zee
d	�����Zee
d
�����Zd�Zd�Zed
���Zed���Zd�Zed���Zed���Zed)d���Zed���Zed���Zed���Zed���Zed���Zed���Zed���Zee
d�����Zed���Z ed*d���Z!ed���Z"ed ���Z#ed!���Z$ed"���Z%ed#���Z&ed$���Z'ed%���Z(ed&���Z)ed'���Z*ed(���Z+dS)+�Processz1Wrapper class around underlying C implementation.)r�r+�_ppid�_cachec�0�||_d|_d|_dSr�)r�r+r�)r,r�s  r6r-zProcess.__init__�s�������
���
�
�
r5c�n�|j�|��|j�|��dSr�)�
_proc_info�cache_activate�exer7s r6�
oneshot_enterzProcess.oneshot_enter�s4����&�&�t�,�,�,������%�%�%�%�%r5c�n�|j�|��|j�|��dSr�)r��cache_deactivater�r7s r6�oneshot_exitzProcess.oneshot_exit�s4����(�(��.�.�.���!�!�$�'�'�'�'�'r5c��tj|j��}t|��tt��ksJ�|S)zOReturn multiple information about this process as a
        raw tuple.
        )r��	proc_infor�r��	pinfo_map�r,r�s  r6r�zProcess._proc_info�s7��
�n�T�X�&�&���3�x�x�3�y�>�>�)�)�)�)��
r5c��|jdkrdS|jdkrdStj�|�����S)zbReturn process name, which on Windows is always the final
        part of the executable.
        rzSystem Idle Processr"�System)r�r�ru�basenamer�r7s r6r�zProcess.name�sC���8�q�=�=�(�(��8�q�=�=��8��w������
�
�+�+�+r5c��tre	tj|j��}nc#t$r=}|jdkr,t
d|z��t|j|j����d}~wwxYwtj|j��}tst|��}|�d��rt|��S|S)N�z%r forced into AccessDeniedr�)
�PYPYr��proc_exer�r�rgr	rr+rr��
startswithr�)r,r�rRs   r6r�zProcess.exe�s����	*�
��m�D�H�-�-�����
�
�
��9��?�?��7�#�=�>�>�>�&�t�x���<�<�<������

�����-���)�)�C��	%���$�$�C��>�>�$���	)�#�C�(�(�(��
s�#�
A*�8A%�%A*c�V�tjtjkr`	tj|jd���}n^#t
$r6}t
|��rtj|jd���}n�Yd}~n#d}~wwxYwtj|jd���}tr|Sd�|D��S)NT)�use_pebFc�,�g|]}t|����Sr4r)r�r�s  r6r�z#Process.cmdline.<locals>.<listcomp>s ��2�2�2��M�!�$�$�2�2�2r5)r��WINVER�WINDOWS_8_1�proc_cmdliner�rLrMr)r,r�rRs   r6�cmdlinezProcess.cmdlines����;�$�*�*�*�
��'���$�?�?�?�����
�
�
�$�S�)�)���+�D�H�e�D�D�D�C�C���C�C�C�C�����
�����#�D�H�d�;�;�;�C��	3��J�2�2�c�2�2�2�2s�8�
A8�,A3�3A8c���tj|j��}|r3ts,t	|t
��sJt
|�����tt|����Sr�)	r��proc_environr�rr�rr�rr�)r,�ustrs  r6�environzProcess.environs_��� ���*�*���	9��	9��d�G�,�,�8�8�d�4�j�j�8�8�,�"�=��#6�#6�7�7�7r5c��	t��|jS#t$rt|j|j���wxYwr�)�ppid_mapr��KeyErrorrr+r7s r6�ppidzProcess.ppid!sG��	6��:�:�d�h�'�'���	6�	6�	6����$�*�5�5�5�	6���s	��%Ac
��	tj|j��S#t$r�}t	|��r�|���}|td|td|td|td|td|td|td|td|td	|td
f
cYd}~S�d}~wwxYw)NrLrNrPrRrTrVrXrZr\r^)r��proc_memory_infor�rLrMr�r�)r,rR�infos   r6�_get_raw_meminfozProcess._get_raw_meminfo's��	��(���2�2�2���	�	�	� ��%�%�
����(�(����#4�5�6���;�/�0���6�*�+���#4�5�6���<�0�1���#8�9�:���#3�4�5���:�.�/���?�3�4���=�1�2��������
�����#	���s!��
D	�CD�=D	�D�D	c�f�|���}|d}|d}t||f|z�S)Nr7rC)r�rl)r,�trmrns    r6�memory_infozProcess.memory_info=s;��

�!�!�#�#����d����d���c�3�\�A�%�&�&r5c��|���}tj|j��}|t	��z}t||fz�Sr�)r�r��proc_memory_ussr�r�rr)r,�	basic_memrss   r6�memory_full_infozProcess.memory_full_infoGsE���$�$�&�&�	��"�4�8�,�,���{�}�}�����c�W�,�-�-r5c#�$K�	tj|j��}|D]C\}}}}t|��}tst|��}t
|��}||||fV��DdS#t$r }t||j|j	���d}~wwxYwr�)
r��proc_memory_mapsr�r�rr��hexrLrqr+)r,�raw�addr�permrurmrRs       r6�memory_mapszProcess.memory_mapsNs�����	.��'���1�1�C�*-�
.�
.�%��d�D�#�'��-�-���/�(��.�.�D��4�y�y���T�4��-�-�-�-�-�
.�
.���	=�	=�	=�"�#�t�x���<�<�<�����	=���s�A%�%
B�/B
�
Bc�4�tj|j��Sr�)r��	proc_killr�r7s r6�killzProcess.kill]s���~�d�h�'�'�'r5c�:�|tjkrtj|j��dS|ttdt
����ttdt
����fvrtj|j|��dStd���)N�CTRL_C_EVENT�CTRL_BREAK_EVENTzPonly SIGTERM, CTRL_C_EVENT and CTRL_BREAK_EVENT signals are supported on Windows)
�signal�SIGTERMr�r�r�rj�objectr�r�r�)r,�sigs  r6�send_signalzProcess.send_signalas����&�.� � ��N�4�8�$�$�$�$�$�
�W�V�^�V�X�X�>�>��V�%7����B�B�D�D�D��G�D�H�c�"�"�"�"�"��+�,�,�
,r5Nc�8�|�
tj}nt|dz��}ttdtj��}|�
|��|znd}	tj|j|��}n@#tj$rt||j|j���tj	$rd}YnwxYwd}	t|j��s|S|r*|��|krt||j|j����t	j|��t|dzd��}�j)Ni��	monotonicrTror7r�)
r��INFINITE�intrjr��	proc_waitr�rr+�TimeoutAbandoned�
pid_existsr�r�)r,�timeout�cext_timeout�timer�stop_at�	exit_coder�s       r6�waitzProcess.waitnsA���?��=�L�L��w��~�.�.�L���k�4�9�5�5��'.�':�%�%�'�'�G�#�#���	���t�x��>�>�I�I���"�	@�	@�	@� ��$�(�D�J�?�?�?��$�		�		�		��I�I�I�		������	)��d�h�'�'�
!� � ��
M�5�5�7�7�g�-�-�$�W�$�(���L�L�L�L��J�u�������	�4�(�(�E�
	)s�A/�/:B,�+B,c��|jdvrdStj|j��\}}t|��dzt|��zS)N�rr"zNT AUTHORITY\SYSTEMr�)r�r��
proc_usernamer�)r,�domainras   r6rBzProcess.username�sK���8�v���)�)��)�$�(�3�3�����V�$�$�t�+�m�D�.A�.A�A�Ar5c���	tj|j��\}}}|S#t$r?}t	|��r*|���tdcYd}~S�d}~wwxYw)Nr>)r��
proc_timesr�rLrMr�r�)r,rarb�createdrRs     r6r>zProcess.create_time�s���	�$(�O�D�H�$=�$=�!�D�&�'��N���	�	�	� ��%�%�
C����(�(��=�)A�B�B�B�B�B�B�B������	���s �!�
A*�3A%�A*�$A%�%A*c�L�|���tdS)Nr?)r�r�r7s r6r?zProcess.num_threads�s����� � ��=�!9�:�:r5c��tj|j��}g}|D]1\}}}tj|||��}|�|���2|Sr�)r��proc_threadsr�r�pthreadr�)r,r�r�	thread_id�utime�stime�ntuples       r6�threadszProcess.threads�s\���#�D�H�-�-����'.�	#�	#�#�I�u�e��_�Y��u�=�=�F��N�N�6�"�"�"�"��r5c�0�	tj|j��\}}}na#t$rT}t	|��s�|���}|td}|td}Yd}~nd}~wwxYwtj||dd��S)Nr<r=r�)	r�r�r�rLrMr�r�r�	pcputimes)r,rarbr�rRr�s      r6r�zProcess.cpu_times�s���	4�$(�O�D�H�$=�$=�!�D�&�'�'���	4�	4�	4�$�S�)�)�
���?�?�$�$�D��	�+�.�/�D��)�M�2�3�F�F�F�F�F�F�����	4����� ��v�s�C�8�8�8s� �
A>�A
A9�9A>c�:�tj|jd��dS)NT�r��proc_suspend_or_resumer�r7s r6�suspendzProcess.suspend�s���#�D�H�d�3�3�3�3�3r5c�:�tj|jd��dS)NFr�r7s r6�resumezProcess.resume�s���#�D�H�e�4�4�4�4�4r5c���|jdvrt|j|j���tj|j��}ttj�|����S)Nr�)	r�rr+r��proc_cwdr�r�ru�normpath)r,rus  r6�cwdzProcess.cwd�sV���8�v����t�x���4�4�4��}�T�X�&�&���R�W�-�-�d�3�3�4�4�4r5c�J�|jdvrgSt��}tj|j��}|D]`}t	|��}t|��r@tst|��}tj	|d��}|�
|���at|��S)Nr�r-)r�r�r��proc_open_filesr�rrr�r�	popenfiler�r�)r,r��raw_file_names�_filer�s     r6�
open_fileszProcess.open_files�s����8�v����I��e�e��
�-�d�h�7�7��#�	 �	 �E�$�U�+�+�E��U�#�#�
 ��1�)�%�0�0�E� �*�5�"�5�5�����������C�y�y�r5�inetc�.�t||j���S)N)r�)r�r�)r,r�s  r6�connectionszProcess.connections�s���t�$�(�3�3�3�3r5c�d�tj|j��}t�t	|��}|Sr�)r��proc_priority_getr��enumr0�r,�values  r6�nice_getzProcess.nice_get�s*���&�t�x�0�0�����U�O�O�E��r5c�6�tj|j|��Sr�)r��proc_priority_setr�rs  r6�nice_setzProcess.nice_set�s���%�d�h��6�6�6r5c�d�tj|j��}t�t	|��}|Sr�)r��proc_io_priority_getr�rr9r�s  r6�
ionice_getzProcess.ionice_get�s*���'���1�1�����S�/�/�C��
r5c��|rtd���|ttttfvrtd|z���t
j|j|��dS)Nz&value argument not accepted on Windowsz%s is not a valid priority)	�	TypeErrorr%r&r'r(r�r��proc_io_priority_setr�)r,�ioclassrs   r6�
ionice_setzProcess.ionice_setsd���	F��D�E�E�E��>�:�}�&�(�(�(��9�G�C�D�D�D��!�$�(�G�4�4�4�4�4r5c	��	tj|j��}n�#t$r�}t	|��s�|���}|td|td|td|td|td|tdf}Yd}~nd}~wwxYwt|�S)NrArBrDrFrHrJ)r��proc_io_countersr�rLrMr�r�rx)r,r�rRr�s    r6�io_counterszProcess.io_counters
s���
	��'���1�1�C�C���	�	�	�$�S�)�)�
���?�?�$�$�D��Y�{�+�,��Y�{�+�,��Y�{�+�,��Y�{�+�,��Y�0�1�2��Y�0�1�2�
�C�C�C�C�C�C�����		�����C�y�s��
C�BB=�=Cc�h�tj|j��}|rtjStjSr�)r��proc_is_suspendedr�r�STATUS_STOPPED�STATUS_RUNNING)r,�	suspendeds  r6r�zProcess.statuss.���*�4�8�4�4�	��	*��)�)��)�)r5c�P�d�}tj|j��}||��S)Nc�:���fd�td��D��S)Nc�$��g|]}d|z�z�
|��
S)rr4)r��ir�s  �r6r�zBProcess.cpu_affinity_get.<locals>.from_bitmask.<locals>.<listcomp>'s&���9�9�9�!�Q�!�V�q�L�9�A�9�9�9r5�@r)r�s`r6�from_bitmaskz.Process.cpu_affinity_get.<locals>.from_bitmask&s#���9�9�9�9�u�R�y�y�9�9�9�9r5)r��proc_cpu_affinity_getr�)r,r �bitmasks   r6�cpu_affinity_getzProcess.cpu_affinity_get$s3��	:�	:�	:��,�T�X�6�6���|�G�$�$�$r5c�R�d�}tttt��������}|D]F}||vr@t	|t
tf��std|z���td|z����G||��}tj
|j|��dS)Nc�L�|std|z���d}|D]
}|d|zz}�|S)Nzinvalid argument %rrr7)r�)�ls�out�bs   r6�
to_bitmaskz,Process.cpu_affinity_set.<locals>.to_bitmask-sF���
=� �!6��!;�<�<�<��C��
�
���q�A�v�
����Jr5z&invalid CPU %r; an integer is requiredzinvalid CPU %r)r�rr�r�r�r�rrr�r��proc_cpu_affinity_setr�)r,rr)�allcpus�cpur"s      r6�cpu_affinity_setzProcess.cpu_affinity_set+s���	�	�	��u�S����1�1�2�2�3�3���	=�	=�C��'�!�!�!�#��T�{�3�3�=�#�@�3�F�H�H�H�%�%5��%;�<�<�<�"��*�U�#�#���"�4�8�W�5�5�5�5�5r5c���	tj|j��S#t$r?}t	|��r*|���tdcYd}~S�d}~wwxYw)Nr:)r��proc_num_handlesr�rLrMr�r�rQs  r6r:zProcess.num_handlesDsv��	��(���2�2�2���	�	�	� ��%�%�
C����(�(��=�)A�B�B�B�B�B�B�B������	���s ��
A$�3A�A$�A�A$c�v�|���td}tj|d��S)Nr;r)r�r�r�pctxsw)r,r;s  r6�num_ctx_switcheszProcess.num_ctx_switchesMs-�����(�(��>�)B�C���~�l�A�.�.�.r5r�)r�),r1r2r3rc�	__slots__r-r�r�rr�r�r|r�r�r�r�r�r�r�r�r�r�r�r�rBr>r?r�r�r�r�r�r�rrr
r
rrr�r#r-r:r2r4r5r6r�r��s�������;�;�3�3�3�I����&�&�&�(�(�(�������
,�
,�
,��������_��&��3�3����_�3�$��8�8����_�8�6�6�6����,�'�'��_�'��.�.��_�.�
.�
.�
.��(�(��_�(��
,�
,��_�
,��()�()�()��_�()�T�B�B��_�B��	�	��_�	��;�;��_�;�����_���
9�
9��_�
9��4�4��_�4��5�5��_�5���5�5����_�5�����_��$�4�4�4��_�4�����_���7�7��_�7�����_���5�5��_�5�����_��"�*�*��_�*��%�%��_�%��6�6��_�6�0����_���/�/��_�/�/�/r5r�r4)r-)NN)�rcrdrgryr�r��sysr��collectionsr�rrrrr	r
rrr
rrrrr�_compatrrrrrrrrrrrrr��ImportErrorrRr��lowerr��getwindowsversionrK�RuntimeError�version_infor�__extra__all__r)r��builtin_module_namesr�r*�IntEnumr.�MIB_TCP_STATE_ESTAB�CONN_ESTABLISHED�MIB_TCP_STATE_SYN_SENT�
CONN_SYN_SENT�MIB_TCP_STATE_SYN_RCVD�
CONN_SYN_RECV�MIB_TCP_STATE_FIN_WAIT1�CONN_FIN_WAIT1�MIB_TCP_STATE_FIN_WAIT2�CONN_FIN_WAIT2�MIB_TCP_STATE_TIME_WAIT�CONN_TIME_WAIT�MIB_TCP_STATE_CLOSED�
CONN_CLOSE�MIB_TCP_STATE_CLOSE_WAIT�CONN_CLOSE_WAIT�MIB_TCP_STATE_LAST_ACK�
CONN_LAST_ACK�MIB_TCP_STATE_LISTEN�CONN_LISTEN�MIB_TCP_STATE_CLOSING�CONN_CLOSING�MIB_TCP_STATE_DELETE_TCB�PSUTIL_CONN_NONE�	CONN_NONEr�r0�globalsr`�__members__r%r&r'r(r9rr�r`rfrl�_fieldsrrrtr�rvrxr�r�r�r�r��disk_io_countersr�r�r�r�r�r�r�r�r�r�r�r�rr	rrrrr#r$r�r#�pidsr�r�rMrqr|r�r�r4r5r6�<module>r^s	��
'�&�������������	�	�	�	�
�
�
�
�
�
�
�
�����"�"�"�"�"�"�������!�!�!�!�!�!�������#�#�#�#�#�#�������������"�"�"�"�"�"�"�"�"�"�"�"�������+�+�+�+�+�+�"�"�"�"�"�"�(�(�(�(�(�(�#�#�#�#�#�#�"�"�"�"�"�"�������������������������������8�8�8�8�8�8�8�8�8�8�8�8�0�0�0�0�0�0�0�0�0�0�0�0�2�2�2�2�2�2�4�4�4�4�4�4��)�)�)�)�)�)�)������
�s�3�x�x�~�~���"�"�#4�5�5��!�C�!�#�#�A�&��*�*�
D���K�K���)�)���l�3����
�����������v����K�K�K�K��D�
�
�
��"�����S�-�-���<��G�G� �D�L��9�b�/�B�B�M��#�G�	��g�6����!6����!6�� �'�"8�� �'�"8�� �'�"8���w�1��!�7�#:����!6���w�2���� 4��!�?���7�,��� ��:�:�:�:�:�4�<�:�:�:��G�I�I���X�)�*�*�*��<��N��J��M��K�K������T�\����
�G�I�I���Z�+�,�,�,��D�
�
�
���
���
��a�
���	
�
��
���

��a�
��a�
��a�
��a�
��B�
��B�
��B�
��b�
�
��
� �B�!
�"�r�#
�$��%
�&�2�'
�(�R�)
�*�"�+
�,��-
�	�@
�J�{�E�E�E�
G�
G�	�	�
�7�M�M�M�N�N���z�
�
5�
5�
5�6�6���:�j�$�,��":�;�;���
�?�V�U�O�<�<�
��J������-�*?�!@�!@�@�
B�
B�	��j��7�7�7�8�8����3����	0�	0���	0�
5�
5�
5�	���	���
4�
4�
4�;�;�;��(��	:�	:�	:�4�4�4�A�A�A����$�$�$�
!�!�!�
'�'�'�>�>�>���9�9�9�&����$���A�A�A����>�>�>�2�����	�	�	�"O�O�O����z�z�z�z�z�V�z�z�z�R�y��
�_�
��=��H�H�H�����������4J/�J/�J/�J/�J/�f�J/�J/�J/�J/�J/s�<C�D.�A!D)�)D.

?>