HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: //lib/python3.9/site-packages/__pycache__/sockshandler.cpython-39.pyc
a

G2�]~�	@s8dZddlZddlZzddlZddlZWn*eyRddlmZddlm	ZYn0ddl
Z
dd�Zdd�Ze
�ZGdd�dej�ZGd	d
�d
ej�ZGdd�dejej�Zed
k�r4ddlZzeejd�ZWneefy�dZYn0e�ee
jde��Ze de�!d��"��#��e de�!d��"��#��dS)z�
SocksiPy + urllib2 handler

version: 0.3
author: e<[email protected]>

This module provides a Handler which you can use with urllib2 to allow it to tunnel your connection through a socks.sockssocket socket, with out monkey patching the original socket...
�NcCs|��}|�|�|S�N)�copy�update)�a�b�d�r�0/usr/lib/python3.9/site-packages/sockshandler.py�
merge_dicts
r
cCsNz6d|vrt�tj|�nd|vr.t�|�nWdSWnYdS0dSdS)N�:�.FT)�socketZ	inet_ptonZAF_INET6Z	inet_aton)�srrr	�is_ips
rc@seZdZddd�Zdd�ZdS)�SocksiPyConnectionNTc	Os0||||||f|_tjj|g|�Ri|��dSr)�	proxyargs�httplib�HTTPConnection�__init__�	�self�	proxytype�	proxyaddr�	proxyport�rdns�username�password�args�kwargsrrr	r+szSocksiPyConnection.__init__c	Cs�|j\}}}}}}|o|tv}z:t�|j|jf|jd||||||tjtj	dff�
}Wq�Wqtj
y�}z8|r�dt|�vr�t|j�s�d}t�
|�n�WYd}~qd}~00q||_dS)N�Z0x5bF)r�socks4_no_rdns�socksZcreate_connection�host�port�timeoutr
ZIPPROTO_TCPZTCP_NODELAYZSOCKS4Error�strr�add�sock)	rrrrrrrr'�errr	�connect/s�zSocksiPyConnection.connect)NTNN��__name__�
__module__�__qualname__rr)rrrr	r*s
rc@seZdZddd�Zdd�ZdS)�SocksiPyConnectionSNTc	Os0||||||f|_tjj|g|�Ri|��dSr)rr�HTTPSConnectionrrrrr	rDszSocksiPyConnectionS.__init__cCsxt�|�|jj|j|jd�|_|jjst|jrtzt�	|j�
�|j�Wn,tyr|j�t
j�|j���Yn0dS)N)Zserver_hostname)rr)Z_contextZwrap_socketr'r"Zcheck_hostnameZ_check_hostname�sslZmatch_hostnameZgetpeercert�	ExceptionZshutdownr
Z	SHUT_RDWR�close�rrrr	r)Hs

zSocksiPyConnectionS.connect)NTNNr*rrrr	r.Cs
r.c@s$eZdZdd�Zdd�Zdd�ZdS)�SocksiPyHandlercOs||_||_tj�|�dSr)r�kw�urllib2�HTTPHandlerr)rrrrrr	rTszSocksiPyHandler.__init__csd�fdd�	}��||�S)Nrcs(t�j|�}t�j|||d�|��}|S�N)r"r#r$)r
r5rr�r"r#r$rr5Zconnr3rr	�buildZsz(SocksiPyHandler.http_open.<locals>.build)Nr�Zdo_open�rZreqr:rr3r	�	http_openYszSocksiPyHandler.http_opencsd�fdd�	}��||�S)Nrcs(t�j|�}t�j|||d�|��}|Sr8)r
r5r.rr9r3rr	r:asz)SocksiPyHandler.https_open.<locals>.build)Nrr;r<rr3r	�
https_open`szSocksiPyHandler.https_openN)r+r,r-rr=r>rrrr	r4Ssr4�__main__riZ#Z	localhostzHTTP: zhttp://httpbin.org/ipzHTTPS: zhttps://httpbin.org/ip)$�__doc__r
r0r6r�ImportErrorZurllib.requestZrequestZhttp.clientZclientr!r
r�setr rrr/r.r7ZHTTPSHandlerr4r+�sys�int�argvr#�
ValueError�
IndexErrorZbuild_openerZPROXY_TYPE_SOCKS5�opener�print�open�read�decoderrrr	�<module>s0