Your IP : 18.227.13.119
3
�2;Z~ � @ sX d Z ddlmZ ddlmZ ddlmZmZmZ ddl Z ddl
mZ ddlZddl
Z
ddl
mZ ddlZddlZddlZdZe
jd kr�ejdCk r�yddlZW n ek
r� ed��Y nX eje�Zd ZZd
ZZd
ZZeeed�Z e!e"e j#� e j$� ��Z%ej Z&Z'dd� Z(G dd� de)�Z*G dd� de*�Z+G dd� de*�Z,G dd� de*�Z-G dd� de*�Z.G dd� de*�Z/G dd� de*�Z0dd d!d"�Z1d#d$d%d&d'd(d)d*d+�Z2ed,ed,ed-iZ3dDd/d0�Z4d1d2� Z5d3d4� Z6e6Z7d5d6� Z8e8Z9dEd7d8�Z:G d9d:� d:ej�Z;d;d<� Z<xBdFD ]:Ze=e;ed�Z>e?e>e��se;j@jAe� eBe;ee<e�� �qW G dAdB� dBe;�ZCdS )Ga�
SocksiPy - Python SOCKS module.
Copyright 2006 Dan-Haim. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of Dan Haim nor the names of his contributors may be used
to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY DAN HAIM "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL DAN HAIM OR HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This module provides a standard socket-like interface for Python
for tunneling connections through SOCKS proxies.
===============================================================================
Minor modifications made by Christopher Gilbert (http://motomastyle.com/)
for use in PyLoris (http://pyloris.sourceforge.net/)
Minor modifications made by Mario Vilas (http://breakingcode.wordpress.com/)
mainly to merge bug fixes found in Sourceforge
Modifications made by Anorov (https://github.com/Anorov)
-Forked and renamed to PySocks
-Fixed issue with HTTP proxy failure checking (same bug that was in the
old ___recvall() method)
-Included SocksiPyHandler (sockshandler.py), to be used as a urllib2 handler,
courtesy of e000 (https://github.com/e000):
https://gist.github.com/869791#file_socksipyhandler.py
-Re-styled code to make it readable
-Aliased PROXY_TYPE_SOCKS5 -> SOCKS5 etc.
-Improved exception handling and output
-Removed irritating use of sequence indexes, replaced with tuple unpacked
variables
-Fixed up Python 3 bytestring handling - chr(0x03).encode() -> b""
-Other general fixes
-Added clarification that the HTTP proxy connection method only supports
CONNECT-style tunneling HTTP proxies
-Various small bug fixes
� )� b64encode)�Callable)�
EOPNOTSUPP�EINVAL�EAGAINN)�BytesIO)�SEEK_CURz1.6.7�nt� z8To run PySocks on Windows you must install win_inet_pton� � )�SOCKS4�SOCKS5�HTTPc s t j� �� fdd��}|S )Nc sp | d }zNy$|j � }|dkr&|jd� � | |�S tk
rR } z� W Y d d }~X nX W d |dkrj|jd� X d S )Nr TF)�
gettimeout�setblocking� Exception)�args�kwargs�selfZ_is_blocking�e)�function� �/usr/lib/python3.6/socks.py�wrapper] s
z"set_self_blocking.<locals>.wrapper)� functools�wraps)r r r )r r �set_self_blocking[ s r c @ s"