MOON
Server: Apache
System: Linux server30c.hostingraja.org 3.10.0-962.3.2.lve1.5.63.el7.x86_64 #1 SMP Fri Oct 8 12:03:35 UTC 2021 x86_64
User: jibhires (1887)
PHP: 8.1.30
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open, allow_url_fopen, symlink, escapeshellcmd, pcntl_exec
Upload Files
File: //opt/alt/python35/lib/python3.5/site-packages/__pycache__/sockshandler.cpython-35.pyc


"�@Wa�@s�dZddlZyddlZddlZWn0ek
r`ddljZddljZYnXddl	Z	dd�Z
Gdd�dej�ZGdd�dej
�ZGd	d
�d
ejej�Zedkr~ddlZyeejd�ZWneefk
rd
ZYnXejee	jde��Zedejd�j�j��edejd�j�j��dS)z�
SocksiPy + urllib2 handler

version: 0.3
author: e<e@tr0ll.in>

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|j�}|j|�|S)N)�copy�update)�a�b�d�r�/sockshandler.py�
merge_dicts
r	c@s4eZdZdddddd�Zdd�ZdS)�SocksiPyConnectionNTc	Os5||||||f|_tjj|||�dS)N)�	proxyargs�httplib�HTTPConnection�__init__)	�self�	proxytype�	proxyaddr�	proxyport�rdns�username�password�args�kwargsrrrrszSocksiPyConnection.__init__cCsptj�|_|jj|j�t|j�ttfkrP|jj	|j�|jj
|j|jf�dS)N)
�socks�
socksocket�sock�setproxyr�type�timeout�int�float�
settimeout�connect�host�port)rrrrr!s
zSocksiPyConnection.connect)�__name__�
__module__�__qualname__rr!rrrrr
sr
c@s4eZdZdddddd�Zdd�ZdS)�SocksiPyConnectionSNTc	Os5||||||f|_tjj|||�dS)N)rr�HTTPSConnectionr)	rrrrrrrrrrrrr'szSocksiPyConnectionS.__init__cCs�tj�}|j|j�t|j�ttfkrG|j|j�|j	|j
|jf�tj
||j|j�|_dS)N)rrrrrrrrr r!r"r#�sslZwrap_socketZkey_fileZ	cert_filer)rrrrrr!+szSocksiPyConnectionS.connect)r$r%r&rr!rrrrr'&sr'c@s4eZdZdd�Zdd�Zdd�ZdS)�SocksiPyHandlercOs&||_||_tjj|�dS)N)r�kw�urllib2�HTTPHandlerr)rrrrrrr4s		zSocksiPyHandler.__init__cs(dd�fdd�}�j||�S)Nrc	s:t�j|�}t�jd|d|d||�}|S)Nr"r#r)r	r+r
r)r"r#rrr+�conn)rrr�build:s$z(SocksiPyHandler.http_open.<locals>.build)�do_open)r�reqr/r)rr�	http_open9szSocksiPyHandler.http_opencs(dd�fdd�}�j||�S)Nrc	s:t�j|�}t�jd|d|d||�}|S)Nr"r#r)r	r+r'r)r"r#rrr+r.)rrrr/As$z)SocksiPyHandler.https_open.<locals>.build)r0)rr1r/r)rr�
https_open@szSocksiPyHandler.https_openN)r$r%r&rr2r3rrrrr*3sr*�__main__�iZ#�	localhostzHTTP: zhttp://httpbin.org/ipzHTTPS: zhttps://httpbin.org/ip) �__doc__r)r,r�ImportErrorZurllib.requestZrequestZhttp.client�clientrr	r
r
r(r'r-ZHTTPSHandlerr*r$�sysr�argvr#�
ValueError�
IndexErrorZbuild_openerZPROXY_TYPE_SOCKS5Zopener�print�open�read�decoderrrr�<module>	s*

#