uawdijnntqw1x1x1
IP : 216.73.216.139
Hostname : altar28.supremepanel28.com
Kernel : Linux altar28.supremepanel28.com 4.18.0-553.83.1.lve.el8.x86_64 #1 SMP Wed Nov 12 10:04:12 UTC 2025 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
..
/
..
/
home1
/
..
/
lib
/
modules-load.d
/
..
/
firewalld
/
..
/
python2.7
/
.
/
site-packages
/
socks.pyc
/
/
� �2;Zc @s�dZddlmZddlmZddlmZmZmZddl Z ddl mZddlZddl Z ddl mZddlZddlZddlZdZe jd krejdDkryddlZWqek r�ed��qXneje�Zd ZZdZZd ZZied6ed6ed6Z e!e"e j#�e j$���Z%ejZ&Z'd�Z(de)fd��YZ*de*fd��YZ+de*fd��YZ,de*fd��YZ-de*fd��YZ.de*fd��YZ/de*fd ��YZ0id!d"6d#d$6d%d&6Z1id'd 6d(d6d)d 6d*d+6d,d-6d.d/6d0d16d2d36Z2id4e6d4e6d5e6Z3ddde5ddd6�Z6d7�Z7d8�Z8e8Z9d9�Z:e:Z;ddddde5dddd:� Z<d;ejfd<��YZ=d=�Z>xXdED]PZe?e=ed�Z@eAe@e�se=jBjCe�eDe=ee>e��qqWdBe=fdC��YZEdS(Fs� 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 i����(t b64encode(tCallable(t EOPNOTSUPPtEINVALtEAGAINN(tBytesIO(tSEEK_CURs1.6.7tntiis8To run PySocks on Windows you must install win_inet_ptoniitSOCKS4tSOCKS5tHTTPcs"tj���fd��}|S(Ncs�|d}zVy9|j�}|dkr8|jt�n�||�SWntk r^}�nXWd|dkr|jt�nXdS(Ni(t gettimeouttsetblockingtTruet ExceptiontFalse(targstkwargstselft_is_blockingte(tfunction(s)/usr/lib/python2.7/site-packages/socks.pytwrapper]s (t functoolstwraps(RR((Rs)/usr/lib/python2.7/site-packages/socks.pytset_self_blocking[st ProxyErrorcBs#eZdZdd�Zd�ZRS(s4Socket_err contains original socket.error exception.cCs7||_||_|r3|jdj|�7_ndS(Ns: {0}(tmsgt socket_errtformat(RRR((s)/usr/lib/python2.7/site-packages/socks.pyt__init__ps cCs|jS(N(R(R((s)/usr/lib/python2.7/site-packages/socks.pyt__str__wsN(t__name__t __module__t__doc__tNoneRR(((s)/usr/lib/python2.7/site-packages/socks.pyRnstGeneralProxyErrorcBseZRS((R R!(((s)/usr/lib/python2.7/site-packages/socks.pyR${stProxyConnectionErrorcBseZRS((R R!(((s)/usr/lib/python2.7/site-packages/socks.pyR%stSOCKS5AuthErrorcBseZRS((R R!(((s)/usr/lib/python2.7/site-packages/socks.pyR&�stSOCKS5ErrorcBseZRS((R R!(((s)/usr/lib/python2.7/site-packages/socks.pyR'�stSOCKS4ErrorcBseZRS((R R!(((s)/usr/lib/python2.7/site-packages/socks.pyR(�st HTTPErrorcBseZRS((R R!(((s)/usr/lib/python2.7/site-packages/socks.pyR)�ssRequest rejected or failedi[sLRequest rejected because SOCKS server cannot connect to identd on the clienti\sPRequest rejected because the client program and identd report different user-idsi]sGeneral SOCKS server failures!Connection not allowed by rulesetsNetwork unreachablesHost unreachableisConnection refusedisTTL expiredis(Command not supported, or protocol errorisAddress type not supportedii8i�cCsC|||||r|j�nd|r3|j�ndft_dS(s�Sets a default proxy. All further socksocket objects will use the default unless explicitly changed. All parameters are as for socket.set_proxy().N(tencodeR#t socksockett default_proxy(t proxy_typetaddrtporttrdnstusernametpassword((s)/usr/lib/python2.7/site-packages/socks.pytset_default_proxy�scOs/d|kr"|jd�|d<nt||�S(Nt proxytypeR-(tpopR3(RR((s)/usr/lib/python2.7/site-packages/socks.pytsetdefaultproxy�scCstjS(s4Returns the default proxy, set by set_default_proxy.(R+R,(((s)/usr/lib/python2.7/site-packages/socks.pytget_default_proxy�scCs(tjrt|j_ntd��dS(sAttempts to replace a module's socket library with a SOCKS socket. Must set a default proxy using set_default_proxy(...) first. This will only work on modules that import socket directly into the namespace; most of the Python Standard Library falls into this category.sNo default proxy specifiedN(R+R,tsocketR$(tmodule((s)/usr/lib/python2.7/site-packages/socks.pytwrap_module�s c Cs�|\} }| jd�r-| jd�} n|rT|jd�rT|jd�}nd}x0tj||dtj�D]} | \}}}}}d}y�t|||�}| r�x| D]}|j|�q�Wnt|t t f�r�|j|�n|r|j||||||�n|r3|j |�n|j| |f�|SWqvtjtfk r�}|}|r�|j�d}q�qvXqvW|r�|�ntjd��dS(s�create_connection(dest_pair, *[, timeout], **proxy_args) -> socket object Like socket.create_connection(), but connects to proxy before returning the socket object. dest_pair - 2-tuple of (IP/hostname, port). **proxy_args - Same args passed to socksocket.set_proxy() if present. timeout - Optional socket timeout value, in seconds. source_address - tuple (host, port) for the socket to bind to as its source address before connecting (only for compatibility) t[s[]isgai returned empty list.N(t startswithtstripR#R8tgetaddrinfotSOCK_STREAMR+t setsockoptt isinstancetinttfloatt settimeoutt set_proxytbindtconnectterrorR%tclose(t dest_pairttimeouttsource_addressR-t proxy_addrt proxy_portt proxy_rdnstproxy_usernametproxy_passwordtsocket_optionstremote_hosttremote_portterrtrtfamilytsocket_typetprotot canonnametsatsocktoptR((s)/usr/lib/python2.7/site-packages/socks.pytcreate_connection�s>" t_BaseSocketcBs eZdZd�Ze�ZRS(sBAllows Python 2 delegated methods such as send() to be overridden.cOsZtj|||�t�|_x4|jD])}t||�|j|<t||�q)WdS(N(t_orig_socketRtdictt _savedmethodst _savenamestgetattrtdelattr(Rtpostkwtname((s)/usr/lib/python2.7/site-packages/socks.pyR s (R R!R"RtlistRc(((s)/usr/lib/python2.7/site-packages/socks.pyR_s cs �fd�S(Ncs|j�||�S(N(Rb(RRfRg(Rh(s)/usr/lib/python2.7/site-packages/socks.pyt<lambda>t((Rh((Rhs)/usr/lib/python2.7/site-packages/socks.pyt_makemethodstsendtotsendtrecvfromtrecvR+cBsFeZdZdZejejdd�Zd�Z d�Z d�Zd�Zddde ddd�Zd�Zd �Zd �Zdd�Zdd�Zd �Zd�Zd�ZeZd�ZeZd�ZeZd�Zd�Zd�Zd�Zd�Z d�Z!ie e"6ee#6e!e$6Z%e&d��Z'd�Z(RS(s2socksocket([family[, type[, proto]]]) -> socket object Open a SOCKS enabled socket. The parameters are the same as those of the standard socket init. In order for SOCKS to work, you must specify family=AF_INET and proto=0. The "type" argument must be either SOCK_STREAM or SOCK_DGRAM. icOs�|tjtjfkr6d}t|j|���ntt|�j|||||�d|_ |j ry|j |_n d|_d|_d|_ d|_dS(Ns0Socket type must be stream or datagram, not {!r}(NNNNNN(R8R?t SOCK_DGRAMt ValueErrorRtsuperR+RR#t _proxyconnR,tproxytproxy_socknametproxy_peernamet_timeout(RRWttypeRYRRR((s)/usr/lib/python2.7/site-packages/socks.pyR1s" cCs[d}xNt|�|krV|j|t|��}|sItd��n||7}q W|S(s�Receive EXACTLY the number of bytes requested from the file object. Blocks until the required number of bytes have been received.RksConnection closed unexpectedly(tlentreadR$(Rtfiletcounttdatatd((s)/usr/lib/python2.7/site-packages/socks.pyt_readallCscCsM||_y)|j�}tt|�j|j�Wntjk rHnXdS(N(Rxtget_proxy_peernameRsR+RDR8RH(RRKtpeer((s)/usr/lib/python2.7/site-packages/socks.pyRDOs cCs|jS(N(Rx(R((s)/usr/lib/python2.7/site-packages/socks.pyRXscCs'|r|jd�n |jd�dS(Ng(RDR#(Rtv((s)/usr/lib/python2.7/site-packages/socks.pyR[scCsC|||||r|j�nd|r3|j�ndf|_dS(s� Sets the proxy to be used. proxy_type - The type of the proxy to be used. Three types are supported: PROXY_TYPE_SOCKS4 (including socks4a), PROXY_TYPE_SOCKS5 and PROXY_TYPE_HTTP addr - The address of the server (IP or DNS). port - The port of the server. Defaults to 1080 for SOCKS servers and 8080 for HTTP proxy servers. rdns - Should DNS queries be performed on the remote side (rather than the local side). The default is True. Note: This has no effect with SOCKS4 servers. username - Username to authenticate with to the server. The default is no authentication. password - Password to authenticate with to the server. Only relevant when username is also provided.N(R*R#Ru(RR-R.R/R0R1R2((s)/usr/lib/python2.7/site-packages/socks.pyREascOs2d|kr"|jd�|d<n|j||�S(NR4R-(R5RE(RRR((s)/usr/lib/python2.7/site-packages/socks.pytsetproxyvscOsi|j\}}}}}}|s4|jtjkrGtj|||�S|jretjtd��n|t kr�d} tjt | ��ntt|�j||�|j �\} }d|f}t�|_|j�} |jj| �d}|j|j||�\} }| \}} |\} }tt|�j||f�tt|�j|j�d|_dS( sVImplements proxy connection for UDP sockets. Happens during the bind() phase.s"Socket already bound to an addresss'UDP only supported by SOCKS5 proxy typet0ss0.0.0.0iN(s0.0.0.0i(RuRyR8RqR`RFRtRHRR RRsR+tgetsocknamet_proxy_addrRGt_SOCKS5_requestRDRxRv(RRfRgR-RMRNR0R1R2Rt_R/tdstRut UDP_ASSOCIATEtrelaythost((s)/usr/lib/python2.7/site-packages/socks.pyRF{s* c Os�|jtjkr.tt|�j|||�S|jsG|jd�n|d}|d }t�}d}|j |�d}|j |�|j ||�tt|�j|j�|||�} | |j �S(NRkii����ss(Rki(RyR8RqRsR+RmRtRFRtwritet_write_SOCKS5_addressRntgetvaluettell( RtbytesRRtaddresstflagstheadertRSVt STANDALONEtsent((s)/usr/lib/python2.7/site-packages/socks.pyRm�s cKsK|jtjkr+|j|||j|�Stt|�j|||�SdS(N(RyR8RqRmRwRsR+Rn(RR�R�R((s)/usr/lib/python2.7/site-packages/socks.pyRn�sc Cs|jtjkr+tt|�j||�S|jsD|jd�nttt|�j |d|��}|j dt�|jd�}t |�r�td��n|j|�\}}|jr|j\}}||ks�|d|fkrtjtd��qn|j|�||ffS( NRkiiiisReceived UDP packet fragmentsPacket filtered(Rki(RyR8RqRsR+RoRtRFRRptseekRR{tordtNotImplementedErrort_read_SOCKS5_addressRwRHR( RtbufsizeR�tbuftfragtfromhosttfromporttpeerhosttpeerport((s)/usr/lib/python2.7/site-packages/socks.pyRo�s % cOs|j||�\}}|S(N(Ro(RRfRgR�R�((s)/usr/lib/python2.7/site-packages/socks.pyRp�scCs,|jr|jj�ntt|�j�S(N(RtRIRsR+(R((s)/usr/lib/python2.7/site-packages/socks.pyRI�s cCs|jS(s:Returns the bound IP address and port number at the proxy.(Rv(R((s)/usr/lib/python2.7/site-packages/socks.pytget_proxy_sockname�scCs |j�S(s> Returns the IP and port number of the proxy. (tgetpeername(R((s)/usr/lib/python2.7/site-packages/socks.pyR��scCs|jS(swReturns the IP address and port number of the destination machine. Note: get_proxy_peername returns the proxy.(Rw(R((s)/usr/lib/python2.7/site-packages/socks.pytget_peername�scGs+d}|j|||�\|_|_dS(s7Negotiates a stream connection through a SOCKS5 server.sN(R�RwRv(Rt dest_addrtCONNECT((s)/usr/lib/python2.7/site-packages/socks.pyt_negotiate_SOCKS5�scCs�|j\}}}}}} |jd�} |jdd�}zI|r[| r[| jd�n | jd�| j�|j|d�}|dd!dkr�td ��n|dd!d kr]| jdtt|��j�|tt| ��j�| �| j�|j|d�} | dd!dkr8td ��n| dd!dkr�t d ��q�nD|dd!dkr�|dd!dkr�t d��q�td ��n| jd|d�|j || �}| j�|j|d�}|dd!dkrtd ��nt|dd!�}|dkrRtj |d�}tdj||���n|j|�}tt|�j|j�||fSWd|j�| j�XdS(s� Send SOCKS5 request with given command (CMD field) and address (DST field). Returns resolved DST address that was used. twbtrbissiiss%SOCKS5 proxy server sent invalid datassssSOCKS5 authentication faileds�s7All offered SOCKS5 authentication methods were rejectedis Unknown errors {0:#04x}: {1}N(RutmakefileR�tflushR�R$tchrRzR*R&R�R�t SOCKS5_ERRORStgetR'RR�RsR+RDRxRI(RtconntcmdR�R-R.R/R0R1R2twritertreadertchosen_authtauth_statustresolvedtresptstatusRHtbnd((s)/usr/lib/python2.7/site-packages/socks.pyR��sX ; cCs�|\}}|j\}}}}}} idtj6dtj6} x�tjtjfD]�}y`tj||�}|j| ||�tj||�}|jtjd|��||fSWqTtj k r�qTqTXqTW|r|j d�} |jdtt| ��j �| �n�tj ||tjtjtjtj�}|d}|d}|dd}tj||�}|j| ||�tj||�}|jtjd|��||fS(s~ Return the host and port packed for the SOCKS5 protocol, and the resolved address as a tuple object. sss>Htidnasii(RuR8tAF_INETtAF_INET6t inet_ptonR�t inet_ntoptstructtpackRHR*R�RzR>t AF_UNSPECR?tIPPROTO_TCPt AI_ADDRCONFIG(RR.R|R�R/R-R�R0R1R2tfamily_to_byteRWt addr_bytest host_bytest addressesttarget_addr((s)/usr/lib/python2.7/site-packages/socks.pyR�Ms6* cCs�|j|d�}|dkr<tj|j|d��}nu|dkru|j|d�}|j|t|��}n<|dkr�tjtj|j|d��}ntd��tjd|j|d ��d }||fS(Nisissis%SOCKS5 proxy server sent invalid datas>Hii( R�R8t inet_ntoaR�R�R�R$R�tunpack(RR|tatypR.tlengthR/((s)/usr/lib/python2.7/site-packages/socks.pyR�zs$"cCs|j\}}}}}}|jd�} |jdd�} z�t}ytj|�}WnAtjk r�|r�d}t}q�tjtj|��}nX| jt j ddd|��| j|�|r�| j|�n| jd�|r| j|jd �d�n| j�|j | d �} | dd!dkrLtd��nt| dd!�}|d kr�tj|d�}tdj||���ntj| d�t jd| dd!�df|_|r�tj|�|f|_n||f|_Wd| j�| j�XdS(s0Negotiates a connection through a SOCKS4 server.R�R�iss>BBHiisR�is%SOCKS4 proxy server sent invalid dataiiZs Unknown errors {0:#04x}: {1}s>HN(RuR�RR8t inet_atonRHR t gethostbynameR�R�R�R*R�R�R$R�t SOCKS4_ERRORSR�R(RR�R�RvRwRI(RR�t dest_portR-R.R/R0R1R2R�R�tremote_resolveR�R�R�RH((s)/usr/lib/python2.7/site-packages/socks.pyt_negotiate_SOCKS4�sH # cCs�|j\}}}}}}|r'|ntj|�}d|jd�dt|�j�dd|jd�g} |r�|r�| jdt|d|��n| jd�|jdj| ��|j �} | j �}| j�|s�td��ny|j d d �\}} }Wntk r:td��nX|jd�sYtd ��nyt| �} Wntk r�td��nX| dkr�dj| |�}| dkr�|d7}nt|��nd|_||f|_dS(swNegotiates a connection through an HTTP server. NOTE: This currently only supports HTTP CONNECT-style proxies.sCONNECT R�t:s HTTP/1.1sHost: sProxy-Authorization: basic s sConnection closed unexpectedlyt is'HTTP proxy server sent invalid responsesHTTP/s0Proxy server does not appear to be an HTTP proxys4HTTP proxy server did not return a valid HTTP statusi�s{0}: {1}i�i�i�sa [*] Note: The HTTP proxy server may not be supported by PySocks (must be a CONNECT tunnel proxy)s0.0.0.0iN(i�i�i�(s0.0.0.0i(RuR8R�R*tstrtappendRtsendalltjoinR�treadlineRIR$tsplitRrR<RBR)RRvRw(RR�R�R-R.R/R0R1R2thttp_headerstfobjtstatus_lineRYtstatus_codet status_msgRH((s)/usr/lib/python2.7/site-packages/socks.pyt_negotiate_HTTP�sB( cCs�t|�dks%|djd�rAtjdt|���n|\}}|jtjkr�|jsx|jd �ntj |�}|dkr�|r�d|_n||f|_dS|j\}}}}}} t |ttf�st|�dks|st |t�r"td��ntt|�j|j�|dkr�||_tt|�j|j�tt|�j||f�dS|j�}ytt|�j|�Wn|tjk r-} |j�|\}}d j||�}t|}d j||�} tjd| | �t| | ��nqXy!|j|}||||�WnLtjk r�} |j�td| ��ntk r�|j��nXdS(s� Connects to the specified destination through a proxy. Uses the same API as socket's connect(). To select the proxy server, use set_proxy(). dest_pair - 2-tuple of (IP/hostname, port). iiR;s PySocks doesn't support IPv6: %sRks0.0.0.0Ns0Invalid destination-connection (host, port) pairs{0}:{1}s!Error connecting to {0} proxy {1}s %s due to: %ssSocket error(Rki( RzR<R8RHR�RyRqRtRFR�R#RwRuRARittupleRBR$RsR+RDRxRGR�RIRtPRINTABLE_PROXY_TYPEStlogtdebugR%t_proxy_negotiatorsR(RRJR�R�R-RMRNR0R1R2RHtproxy_servertprintable_typeRt negotiate((s)/usr/lib/python2.7/site-packages/socks.pyRGs\ % cCsO|j\}}}}}}|p-tj|�}|sEtd��n||fS(sD Return proxy address to connect to as tuple object sInvalid proxy type(Rut DEFAULT_PORTSR�R$(RR-RMRNR0R1R2((s)/usr/lib/python2.7/site-packages/socks.pyR�]s N()R R!R"R#R,R8R�R?RR�RDRRR RER�RFRmRnRoRpRIR�tgetproxysocknameR�tgetproxypeernameR�R�R�R�R�R�R�R�RR R R�RRGR�(((s)/usr/lib/python2.7/site-packages/socks.pyR+&sF % Z - < ; W(ii(RmRnRoRp(FR"tbase64RtcollectionsRterrnoRRRRtioRtloggingtosRR8R�tsyst__version__Rhtversion_infot win_inet_ptontImportErrort getLoggerR R�tPROXY_TYPE_SOCKS4RtPROXY_TYPE_SOCKS5R tPROXY_TYPE_HTTPR tPROXY_TYPESRatziptvaluestkeysR�t _orgsocketR`RtIOErrorRR$R%R&R'R(R)R�R�R�R#R R3R6R7tgetdefaultproxyR:t wrapmoduleR^R_RlRdtmethodRARcR�tsetattrR+(((s)/usr/lib/python2.7/site-packages/socks.pyt<module>7s� ! 8
/home/../../home1/../lib/modules-load.d/../firewalld/../python2.7/./site-packages/socks.pyc