%PDF- %PDF-
Mini Shell

Mini Shell

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

�

=	fh7��T�ddlZddlZddlZddlZddl�ddlZddlZddl�ddl	m
Z
mZddlm
Z
ddlmZm
Z
mZmZmZmZddlmZddlZddlZddlZddlZdZd	ad	ad	ad
ZdZdZd
ZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&d�Z'd�Z(d&d�Z)d�Z*d�Z+d�Z,d�Z-d�Z.d�Z/d�Z0d �Z1d!�Z2d"�Z3d'd#�Z4d$�Z5d%�Z6y)(�N)�*�)�device�utils)�
to_bytes_utf8)�PY3r�
to_unicode�to_string_latin�to_string_utf8�	xStringIO)�http_client��z/cdm/oauth2/v1/tokenz/cdm/ioConfig/v2/adapterConfigsz/cdm/ioConfig/v2/wifiScanz/cdm/ioConfig/v2/wirelessConfigz/ioConfig/v2/wifiDiagnosticsz/cdm/servicesDiscovery��������i�i�c��tj�}d}|j�	|j|j||�|j�y#t
$rtjd�Y�1wxYw#|j�wxYw)NrzUnable to read LEDM Channel)	�io�BytesIO�openEWS_LEDM�readLEDMAllData�readEWS_LEDM�Error�log�debug�	closeLEDM)�dev�response�timeouts   � /usr/share/hplip/base/CdmWifi.py�flushThePortr"<sp���z�z�|�H��G���������C�,�,�h��@�	�
�
����1��	�	�/�0�1��	�
�
��s#�A�A7�4A:�6A7�7A:�:Bc�x�t|�i}d|d<||d<||d<tj|�}d}t|t||�\}}|t
k(stjd|z�ytj|j��}tjtj|��}|day)	N�password�
grant_type�username�tokenz?Request Failed With Response Code %d, enter correct credentialsF�access_tokenT)
r"�json�dumps�
http_post_req�CDM_AUTH_REQ�HTTP_OKrr�loads�strip�ast�literal_evalr')r�unamer$�data�auth�respcodes      r!�getCDMTokenr6Gs������
�D�#�D����D����D����:�:�d��D��D�"�3��d�D�A�N�D�(��w���	�	�S�V^�^�_���z�z�$�*�*�,�'������
�
�4� 0�1���^�$���c	�N�|j�tr)|jd|�dt|��dt�d��n!|jd|�dt|��d��|j|�t	�}	|j|j|�|jd�tj|�}|j�|j�}|j�}||fS#|j�tjd�dt fcYSxYw)NzPOST �� HTTP/1.1
Content-Type: application/json
User-Agent: hplip
Accept: */*
Cache-Control: no-cache
Host:localhost
Connection: keep-alive
Content-Length: �
Authorization: Bearer �

r�Unable to read EWS_LEDM Channelr)rr'�
writeEWS_LEDM�lenr�readLEDMDatar�seekr
�HTTPResponse�begin�getcode�read�
closeEWS_LEDMrr�
HTTP_ERROR)r�URI�	data_jsonr4�replyrr5r3s        r!r+r+\s����������z}�~A�BK�~L�NS�T�	U����^a�be�fo�bp�q�	r����i� ��K�E������)�)�%�0�
�
�
�1�
��+�+�E�2�������#�#�%���}�}����X�~���������	�	�3�4��*�}��s
�=A5C3�3/D$c	��tj|�}|j�tr)|j	d|�dt|��dt�d��n!|j	d|�dt|��d��|j	|�t
�}	|j|j|�|jd�tj|�}d}|r	|j�d}|r�|j#�}|j%�}||fS#tjd�tj d�|d	z}Y�ZxYw#t&$r(|j)�tjd
�YywxYw)NzPATCH z� HTTP/1.1
Content-Type: application/json
User-Agent: hplip
Accept: */*
Host:localhost
Connection: keep-alive
Content-Length: r:r;r�
z&Unable to begin response, retrying ...rrr<)r)r*rr'r=r>rr?rr@r
rArBrr�time�sleeprCrDrrE)rrGr3rHrIr�resultr5s        r!�http_patch_reqrOtsm���
�
�4� �I���������`c�dg�hq�dr�ty�z�	{����DG�HK�LU�HV�W�	X����i� ��K�E�5�����)�)�%�0�
�
�
�1�
��+�+�E�2�����
���� �����#�#�%���}�}����H�}���
��	�	�B�C��
�
�1�
��!������5������	�	�3�4�5�s1�AE�D�+E�.#E�1E�E�.E9�8E9c	�.�|j�tr)|jd|�dt|��dt�d��n!|jd|�dt|��d��t	�}	|j|j|d�|jd�tj|�}|j�|j�}|j�}||fS#t$r(|j�tj!d�YywxYw)NzGET r9r:r;�rr<)rr'r=r>rr?rr@r
rArBrCrDrrErr)rrGrIrr5r3s      r!�http_get_reqrR�s����������y|�}@�AD�}E�FK�L�	M����]`�ad�eh�ai�j�	k��K�E�
5�����)�)�%��4�
�
�
�1�
��+�+�E�2�������#�#�%���}�}����X�~����5������	�	�3�4�5�s�,A6C#�#.D�Dc�6�t|t�\}}|tk(stj	d|z�ytj|j��}d}d}|tkrb|dz
}|ddk(rnTtjd�t|t�\}}|tk(stj	d|z�y|tkr�btj|j��}tjtj|��}|ddk(S)N�$Request Failed With Response Code %drrr�connectionState�	connectedr)rR�	adaptorIdr-rrr)r.r/�MAX_RETRIESrLrMr0r1r*)rr3r5�rdata�	max_triess     r!�eth_connect_checkr[�s���!�#�y�1�N�D�(��w���	�	�8�8�C�D���:�:�d�j�j�l�#�D�
�E��I�
�k�
!��Q��	��!�"�k�1���
�
�1�
�&�s�I�6���x��7�"��I�I�<�x�G�H���k�
!��:�:�e�k�k�m�$�D����D�J�J�t�,�-�D��"�#�{�2�3r7c��tS�N)�hostname)rs r!�getHostnamer_�s	���Or7c��g}t|t�\}}|tk(stj	d|z�|Stj|j��}tjtj|��}|D]A}|dk(s|dk(s�|j||ddd�|j||d��C|r|da|S)NrT�wifi0�wifi1�linksr�href�adapterName)
rR�CDM_ADP_CONFr-rrr)r.r/r0r1r*�appendrW)r�rValr3r5�eachs     r!�getWifiAdaptorIDrj�s���
�D�!�#�|�4�N�D�(��w���	�	�8�8�C�D����:�:�d�j�j�l�#�D����D�J�J�t�,�-�D��3���7�?�d�g�o��K�K��T�
�7�+�A�.�v�6�7��K�K��T�
�=�1�2�3����G�	��Kr7c��d}d}d}d}|d}|d}ddi}t|||�\}}|tttfvrtjd|z�y||||fS)Nr���rr�enabled�truerT)rO�
HTTP_ACCEPTED�HTTP_NOCONTENTr-rr)	r�adaptor_list�state�presense�
adaptor_id�adaptorName�dr3r5s	         r!�setAdaptorPowerrw�sw���E��H��J��K��a��J��q�/�K�	�V��A�"�3�
�A�6�M�D���
�n�W�=�=��	�	�8�8�C�D���{�E�8�3�3r7c��i}	t|t�\}}|tttfvrt
j
d|z�yddd�}t|t|�\}}|tttfvrt
j
d|z�yd}|dk7r�t|t�\}}|tttfvrt
j
d|z�ytj|j��}tjtj|��}|d}|dk7r��t�dd	��}t||�\}}|tk(st
j
d
|z�ytj|j��}tjtj|��}t|d�}||d<d
|d<d|d<|dk(r	|St|�D�]}	|d|	d|d|	z<|d|	d|d|	z<|d|	d|d|	z<|d|	dd|d|	z<|d|	d|d|	z<|d|	d|d|	z<	|d|	d|d |	z<	t#|d|	dd�|d"|	z<	|d|	d#|d$|	z<|dt#|d"|	z�krt#|d"|	z�|d<|dt#|d"|	z�kDs��t#|d"|	z�|d<��|S#t $r,t
j
d!|d|	dz�d|d |	z<Y��wxYw#t $rd|d"|	z<Y��wxYw#t $rd|d$|	z<Y��wxYw)%Nz5get cdm wifiscan Request Failed With Response Code %d�scanProcessing�
undirected)rr�scanTypez7patch cdm wifiscan Request Failed With Response Code %d�readyToScanrr�/�wifiNetworksz>get cdm wifiNetworks list Request Failed With Response Code %d�wifiNetworkList�numberofscanentriesr�signalstrengthminr�signalstrengthmaxr�ssidzssid-%d�channelz
channel-%d�communicationModezcommunicationmode-%d�signalStrength�dBmzdbm-%d�encryptionTypezencryptiontype-%d�authenticationModezauthenticationMode-%d�bssidzbssid-%dz Bssid not present in network -%szsignalstrength-%d�
wpaVersionzwpaVersionPreference-%d)rR�
CDM_WIFI_SCANrorpr-rrrOr)r.r/r0r1r*r>�range�KeyError�int)
rrt�retr3r5rY�
scan_staterG�elementCount�as
          r!�performScanr��s��	�C�	�"�#�}�5�N�D�(��
�n�W�=�=��	�	�I�H�T�U��&�l�C�D�#�C���=�N�E�(��
�n�W�=�=��	�	�K�h�V�W��!�J�
�
�
%�%�c�=�9���h��M�.��A�A��I�I�M�PX�X�Y���:�:�d�j�j�l�+�D��#�#�D�J�J�t�$4�5�D��g��J��
�
%�#�N�
3�C�!�#�s�+�N�D�(��w���	�	�R�U]�]�^���:�:�d�j�j�l�#�D����D�J�J�t�,�-�D��t�-�.�/�L�!-�C��� �C��� �C����q���6�J�3�|�$�	M�A�!%�&7�!8��!;�F�!C�C�	�A�
��$(�):�$;�A�$>�y�$I�C��q� �!�.2�3D�.E�a�.H�I\�.]�C�&��*�+� $�%6� 7�� :�;K� L�U� S�C��1���+/�0A�+B�1�+E�FV�+W�C�#�a�'�(�04�5F�0G��0J�K_�0`�C�'�!�+�,�
+�&*�+<�&=�a�&@��&I��J��N�#�

2�03�D�9J�4K�A�4N�O_�4`�aq�4r�0s��'�!�+�,�
;�6:�;L�6M�a�6P�Q]�6^��-��1�2��&�'�#�c�2E��2I�.J�*K�K�+.�s�3F��3J�/K�+L��'�(��&�'�#�c�2E��2I�.J�*K�K�+.�s�3F��3J�/K�+L��'�(�1	M�2�J��!�
+��	�	�<�d�CT�>U�VW�>X�Y_�>`�`�a�&*��J��N�#�
+���
2�01��'�!�+�,�
2���
;�6:��-��1�2�
;�s6�	K&�L�9L5�&2L�L�L2�1L2�5M	�M	c��t|t�\}}|tk(stj	d|z�ytj|j��}tjtj|��}|D]�}|dk(s|dk(s�||ddd}||ddd}||ddd}||dd	d
d}||dd	dd}	||dd
da||ddd}
|t|
||||	fcSy)Nz5get CDM_ADP_CONF Request Failed With Response Code %drarb�ipv4�address�ip�subnet�gateway�	dnsServer�primary�	secondary�identityr^�name�requestedConfigMethod)rRrfr-rrr)r.r/r0r1r*r^)rrer3r5rir��
subnetmaskr��pridns�sec_dns�addressmodes           r!�getIPConfigurationr�5sB��!�#�|�4�N�D�(��w���	�	�I�H�T�U���:�:�d�j�j�l�#�D����D�J�J�t�,�-�D��	S���7�?�d�g�o��d��F�#�I�.�t�4�B��d��F�+�I�6�x�@�J��4�j��(��3�I�>�G��$�Z��'��4�Y�?�	�J�F��4�j��(��5�k�B�9�M�G��D�z�*�-�j�9�&�A�H��t�*�V�,�Y�7�8O�P�K��x��j�'�6�7�R�R�	Sr7c�$�|dk(rd}i}t|t�\}}|tk(stj	d|z�ytj|j��}tjtj|��}|d=|d}	|||	d<|||	d<|||	d<|||	d	<|||	d
<t|t|�\}}|tk(stjd|z�yt|�stjd�|S)
N�	wpaOrWpa2�autoz<get CDM_WIRELESS_CONFIG Request Failed With Response Code %d�version�preferredProfiler�r�r��wpaVersionPreference�
passPhrasez>patch CDM_WIRELESS_CONFIG Request Failed With Response Code %dz+wifi not connected, remove ethernet and try)rR�CDM_WIRELESS_CONFIGr-r�errorr)r.r/r0r1r*rOrprr[)
rr�r�r��security�keyr�r3r5r�s
          r!�	associater�Hs"���[�(�#��	�C�!�#�':�;�N�D�(��w���	�	�P�S[�[�\���:�:�d�j�j�l�#�D����D�J�J�t�,�-�D��Y���,�-��3E�D�	��/�0�/7�D�	��+�,�%)�D�	��6�"�5I�D�	��1�2�+.�D�	��<�(�#�C�)<�d�C�N�D�(��~�%��	�	�R�U]�]�^���S�!��	�	�?�@��Jr7c�
�g}|Sr]�)rrer�s   r!�getVSACodesr�hs��
�C��Jr7c��d\}}}}||||fS)N)rrri8���r�)rrer�rt�ss_max�ss_min�ss_val�ss_dbms        r!�getSignalStrengthr�ls��%2�"�F�F�F�F��F�F�F�*�*r7c��d\}}}|||fS)N)rrrr�)rre�alg�mode�secretids     r!�getCryptoSuiter�ps��$��C��x���x��r7c�F�d}t|t�\}}|tfvrd}|S)NFT)rRrf�HTTP_UNAUTHORIZED)rrN�_datar5s    r!�checkAuthrequiredr�ts-��
�F�"�3��5�O�E�8��%�&�&����Mr7r])r)7rLr�binascii�xml.parsers.expat�xml�stringr)r0�grrr�sixextr�base.sixextrr	r
rr�sixext.movesr
�sysrXr'rWr^r,rfr�r��
CDM_WIFI_DIAG�CDM_SERVICE_DISCOVERYr-�HTTP_CREATEDrorprFr�r"r6r+rOrRr[r_rjrwr�r�r�r�r�r�r�r�r7r!�<module>r�s���.�	�������!�b�b�%��
����
���	�	��%��0��+�
�7��.�
�0��

�����
���
�
���	��*�05�B5�,4�2�
�"4�K�ZS�&�@�+� �r7

Zerion Mini Shell 1.0