??????????????
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 173
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 174
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 175
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 176
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 177
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 178
ó
x‹Å^c
@ sa d Z d d l Z d d l Z d d l Z d d l Z e e d d ƒ d k r] e d ƒ ‚ n d Z d Z d Z
d Z d a e j Z
d e f d
„ ƒ YZ d e f d „ ƒ YZ d
e f d „ ƒ YZ d e f d „ ƒ YZ d e f d „ ƒ YZ d e f d „ ƒ YZ d1 Z d2 Z d3 Z d4 Z d d d e d d d- „ Z d. „ Z d/ e j f d0 „ ƒ YZ d S(5 s 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.
iÿÿÿÿNt sockets- socket.socket missing, proxy support unusablei i i i t
ProxyErrorc B s e Z RS( ( t __name__t
__module__( ( ( s2 /usr/lib/python2.7/site-packages/httplib2/socks.pyR 7 s t GeneralProxyErrorc B s e Z RS( ( R R ( ( ( s2 /usr/lib/python2.7/site-packages/httplib2/socks.pyR ; s t Socks5AuthErrorc B s e Z RS( ( R R ( ( ( s2 /usr/lib/python2.7/site-packages/httplib2/socks.pyR ? s t Socks5Errorc B s e Z RS( ( R R ( ( ( s2 /usr/lib/python2.7/site-packages/httplib2/socks.pyR C s t Socks4Errorc B s e Z RS( ( R R ( ( ( s2 /usr/lib/python2.7/site-packages/httplib2/socks.pyR G s t HTTPErrorc B s e Z RS( ( R R ( ( ( s2 /usr/lib/python2.7/site-packages/httplib2/socks.pyR K s t successs invalid datas
not connecteds
not availables bad proxy types bad inputt succeededs general SOCKS server failures! connection not allowed by rulesets Network unreachables Host unreachables Connection refuseds TTL expireds Command not supporteds Address type not supporteds
Unknown errors authentication is requireds0 all offered authentication methods were rejecteds$ unknown username or invalid passwords
unknown errors request granteds request rejected or failedsL request rejected because SOCKS server cannot connect to identd on the clientsP request rejected because the client program and identd report different user-idsc C s | | | | | | f a d S( s´ setdefaultproxy(proxytype, addr[, port[, rdns[, username[, password]]]])
Sets a default proxy which all further socksocket objects will use,
unless explicitly changed.
N( t
_defaultproxy( t proxytypet addrt portt rdnst usernamet password( ( s2 /usr/lib/python2.7/site-packages/httplib2/socks.pyt setdefaultproxyw s c C s+ t d k r t | j _ n t d ƒ ‚ d S( s7 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.
i s no proxy specifiedN( i s no proxy specified( R t Nonet
socksocketR R ( t module( ( s2 /usr/lib/python2.7/site-packages/httplib2/socks.pyt
wrapmodule‚ s R c B sª e Z d Z e j e j d d d „ Z d „ Z d „ Z d „ Z
d „ Z d d d e d d d d „ Z
d „ Z d „ Z d
„ Z d „ Z d „ Z d
„ Z d „ Z RS( s 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.
i c C sY t j | | | | | ƒ t d k r1 t | _ n d | _ d | _ d | _ t | _ d S( N( NNNNNN( t
_orgsockett __init__R R t _socksocket__proxyt _socksocket__proxysocknamet _socksocket__proxypeernamet Truet _socksocket__httptunnel( t selft familyt typet protot _sock( ( s2 /usr/lib/python2.7/site-packages/httplib2/socks.pyR ˜ s c C sd | j | ƒ } xN t | ƒ | k r_ | j | t | ƒ ƒ } | sR t d ƒ ‚ n | | } q W| S( s® __recvall(count) -> data
Receive EXACTLY the number of bytes requested from the socket.
Blocks until the required number of bytes have been received.
i s connection closed unexpectedly( i s connection closed unexpectedly( t recvt lenR ( R t countt datat d( ( s2 /usr/lib/python2.7/site-packages/httplib2/socks.pyt __recvall¤ s c G s4 | j s | j | ƒ } n t t | ƒ j | | Œ S( sq override socket.socket.sendall method to rewrite the header
for non-tunneling proxies if needed
( R t _socksocket__rewriteproxyt superR t sendall( R t contentt args( ( s2 /usr/lib/python2.7/site-packages/httplib2/socks.pyR+ ± s c
C sT d \ } } | j d ƒ } x_ | D]W } | j ƒ j d ƒ rF | } q" | j ƒ j d ƒ sp | j ƒ j d ƒ r" | } q" q" W| rG| rG| j | ƒ | j | ƒ | j d ƒ d } | j d ƒ } | j d d
k r| j d d
k r| j d | j ƒ ƒ n | j d d
| ƒ | j d d | d | | d | d f ƒ n d j | ƒ S( sÒ 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.
s
s host:t gett postt i i i i s Host: %ss %s http://%s%s %si N( NN( R t splitt lowert
startswitht removeR t insertt _socksocket__getauthheadert join( R t headert hostt endptt hdrst hdr( ( s2 /usr/lib/python2.7/site-packages/httplib2/socks.pyt __rewriteproxy¹ s"
*
&/c C s- | j d d | j d } d t j | ƒ S( Ni t :i s Proxy-Authorization: Basic ( R t base64t b64encode( R t auth( ( s2 /usr/lib/python2.7/site-packages/httplib2/socks.pyt __getauthheaderÐ s c C sF | | | | | r | j ƒ n d | r3 | j ƒ n d | f | _ d S( s
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( t encodeR R ( R R R
R R R R t headers( ( s2 /usr/lib/python2.7/site-packages/httplib2/socks.pyt setproxyÔ s c
C s* | j d d
k rK | j d d
k rK | j t j d d d d d ƒ ƒ n | j t j d d d d ƒ ƒ | j d ƒ } | d d !t d ƒ j ƒ k r» | j ƒ t d t
d f ƒ ‚ n | d d !t d ƒ j ƒ k rÝ ng| d d !t d ƒ j ƒ k rï| j t d ƒ j ƒ t t | j d ƒ ƒ | j d t t | j d ƒ ƒ | j d ƒ | j d ƒ } | d d !t d ƒ j ƒ k rª| j ƒ t d t
d f ƒ ‚ n | d d !t d ƒ j ƒ k rD| j ƒ t d t
d f ƒ ‚ qDnU | j ƒ | d t d ƒ j ƒ k r.t d t
d f ƒ ‚ n t d t
d f ƒ ‚ t j d d d d ƒ } y- t j | ƒ } | t d ƒ j ƒ | } Wn’ t j k
r| j d rèd
} | t d ƒ j ƒ t t | ƒ ƒ j ƒ | j ƒ } qt j t j | ƒ ƒ } | t d ƒ j ƒ | } n X| t j d
| ƒ } | j | ƒ | j d ƒ } | d d !t d ƒ j ƒ k r’| j ƒ t d t
d f ƒ ‚ n0| d d !t d ƒ j ƒ k r | j ƒ t | d d !ƒ d k rt t | d d !ƒ t t | d d !ƒ f ƒ ‚ qÂt d t d f ƒ ‚ n¢ | d d !t d ƒ j ƒ k rQ| j d ƒ } nq | d d !t d ƒ j ƒ k r¢| | j d ƒ } | j t | d d !ƒ ƒ } n | j ƒ t d t
d f ƒ ‚ t j d
| j d ƒ ƒ d } | | f | _ | d
k rt j | ƒ | f | _ n | | f | _ d
S( sk __negotiatesocks5(self,destaddr,destport)
Negotiates a connection through a SOCKS5 server.
i i t BBBBi i t BBBi i iÿ s >Hi i N( R R R+ t structt packt _socksocket__recvallt chrRC t closeR t _generalerrorsR$ R t _socks5autherrorsR t inet_atont errort
gethostbynamet ordR t
_socks5errorsR# t unpackR t inet_ntoaR (
R t destaddrt destportt
chosenautht authstatt reqt ipaddrt respt boundaddrt boundport( ( s2 /usr/lib/python2.7/site-packages/httplib2/socks.pyt __negotiatesocks5û sp &%
W
9
3
c C s | j S( si getsockname() -> address info
Returns the bound IP address and port number at the proxy.
( R ( R ( ( s2 /usr/lib/python2.7/site-packages/httplib2/socks.pyt getproxysocknameb s c C s
t j | ƒ S( s` getproxypeername() -> address info
Returns the IP and port number of the proxy.
( R t getpeername( R ( ( s2 /usr/lib/python2.7/site-packages/httplib2/socks.pyt getproxypeernameh s c C s | j S( s£ getpeername() -> address info
Returns the IP address and port number of the destination
machine (note: getproxypeername returns the proxy)
( R ( R ( ( s2 /usr/lib/python2.7/site-packages/httplib2/socks.pyRa n s c C s\ t } y t j | ƒ } Wn] t j k
rx | j d r] t j d d d d d ƒ } t } qy t j t j | ƒ ƒ } n Xt j d d d | ƒ | } | j d d k r¼ | | j d } n | t
d ƒ j ƒ } | rõ | | t
d ƒ j ƒ } n | j | ƒ | j
d ƒ } | d d !t
d ƒ j ƒ k rS| j ƒ t d t d f ƒ ‚ n | d d !t
d ƒ j ƒ k rï| j ƒ t | d d !ƒ d k rÖ| j ƒ t t | d d !ƒ t t | d d !ƒ d f ƒ ‚ qït d
t d f ƒ ‚ n t j | d ƒ t j d | d d !ƒ d f | _ | d k rIt j | ƒ | f | _ n | | f | _ d S( sk __negotiatesocks4(self,destaddr,destport)
Negotiates a connection through a SOCKS4 server.
i RF i i s >BBHi i i iZ i[ i\ i] i^ s >HN( i[ i\ i] ( t FalseR RO RP R RH RI R RQ R RK RC R+ RJ RL R RM RR R t
_socks4errorsRU RT R R ( R RV RW t rmtrslvR[ RZ R\ ( ( s2 /usr/lib/python2.7/site-packages/httplib2/socks.pyt __negotiatesocks4u s<