+
    G2]~  c                   s   R t ^ RIt^ RIt ^ RIt^ RIt^ RI
t
R tR t]! 4       t ! R R]P                  4      t ! R R]P"                  4      t ! R R	]P&                  ]P(                  4      t]R
8X  d   ^ RIt ]! ]P2                  ^,          4      t]P:                  ! ]! ]
P<                  R]4      4      t] ! R]PC                  R4      PE                  4       PG                  4       ,           4       ] ! R]PC                  R4      PE                  4       PG                  4       ,           4       R# R#   ] d    ^ RIHt ^ RIH	t  EL2i ; i  ]]3 d    Rt Li ; i)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...
Nc                 sH    V P                  4       pVP                  V4       V# N)ZcopyZupdate)ZaZbZds   && 1/usr/lib/python3.14/site-packages/sockshandler.py
merge_dictr      s    	AHHQKH    c                 s     R V 9   d(   \         P                  ! \         P                  V 4       R# RV 9   d   \         P                  ! V 4       R# R#     R# ; i)Z:Z.FT)socketZ	inet_ptonZAF_INET6Z	inet_aton)Zs   &r   is_ipr      sR    
!8V__a0  AXQ 	 s   ,A A Ac                   s0   a  ] tR t^*t o RR ltR tRtV tR# )SocksiPyConnectionNc                b    WW4WV3V n         \        P                  P                  ! V .VO5/ VB  R # r    )	proxyargshttplibHTTPConnection__init__	self	proxytype	proxyaddr	proxyportrdnsusernamepasswordargskwargs	   &&&&&&&*,r   r   ZSocksiPyConnection.__init__+   s.    #	T''>t>v>r   c                s   V P                   w  rr4rVT;'       d
    V\        9  p  \        P                  ! V P                  V P
                  3V P                  RWW4WV\        P                  \        P                  ^334
      p Ypn        R#   \        P                   dW   pT'       dI   R\        T4      9   d9   \        T P                  4      '       g   Rp\        P                  T4        Rp?K  h Rp?ii ; i)TNZ0x5bF)r	   socks4_no_rdnssocksZcreate_connectionhostporttimeoutr   ZIPPROTO_TCPZTCP_NODELAYZSOCKS4ErrorZstrr   Zaddsock)	r   r   r   r   r   r   r   r   Zes	   &        r   connectZSocksiPyConnection.connect/   s    FJnnCy77	7..YY		*DLL$)8((&*<*<a@BD  	 $$ Fc!f,U4995E5E !D"&&y11s   AB C6 A
C10C11C6r	   r   NTNN__name__
__module____qualname____firstlineno__r   r   __static_attributes____classdictcell__Z__classdict__   @r   r   r   *   s     ? r   r   c                   s0   a  ] tR t^Ct o RR ltR tRtV tR# )SocksiPyConnectionSNc                r   r    )r	   r
   HTTPSConnectionr   r   r   r   r   ZSocksiPyConnectionS.__init__D   s.    #	T((???r   c                s   \         P                  V 4       V P                  P                  V P                  V P
                  R 7      V n        V P                  P                  '       gQ   V P                  '       d=    \        P                  ! V P                  P                  4       V P
                  4       R# R# R#   \         dF    T P                  P                  \        P                  4       T P                  P                  4        h i ; i))Zserver_hostnameN)r   r   Z_contextZwrap_socketr   r   Zcheck_hostnameZ_check_hostnamesslZmatch_hostnameZgetpeercertZ	ExceptionZshutdownr   Z	SHUT_RDWRZclose)r   r   r   r   ZSocksiPyConnectionS.connectH   s    ""4(MM--dii-S	}}+++0D0D0D""499#8#8#:DIIF 1E+  		""6#3#34		!s   ;9B: :AD
r   r    r!   r(   r)   r   r*   r*   C   s     @	 	r   r*   c                   s2   a  ] tR t^St o R tR tR tRtV tR# )SocksiPyHandlerc                s\    Wn         W n        \        P                  P	                  V 4       R # r    )r   kwurllib2HTTPHandlerr   )r   r   r   s   &*,r   r   ZSocksiPyHandler.__init__T   s     	$$T*r   c                6   a  RV 3R llpS P                  W!4      # )Nc           	      j   < \        SP                  V4      p\        SP                  R V RVRV/VB pV# r   r   r   )r   r.   r   r   r   r   r   r   r.   Zconnr      &&&,  r   buildZ(SocksiPyHandler.http_open.<locals>.buildZ   s<    DGGV,B%tyy^t^$^PW^[]^DKr   Ni    Zdo_openr   Zreqr6      f& r   	http_openZSocksiPyHandler.http_openY       	 ||E''r   c                r1   )Nc           	      r2   r3   )r   r.   r*   r   r4   r5   r   r6   Z)SocksiPyHandler.https_open.<locals>.builda   s<    DGGV,B&		__4_QX_\^_DKr   r7   r8   r9   r:   r   
https_openZSocksiPyHandler.https_open`   r<   r   )r   r.   N)	r"   r#   r$   r%   r   r;   r=   r&   r'   r(   r)   r   r-   r-   S   s     +
(( (r   r-   Z__main__iZ#  Z	localhostzHTTP: zhttp://httpbin.org/ipzHTTPS: zhttps://httpbin.org/ip)$Z__doc__r   r,   r/   r
   ZImportErrorZurllib.requestZrequestZhttp.clientZclientr   r   r   Zsetr   r   r   r+   r*   r0   ZHTTPSHandlerr-   r"   ZsysZintZargvr   Z
ValueErrorZ
IndexErrorZbuild_openerZPROXY_TYPE_SOCKS5ZopenerZprintZopenZreadZdecode) r   r   <module>r>      sF    
"
 
 // 2'11  (g))7+?+? (( z388A; !!/%2I2I;X\"]^F	(V[[!89>>@GGI
IJ	)fkk":;@@BIIK
KL o  "$!!"v 
# s#   D0 ;E
 0EE
EE