OwlCyberSecurity - MANAGER
Edit File: sockshandler.cpython-312.pyc
� ����X��g~���������������������������d�Z�ddlZddlZ �ddlZddlZddl Z d��Zd��Z�e ��������Z�G�d��dej�������������������������Z�G�d��dej"�������������������������Z�G�d ��d ej&������������������ej(�������������������������Zedk(��r�ddlZ ��eej2������������������d����������Z�ej:�������������������ee j<������������������de��������������Z�e dejC������������������d�������jE��������������������������jG��������������������������z������������e dejC������������������d�������jE��������������������������jG��������������������������z�����������yy#�e$�r�ddlmZ�ddlm Z�Y��� w�xY�w#�eef$�r�d ZY���w�xY�w)z� SocksiPy + urllib2 handler version: 0.3 author: e<e@tr0ll.in> This module provides a Handler which you can use with urllib2 to allow it to tunnel your connection through a socks.sockssocket socket, with out monkey patching the original socket... �����Nc������������������H�����|�j��������������������������}|j������������������|��������|S��N)�copy�update)�a�b�ds��� �;/opt/hc_python/lib/python3.12/site-packages/sockshandler.py� merge_dictr������s������ ����A��H�H�Q�K��H�����c����������������������� �d|�v�r%t��������j������������������t���������j������������������|���������yd|�v�rt��������j������������������|���������yy#��Y�yxY�w)N�:�.FT)�socket� inet_pton�AF_INET6� inet_aton)�ss��� r ����is_ipr������sR������ ��!�8����V�_�_�a�0�����A�X����Q���� �����s����(A��A��A c�������������������������e�Zd�Zdd�Zd��Zy)�SocksiPyConnectionNc������������������d�����||||||f|�_���������t��������j������������������j������������������|�g|��i�|���y�r���)� proxyargs�httplib�HTTPConnection�__init__� �self� proxytype� proxyaddr� proxyport�rdns�username�password�args�kwargss ��� r ���r���zSocksiPyConnection.__init__+���s4������#�Y� �4��8�T������'�'��>�t�>�v�>r���c�����������������������|�j�������������������\��}}}}}}|xr�|t��������v} � �t��������j������������������|�j������������������|�j ������������������f|�j������������������d�||||||t��������j������������������t��������j������������������dff� ������} �||�_��������y�#�t��������j������������������$�rG}|r:dt��������|�������v�r-t��������|�j�������������������������sd}t��������j������������������|��������n��Y�d�}~nd�}~ww�xY�w��)N�����0x5bF)r����socks4_no_rdns�socks�create_connection�host�port�timeoutr����IPPROTO_TCP�TCP_NODELAY�SOCKS4Error�strr����add�sock) r���r���r ���r!���r"���r#���r$���r5����es ��� r ����connectzSocksiPyConnection.connect/���s�������FJ�n�n�C��I�y�$��(��7� ��7��� ��.�.��Y�Y�� � �*�D�L�L�$��y�)�T�8�X��(�(�&�*<�*<�a�@�B�D������� ����$�$�� ��F�c�!�f�,�U�4�9�9�5E��!�D�"�&�&�y�1���2�� ���s����AB �� C#�=C�C#�NTNN��__name__� __module__�__qualname__r���r7�����r���r ���r���r���*���s������?�r���r���c�������������������������e�Zd�Zdd�Zd��Zy)�SocksiPyConnectionSNc������������������d�����||||||f|�_���������t��������j������������������j������������������|�g|��i�|���y�r���)r���r����HTTPSConnectionr���r���s ��� r ���r���zSocksiPyConnectionS.__init__D���s4������#�Y� �4��8�T������(�(��?��?��?r���c����������������������t���������j������������������|���������|�j������������������j������������������|�j������������������|�j ��������������������������|�_��������|�j������������������j������������������sG|�j������������������r: �t��������j������������������|�j������������������j��������������������������|�j ��������������������������y�y�y�#�t��������$�rE�|�j������������������j������������������t��������j��������������������������|�j������������������j�����������������������������w�xY�w)N)�server_hostname)r���r7����_context�wrap_socketr5���r-����check_hostname�_check_hostname�ssl�match_hostname�getpeercert� Exception�shutdownr���� SHUT_RDWR�close)r���s��� r ���r7���zSocksiPyConnectionS.connectH���s��������"�"�4�(��M�M�-�-�d�i�i����-�S�� ��}�}�+�+��0D�0D� ��"�"�4�9�9�#8�#8�#:�D�I�I�F��1E�+����� �� � �"�"�6�#3�#3�4�� � ���!�� �s ����/8B*��*AC8r8���r9���r=���r���r ���r?���r?���C���s ������@� r���r?���c�������������������������e�Zd�Zd��Zd��Zd��Zy)�SocksiPyHandlerc������������������^�����||�_���������||�_��������t��������j������������������j ������������������|���������y�r���)r%����kw�urllib2�HTTPHandlerr���)r���r%���r&���s��� r ���r���zSocksiPyHandler.__init__T���s$�������� �������$�$�T�*r���c������������������4�������d��fd� }��j������������������||�������S�)Nc������������������f������t���������j������������������|�������}t���������j������������������|�||d�|��}|S��N)r-���r.���r/���)r���rR���r���r%����r-���r.���r/���r&���rR����connr���s��� �r ����buildz(SocksiPyHandler.http_open.<locals>.buildZ���s3��������D�G�G�V�,�B�%�t�y�y�t�$�PW�^�[]�^�D��Kr����Nr�����do_open�r����reqrZ���s���` r ���� http_openzSocksiPyHandler.http_openY����������� ���|�|�E�3�'�'r���c������������������4�������d��fd� }��j������������������||�������S�)Nc������������������f������t���������j������������������|�������}t���������j������������������|�||d�|��}|S�rW���)r���rR���r?���r%���rX���s��� �r ���rZ���z)SocksiPyHandler.https_open.<locals>.builda���s3��������D�G�G�V�,�B�&�� � ��4�QX�_�\^�_�D��Kr���r[���r\���r^���s���` r ���� https_openzSocksiPyHandler.https_open`���ra���r���N)r:���r;���r<���r���r`���rd���r=���r���r ���rP���rP���S���s������+� (�(r���rP����__main__r(���iZ#��� localhostzHTTP: zhttp://httpbin.org/ipzHTTPS: zhttps://httpbin.org/ip)$�__doc__r���rH���rS���r����ImportError�urllib.request�request�http.client�clientr+���r���r����setr*���r���r���rA���r?���rT����HTTPSHandlerrP���r:����sys�int�argvr.���� ValueError� IndexError�build_opener�PROXY_TYPE_SOCKS5�opener�print�open�read�decoder=���r���r ����<module>r{������sH�������� �"��� � � � �������/�/���2�'�1�1��� (�g�)�)�7�+?�+?��(�(��z�����3�8�8�A�;����"�W� !� !�/�%�2I�2I�;�X\�"]� ^�F� �(�V�[�[�!8�9�>�>�@�G�G�I� I�J� �)�f�k�k�":�;�@�@�B�I�I�K� K�L����o���"�$�!�!�"��v� � �#������s#����D ��9D8�� D5�4D5�8 E�E