Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/twisted/protocols/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

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

�b��@s�dZddlZddlZddlZddlZddlmZmZmZddl	m
Z
Gdd�dej�ZGdd�dej�Z
Gd	d
�d
ej�ZGdd�dej�ZGd
d�dej�ZdS)z)
Implementation of the SOCKSv4 protocol.
�N)�defer�protocol�reactor)�logc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�SOCKSv4OutgoingcC�
||_dS�N)�socks��selfr	�r�9/usr/lib/python3/dist-packages/twisted/protocols/socks.py�__init__�
zSOCKSv4Outgoing.__init__cCs.|j��}|jjdd|j|jd�||j_dS)N�Zr)�port�ip)�	transport�getPeerr	�	makeReplyr�host�	otherConn)r�peerrrr
�connectionMades
zSOCKSv4Outgoing.connectionMadecC�|jj��dSr�r	r�loseConnection�r�reasonrrr
�connectionLost�zSOCKSv4Outgoing.connectionLostcC�|j�|�dSr�r	�write�r�datarrr
�dataReceived!r zSOCKSv4Outgoing.dataReceivedcC�|j�||�|j�|�dSr�r	rrr#r$rrr
r#$�zSOCKSv4Outgoing.writeN)�__name__�
__module__�__qualname__rrrr&r#rrrr
rsrc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�SOCKSv4IncomingcCs||_||j_dSr)r	rr
rrr
r*szSOCKSv4Incoming.__init__cCrrrrrrr
r.r zSOCKSv4Incoming.connectionLostcCr!rr"r$rrr
r&1r zSOCKSv4Incoming.dataReceivedcCr'rr(r$rrr
r#4r)zSOCKSv4Incoming.writeN)r*r+r,rrr&r#rrrr
r-)s
r-c@speZdZdZdefdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zddd�Z
dd�Zdd�ZdS)�SOCKSv4a�
    An implementation of the SOCKSv4 protocol.

    @type logging: L{str} or L{None}
    @ivar logging: If not L{None}, the name of the logfile to which connection
        information will be written.

    @type reactor: object providing L{twisted.internet.interfaces.IReactorTCP}
    @ivar reactor: The reactor used to create connections.

    @type buf: L{str}
    @ivar buf: Part of a SOCKSv4 connection request.

    @type otherConn: C{SOCKSv4Incoming}, C{SOCKSv4Outgoing} or L{None}
    @ivar otherConn: Until the connection has been established, C{otherConn} is
        L{None}. After that, it is the proxy-to-destination protocol instance
        along which the client's connection is being forwarded.
    NcC�||_||_dSr)�loggingr)rr0rrrr
rM�
zSOCKSv4.__init__cCsd|_d|_dS)N�)�bufr)rrrr
rQr1zSOCKSv4.connectionMadec
Cs2|jr|j�|�dS|j||_|j}d|jdd�vr�|jdd�|jdd�}|_t�d|dd��\}}}|j�dd�\}|_|dd�dkr�|dd�dkr�d|jvr^||_dS|j�dd�\}|_|j�|�}	|	�|j	||||�|	�
|fd	d
��dSt�|dd��}|�	|||||�dSdS)z�
        Called whenever data is received.

        @type data: L{bytes}
        @param data: Part or all of a SOCKSv4 packet.
        N���!BBH���scS�
|�d�S�N�[�r��resultrrrr
�<lambda>p�
z&SOCKSv4.dataReceived.<locals>.<lambda>)
rr#r3�struct�unpack�splitr�resolve�addCallback�_dataReceived2�
addErrback�socket�	inet_ntoa)
rr%�completeBuffer�head�version�coder�user�server�drrr
r&Us*  
�zSOCKSv4.dataReceivedcCs�|dks
Jd|��|�||||�s|�d�dS|dkr/|�||t|�}|�|fdd��n|dkrE|�d	t||�}|�|fd
d��ntd|����|j	dksZJd
t
|j	���dS)a4
        The second half of the SOCKS connection setup. For a SOCKSv4 packet this
        is after the server address has been extracted from the header. For a
        SOCKSv4a packet this is after the host name has been resolved.

        @type server: L{str}
        @param server: The IP address of the destination, represented as a
            dotted quad.

        @type user: L{str}
        @param user: The username associated with the connection.

        @type version: L{int}
        @param version: The SOCKS protocol version number.

        @type code: L{int}
        @param code: The command code. 1 means establish a TCP/IP stream
            connection, and 2 means establish a TCP/IP port binding.

        @type port: L{int}
        @param port: The port number associated with the connection.
        r7zBad version code: %sr<Nr8cSr:r;r=r>rrr
r@�rAz(SOCKSv4._dataReceived2.<locals>.<lambda>�rcSs|�dd|d|d�S)Nrrr8r=)�xrrrr
r@�szBad Connect Code: r2z hmm, still stuff in buffer... %s)�	authorizer�connectClassrrH�listenClass�SOCKSv4IncomingFactoryrF�RuntimeErrorr3�repr)rrPrOrMrNrrQrrr
rGws
 zSOCKSv4._dataReceived2cCs|jr|jj��dSdSr)rrrrrrr
r�s�zSOCKSv4.connectionLostcCst�d||||f�dS)Nz0code %s connection to %s:%s (user %s) authorizedr8)r�msg)rrNrPrrOrrr
rT�s
��zSOCKSv4.authorizecGstjt|g|�R��||�Sr)r�
ClientCreatorr�
connectTCP)rrr�klass�argsrrr
rU�szSOCKSv4.connectClasscGs&t�|||��}t�|��dd��S)Nr8)r�	listenTCPr�succeed�getHost)rrr]r^�servrrr
rV�szSOCKSv4.listenClassr�0.0.0.0cCs<|j�t�d|||�t�|��|dkr|j��dSdS)Nr6r)rr#rB�packrI�	inet_atonr)r�replyrMrrrrr
r�s��zSOCKSv4.makeReplycCs|�||�|j�|�dSr)rrr#r$rrr
r#�sz
SOCKSv4.writec	Cs
|jsdS|j��}|jj��}t|jd�}|�dt��|j|j	||kr&dp'd|j|j	f�|rz|dd�|dd�}}|�t
�tdd�|�d�d�|�dt
|�d	d�|D]}t
t|��d	krm|�d
�q]|�|�q]|�d�|s1|�d�|��dS)N�az%s	%s:%d %s %s:%d
�<�>�cSsdt|�S)Nz%02X)�ord)rSrrr
r@�szSOCKSv4.log.<locals>.<lambda>� ��.�
)r0rrr�openr#�time�ctimerr�string�join�map�lenrY�close)r�protor%r�
their_peer�f�p�crrr
r�s8
��� 
�

zSOCKSv4.log)rrrc)r*r+r,�__doc__rrrr&rGrrTrUrVrr#rrrrr
r.9s"%
r.c@� eZdZdZdd�Zdd�ZdS)�SOCKSv4Factoryz`
    A factory for a SOCKSv4 proxy.

    Constructor accepts one argument, a log file name.
    cCrr)r0)rrrrr
r�rzSOCKSv4Factory.__init__cCst|jt�Sr)r.r0r�r�addrrrr
�
buildProtocol�szSOCKSv4Factory.buildProtocolN�r*r+r,r}rr�rrrr
r�src@r~)rWzJ
    A utility class for building protocols for incoming connections.
    cCr/r)r	r)rr	rrrr
r�r1zSOCKSv4IncomingFactory.__init__cCsR|d|jkrd|_|j�dd�t|j�S|jdkrdS|j�dd�d|_dS)Nr�rr<)rr	rr-r�rrr
r��s

z$SOCKSv4IncomingFactory.buildProtocolNr�rrrr
rW�srW)r}rIrsrBrq�twisted.internetrrr�twisted.pythonr�Protocolrr-r.�FactoryrrWrrrr
�<module>s 

Spamworldpro Mini