⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.30
Server IP:
45.79.8.107
Server:
Linux localhost 5.15.0-140-generic #150-Ubuntu SMP Sat Apr 12 06:00:09 UTC 2025 x86_64
Server Software:
nginx/1.18.0
PHP Version:
8.1.2-1ubuntu2.21
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
lib
/
python3
/
dist-packages
/
httplib2
/
__pycache__
/
View File Name :
socks.cpython-310.pyc
o ™³_õL ã @ sð d Z ddlZddlZddlZddlZeeddƒdu redƒ‚dZdZdZ dZ daejZG d d „ d e ƒZG dd„ deƒZG d d„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZdZdZdZdZ d dd„Zdd„ ZG dd„ dejƒZdS )!a SocksiPy - Python SOCKS module. Version 1.00 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 DAMANGE. 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. é NÚsocketz-socket.socket missing, proxy support unusableé é é é c @ ó e Zd ZdS )Ú ProxyErrorN©Ú__name__Ú __module__Ú__qualname__© r r ú0/usr/lib/python3/dist-packages/httplib2/socks.pyr 7 ó r c @ r )ÚGeneralProxyErrorNr r r r r r ; r r c @ r )ÚSocks5AuthErrorNr r r r r r ? r r c @ r )ÚSocks5ErrorNr r r r r r C r r c @ r )ÚSocks4ErrorNr r r r r r G r r c @ r )Ú HTTPErrorNr r r r r r K r r )Zsuccesszinvalid dataz not connectedz not availablezbad proxy typez bad input) Ú succeededzgeneral SOCKS server failurez!connection not allowed by rulesetzNetwork unreachablezHost unreachablezConnection refusedzTTL expiredzCommand not supportedzAddress type not supportedz Unknown error)r zauthentication is requiredz0all offered authentication methods were rejectedz$unknown username or invalid passwordú unknown error)zrequest grantedzrequest rejected or failedzLrequest rejected because SOCKS server cannot connect to identd on the clientzPrequest rejected because the client program and identd report different user-idsr Tc C s | |||||fa dS )z´setdefaultproxy(proxytype, addr[, port[, rdns[, username[, password]]]]) Sets a default proxy which all further socksocket objects will use, unless explicitly changed. N)Ú _defaultproxy)Ú proxytypeÚaddrÚportÚrdnsÚusernameÚpasswordr r r Úsetdefaultproxyw s r c C s t dkr t| j_dS tdƒ‚)a7 wrapmodule(module) Attempts to replace a module's socket library with a SOCKS socket. Must set a default proxy using setdefaultproxy(...) first. This will only work on modules that import socket directly into the namespace; most of the Python Standard Library falls into this category. N)r zno proxy specified)r Ú socksocketr r )Úmoduler r r Ú wrapmodule‚ s r! c sž e Zd ZdZejejddfdd„Zdd„ Z‡ fdd „Z d d„ Z dd „ Z ddd„Zdd„ Z dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Z‡ ZS ) r a socksocket([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, type=SOCK_STREAM and proto=0. r Nc C s> t | ||||¡ td krt| _nd| _d | _d | _d| _d S )N)NNNNNNT)Ú _orgsocketÚ__init__r Ú_socksocket__proxyÚ_socksocket__proxysocknameÚ_socksocket__proxypeernameÚ_socksocket__httptunnel)ÚselfZfamilyÚtypeÚprotoZ_sockr r r r# ˜ s zsocksocket.__init__c C sL | |¡}t|ƒ|k r$| |t|ƒ ¡}|stdƒ‚|| }t|ƒ|k s|S )z®__recvall(count) -> data Receive EXACTLY the number of bytes requested from the socket. Blocks until the required number of bytes have been received. )r zconnection closed unexpectedly)ÚrecvÚlenr )r( ÚcountÚdataÚdr r r Z __recvall¤ s üzsocksocket.__recvallc s( | j s| |¡}tt| ƒj|g|¢R Ž S )zq override socket.socket.sendall method to rewrite the header for non-tunneling proxies if needed )r' Ú_socksocket__rewriteproxyÚsuperr Úsendall)r( ZcontentÚargs©Ú __class__r r r2 ± s zsocksocket.sendallc C sî d\}}| d¡}|D ]}| ¡ d¡r|}q| ¡ d¡s%| ¡ d¡r'|}q|rr|rr| |¡ | |¡ | d¡d }| d¡}| jd d krX| jd d krX| d| ¡ ¡ | dd| ¡ | dd |d ||d |d f ¡ d |¡S )zÒ rewrite HTTP request headers to support non-tunneling proxies (i.e. those which do not support the CONNECT method). This only works for HTTP (not HTTPS) since HTTPS requires tunneling. )NNú zhost:ÚgetZpostú r r Né r zHost: %sz%s http://%s%s %sr )ÚsplitÚlowerÚ startswithÚremover$ ÚinsertÚ_socksocket__getauthheaderÚjoin)r( ÚheaderÚhostZendptZhdrsZhdrr r r Z__rewriteproxy¹ s$ € $ zsocksocket.__rewriteproxyc C s* | j d d | j d }dt |¡ ¡ S )Nr ó :r9 zProxy-Authorization: Basic )r$ Úbase64Z b64encodeÚdecode)r( Zauthr r r Z__getauthheaderÐ s zsocksocket.__getauthheaderTc C s0 |||||r | ¡ nd|r| ¡ nd|f| _dS )a setproxy(proxytype, addr[, port[, rdns[, username[, password]]]]) Sets the proxy to be used. proxytype - 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 preformed 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. headers - Additional or modified headers for the proxy connect request. N)Úencoder$ )r( r r r r r r Úheadersr r r ÚsetproxyÔ s ùzsocksocket.setproxyc C sú | j d dkr| j d dkr| t ddddd¡¡ n| t dddd¡¡ | d¡}|dd… tdƒ ¡ krC| ¡ tdt d fƒ‚|dd… tdƒ ¡ krPn‘|dd… tdƒ ¡ krÃt ƒ }| d¡ | t| j d ƒ¡ | | j d ¡ | t| j d ƒ¡ | | j d ¡ | |¡ | d¡}|dd… tdƒ ¡ krª| ¡ tdt d fƒ‚|dd… tdƒ ¡ krÂ| ¡ td td fƒ‚n| ¡ |d td ƒ ¡ krÙtdtd fƒ‚tdt d fƒ‚t dddd¡}zt |¡}|tdƒ ¡ | }W n: tjy4 | j d r d}|td ƒ ¡ tt|ƒƒ ¡ | ¡ }nt t |¡¡}|tdƒ ¡ | }Y nw |t d|¡ }| |¡ | d¡}|dd… tdƒ ¡ kr`| ¡ tdt d fƒ‚|dd… tdƒ ¡ kr˜| ¡ t|dd… ƒdkrtt|dd… ƒtt|dd… ƒ fƒ‚td td fƒ‚|d d… tdƒ ¡ kr«| d¡} n,|d d… td ƒ ¡ krË|| d¡ }| t|dd… ƒ¡} n| ¡ tdt d fƒ‚t d| d¡¡d } | | f| _|dkröt |¡|f| _dS ||f| _dS )zk__negotiatesocks5(self,destaddr,destport) Negotiates a connection through a SOCKS5 server. r Nr9 ÚBBBBr r ZBBBr r éÿ ú>Hé é )r$ r2 ÚstructÚpackÚ_socksocket__recvallÚchrrF Úcloser Ú_generalerrorsÚ bytearrayÚappendr, Úextendr Ú_socks5autherrorsr Ú inet_atonÚerrorÚ gethostbynameÚordr Ú _socks5errorsr+ Úunpackr% Ú inet_ntoar&