%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/share/hplip/base/__pycache__/
Upload File :
Create Path :
Current File : //usr/share/hplip/base/__pycache__/slp.cpython-312.pyc

�

=	f6��F�ddlZddlZddlZddlZddlZddlZddlZddl�ddlm	Z	ddl
mZmZm
Z
ejdej�Zejdej�Zejdej�Zejd	ej�Zejd
ej�Zejdej�Zejdej�Zejd
ej�Zdd�Zdd�Zy)�N�)�*)�utils)�
to_bytes_utf8�
to_unicode�to_string_utf8z"\(\s*x-hp-prod_id\s*=\s*(.*?)\s*\)z\(\s*x-hp-mac\s*=\s*(.*?)\s*\)z#\(\s*x-hp-num_port\s*=\s*(.*?)\s*\)z\(\s*x-hp-ip\s*=\s*(.*?)\s*\)z&\(\s*x-hp-p1\s*=(?:\d\)|\s*(.*?)\s*\))z&\(\s*x-hp-p2\s*=(?:\d\)|\s*(.*?)\s*\))z&\(\s*x-hp-p3\s*=(?:\d\)|\s*(.*?)\s*\))z\(\s*x-hp-hn\s*=\s*(.*?)\s*\)c��d}	tjtjtjtj�}tjtjtj�}|j	d�|j�d}|j
�|jd�tjd|�}	|jtjtjd�|jtjtjd�	|jtj"tj$|�|jtj"tj&tj(|�tj(d�z�|jtj"tj*d�|S#tj$r*tjd�|r|j
�YywxYw#t tjf$rY��wxYw#t,$r4}tjd|z�|r|j
�Yd}~yd}~wwxYw)N)z1.2.3.4�8r�Bz
Network errorrz0.0.0.0z,Unable to setup multicast socket for SLP: %s)�socket�AF_INET�
SOCK_DGRAM�IPPROTO_UDP�connect�getsockname�close�setblocking�struct�pack�error�log�
setsockopt�
SOL_SOCKET�SO_REUSEADDR�SO_REUSEPORT�AttributeError�SOL_IP�IP_MULTICAST_TTL�IP_MULTICAST_IF�	inet_aton�IP_MULTICAST_LOOP�	Exception)�ttl�s�x�intf�es     �/usr/share/hplip/base/slp.py�createSocketsWithsetOptionr)-s���
�A���M�M�&�.�.�&�*;�*;�V�=O�=O�P���M�M�&�.�.�&�*;�*;�<��	�	�	�/�"��}�}��q�!��	���	�	�
�
�a���k�k�#�s�#��
�	���V�&�&��(;�(;�Q�?�	���V�&�&��(;�(;�Q�?��	���V�]�]�F�$;�$;�S�A�	���V�]�]�F�$:�$:�F�<L�<L�T�<R�U[�Ue�Ue�fo�Up�<p�q�	���V�]�]�F�$<�$<�a�@�
�H��+�<�<���	�	�/�"��
�G�G�I��	��
�F�L�L�)�
��
�����	�	�@�1�D�E��
�G�G�I���	�s>�CG*�AH*�2B6I
�*:H'�&H'�*I�I�
	J�*J�Jc
��d\}}i}t|�}|siSdjtd�tjdtjdd��td�g�}	|j|d||f�|}|dkD�r�tj�}	tj|gg|g|�\}
}}|tj�|	z
z}|
s�U|jd
�\}}
t�tj|d��	tj d
|dd�\
}}}}}}}}}}tj d|z|dd�dj#�}t%|�}	t't(j+|�j-d��}|dk(rd}d|ddddddd�}	t2j+|�j-d�|d<|dxxdz
cc<|dkDro	t4j+|�j-d�|d<|dxxdz
cc<|dkDr5	t6j+|�j-d�|d<|dxxdz
cc<|d�d|d<|d�d|d<|d�d|d<	t8j+|�j-d�|d<	t:j+|�j-d�|d<	t<j+|�j-d�|d<	t>j+|�j-d�|d<||d<|||
d<tjAd|z�|dkDr���|jC�|S#tj$r#}tjd	|z�Yd}~���d}~wwxYw#tj$rY��wxYw#t.t0f$rd}Y��wxYw#t.$r	d|d<Y���wxYw#t.$r	d|d<Y���wxYw#t.$r	d|d<Y���wxYw#t.$r	d|d<Y��qwxYw#t.$r	d|d<Y��^wxYw#t.$r	d|d<Y��KwxYw#t.$r	d|d<Y��8wxYw)N)z
224.0.1.60i��z
,enz!Hri��z service:x-hpnp-discover:rz'Unable to send broadcast SLP packet: %si� )�widthz!BBHBBHHHHH�z!%ds��0)�num_devices�	num_ports�
product_id�status_code�device2�device3�note�device1r8r1r5�r6r3�mac�ip�hnr4zFound device: %s)"r)�joinrrr�random�randint�sendtorrr�time�select�recvfrom�update_spinner�log_data�unpack�stripr�int�num_port_pat�search�groupr�
ValueError�p1_pat�p2_pat�p3_pat�prod_pat�mac_pat�ip_pat�hn_pat�debugr)r#�timeout�
mcast_addr�
mcast_port�
found_devicesr$�packetr'�	time_left�
start_time�r�w�data�addr�ver�func�length�flags�dialect�	lang_code�char_encode�recv_xidr4�attr_lengthr%r2�ys                           r(�detectNetworkDevicesrjPst��-��J�
��M�"�3�'�A���	�
�X�X�}�%O�P����D�&�.�.��E�2�3�]�C}�5~�@�A�F�A�	�����Z��4�5��I�
�a�-��Y�Y�[�
��-�-���R�!��i�8���1�a��d�i�i�k�J�.�/�	��(��Z�Z��%�
��d������T���$�	��
�
�m�T�#�2�Y�7�
j�C��v�u�g�y�+�x�Q\�^i��
�
�f�{�2�D���I�>�q�A�G�G�I�A��!���	��L�/�/��2�8�8��;�<�I���>��I��Y�r��#�#�r�VY�
[��	"�!�=�=��+�1�1�!�4�A�i�L�
�m���!���q�=�
&�%�}�}�Q�/�5�5�a�8��)���-� �A�%� ��1�}�*�#)�=�=��#3�#9�#9�!�#<�A�i�L��m�$��)�$��Y�<���A�i�L��Y�<���A�i�L��Y�<���A�i�L�	!�&�o�o�a�0�6�6�q�9�A�l�O�	��~�~�a�(�.�.�q�1�A�e�H�	��m�m�A�&�,�,�Q�/�A�d�G�	��m�m�A�&�,�,�Q�/�A�d�G�'��-��!"�
�d�1�g���	�	�$�q�(�)�k�a�-�n�G�G�I����y�<�<�A��	�	�;�a�?�@�@��A��(�|�|�	��	��
�
�+�	��I�	���	��A�i�L�	��"�
#�"��)��
#��&�'�#&�A�i�L�'�� �	!� �A�l�O�	!���	��A�e�H�	���	��A�d�G�	���	��A�d�G�	�s��&M	�AN�%-N�%'N4�'O	�'O�,'O3�'P�<'P�$'P2�	M?�M:�:M?�N�N�N1�0N1�4O�O�	O�O�O0�/O0�3P�P�P�P�P/�.P/�2Q�Q)�)rk�
)�sysrArrBrr>�re�gr/r�sixextrrr�compile�
IGNORECASErPrQrIrRrMrNrOrSr)rj�r+r(�<module>rts���.��
�
�
�
�	���=�=��2�:�:�?����O���2�:�:�;�R�]�]�K���r�z�z�D�b�m�m�T���2�:�:�:�B�M�M�J���2�:�:�C�R�]�]�S���2�:�:�C�R�]�]�S���2�:�:�C�R�]�]�S���2�:�:�:�B�M�M�J�� 
�Fir+

Zerion Mini Shell 1.0