403Webshell
Server IP : 182.53.201.61  /  Your IP : 216.73.217.175
Web Server : Apache/2.2.15 (Fedora)
System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686
User : apache ( 48)
PHP Version : 5.3.3
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python2.6/site-packages/paste/auth/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pyc
Ñò
‘ÊIc
@sídZddkZyddklZWn#ej
oddklZnXddkZddklZde	fd„ƒYZ
defd„ƒYZd	„Z
d
„Zd„Zdd
„Zde	fd„ƒYZddeedd„ZdS(s'
Implementation of cookie signing as done in `mod_auth_tkt
<http://www.openfusion.com.au/labs/mod_auth_tkt/>`_.

mod_auth_tkt is an Apache module that looks for these signed cookies
and sets ``REMOTE_USER``, ``REMOTE_USER_TOKENS`` (a comma-separated
list of groups) and ``REMOTE_USER_DATA`` (arbitrary string data).

This module is an alternative to the ``paste.auth.cookie`` module;
it's primary benefit is compatibility with mod_auth_tkt, which in turn
makes it possible to use the same authentication process with
non-Python code run under Apache.
iÿÿÿÿN(tmd5(trequestt
AuthTicketcBsAeZdZdddded„Zd„Zd„Zd„ZRS(	sñ
    This class represents an authentication token.  You must pass in
    the shared secret, the userid, and the IP address.  Optionally you
    can include tokens (a list of strings, representing role names),
    'user_data', which is arbitrary data available for your own use in
    later scripts.  Lastly, you can override the cookie name and
    timestamp.

    Once you provide all the arguments, use .cookie_value() to
    generate the appropriate authentication ticket.  .cookie()
    generates a Cookie object, the str() of which is the complete
    cookie header to be sent.

    CGI usage::

        token = auth_tkt.AuthTick('sharedsecret', 'username',
            os.environ['REMOTE_ADDR'], tokens=['admin'])
        print 'Status: 200 OK'
        print 'Content-type: text/html'
        print token.cookie()
        print
        ... redirect HTML ...

    Webware usage::

        token = auth_tkt.AuthTick('sharedsecret', 'username',
            self.request().environ()['REMOTE_ADDR'], tokens=['admin'])
        self.response().setCookie('auth_tkt', token.cookie_value())

    Be careful not to do an HTTP redirect after login; use meta
    refresh or Javascript -- some browsers have bugs where cookies
    aren't saved when set on a redirect.
    ttauth_tktc		Csu||_||_||_di|ƒ|_||_|djotiƒ|_n
||_||_	||_
dS(Nt,(tsecrettuseridtiptjointtokenst	user_datatNonettime_modttimetcookie_nametsecure(	tselfRRRR
RRRR((s7/usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pyt__init__Ts				
		cCs+t|i|i|i|i|i|iƒS(N(tcalculate_digestRRRRR
R(R((s7/usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pytdigestcscCsUd|iƒt|iƒ|if}|io||id7}n||i7}|S(Ns	%s%08x%s!t!(RtintRRR
R(Rtv((s7/usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pytcookie_valuehs
%

cCsntiƒ}|iƒidƒiƒiddƒ||i<d||id<|iod||id<n|S(Ntbase64s
Rt/tpathttrueR(tCookietSimpleCookieRtencodetstriptreplaceRR(Rtc((s7/usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pytcookieos.
(N(	t__name__t
__module__t__doc__RtFalseRRRR#(((s7/usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pyR0s"
		t	BadTicketcBseZdZdd„ZRS(së
    Exception raised when a ticket can't be parsed.  If we get
    far enough to determine what the expected digest should have
    been, expected is set.  This should not be shown by default,
    but can be useful for debugging.
    cCs||_ti||ƒdS(N(texpectedt	ExceptionR(RtmsgR)((s7/usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pyR~s	N(R$R%R&RR(((s7/usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pyR(wscCs5|idƒ}|d }yt|dd!dƒ}Wn%tj
o}td|ƒ‚nXy |diddƒ\}}Wntj
otdƒ‚nXd|jo|iddƒ\}}	n
d	}|}	t||||||	ƒ}
|
|jotd
d|
|fƒ‚n|idƒ}||||	fS(
s¨
    Parse the ticket, returning (timestamp, userid, tokens, user_data).

    If the ticket cannot be parsed, ``BadTicket`` will be raised with
    an explanation.
    t"i i(is"Timestamp is not a hex integer: %sRisuserid is not followed by !RsDigest signature is not correctR)R(R Rt
ValueErrorR(tsplitR(RtticketRRt	timestampteRtdataR
RR)((s7/usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pytparse_ticket‚s*
 

	cCs}t|ƒ}t|ƒ}t|ƒ}t|ƒ}tt||ƒ||d|d|ƒiƒ}t||ƒiƒ}|S(Nt(tmaybe_encodeRtencode_ip_timestampt	hexdigest(RR0RRR
Rtdigest0R((s7/usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pyR¥s0cCs„ditttt|idƒƒƒƒ}t|ƒ}|d@d?|d@d?|d@d?|d	@f}ditt|ƒƒ}||S(
NRt.l~iiÿiiÿiiÿ(R	tmaptchrRR.(RR0tip_charsttttstts_chars((s7/usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pyR6°s*
tutf8cCs't|tƒo|i|ƒ}n|S(N(t
isinstancetunicodeR(tstencoding((s7/usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pyR5ºstAuthTKTMiddlewarecBs>eZdZdeedd„Zd„Zd„Zd„Z	RS(sw
    Middleware that checks for signed cookies that match what
    `mod_auth_tkt <http://www.openfusion.com.au/labs/mod_auth_tkt/>`_
    looks for (if you have mod_auth_tkt installed, you don't need this
    middleware, since Apache will set the environmental variables for
    you).

    Arguments:
    
    ``secret``:
        A secret that should be shared by any instances of this application.
        If this app is served from more than one machine, they should all 
        have the same secret.
        
    ``cookie_name``:
        The name of the cookie to read and write from.  Default ``auth_tkt``.
        
    ``secure``:
        If the cookie should be set as 'secure' (only sent over SSL) and if
        the login must be over SSL.
        
    ``include_ip``:
        If the cookie should include the user's IP address.  If so, then 
        if they change IPs their cookie will be invalid.
        
    ``logout_path``:
        The path under this middleware that should signify a logout.  The
        page will be shown as usual, but the user will also be logged out
        when they visit this page.
        
    If used with mod_auth_tkt, then these settings (except logout_path) should 
    match the analogous Apache configuration settings.

    This also adds two functions to the request:

    ``environ['paste.auth_tkt.set_user'](userid, tokens='', user_data='')``

        This sets a cookie that logs the user in.  ``tokens`` is a
        string (comma-separated groups) or a list of strings.
        ``user_data`` is a string for your own use.

    ``environ['paste.auth_tkt.logout_user']()``

        Logs out the user.
    RcCs:||_||_||_||_||_||_dS(N(tappRRRt
include_iptlogout_path(RRFRRRRGRH((s7/usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pyRïs					c
s€tiˆƒ}|iˆiƒo|ˆii}nd}|o ˆioˆd}nd}tˆi||ƒ\}}}}	di|ƒ}|ˆd<ˆi	dƒoˆdd|}n|ˆd<|	ˆd<dˆd	<ng‰dd‡‡‡fd
†}
‡‡‡fd†}|
ˆd<|ˆd
<ˆi
o$ˆi	dƒˆi
jo|ƒnd‡‡fd†}ˆiˆ|ƒS(NRtREMOTE_ADDRs0.0.0.0RtREMOTE_USERtREMOTE_USER_TOKENStREMOTE_USER_DATAR#t	AUTH_TYPEcs#ˆiˆiˆ|||ƒƒdS(N(textendtset_user_cookie(RR
R(Rtenvirontset_cookies(s7/usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pytset_userscsˆiˆiˆƒƒdS(N(RNtlogout_user_cookie((RRPRQ(s7/usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pytlogout_usersspaste.auth_tkt.set_userspaste.auth_tkt.logout_usert	PATH_INFOcs|iˆƒˆ|||ƒS(N(RN(tstatustheaderstexc_info(RQtstart_response(s7/usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pytcookie_setting_start_responses
(
Rtget_cookiesthas_keyRtvalueRGR3RR	tgetRHRRF(
RRPRYtcookiesRtremote_addrR0RR
RRRRTRZ((RYRRPRQs7/usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pyt__call__øs4





#c
Csýt|tƒpdi|ƒ}n|io|d}nd}t|i||d|d|d|id|iƒ}|id|id	ƒƒ}d
|}dd|i|i	ƒffdd
|i|i	ƒ|ffdd
|i|i	ƒ|ffg}	|	S(NRRIs0.0.0.0R
RRRt	HTTP_HOSTtSERVER_NAMER9s
Set-Cookies
%s=%s; Path=/s%s=%s; Path=/; Domain=%s(
RAt
basestringR	RGRRRRR^R(
RRPRR
RR`R/t
cur_domaintwild_domainR_((s7/usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pyRO s,
	
cCsk|id|idƒƒ}d|}dd|ifdd|i|ffdd|i|ffg}|S(NRbRcR9s
Set-Cookies
%s=""; Path=/s%s=""; Path=/; Domain=%s(R^R(RRPReRfR_((s7/usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pyRS=s
N(
R$R%R&R'tTrueRRRaRORS(((s7/usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pyRE¿s.	(	RcCsddkl}||ƒ}||ƒ}|djo|idƒ}n|ptdƒ‚nt||||||pdƒS(s¢
    Creates the `AuthTKTMiddleware
    <class-paste.auth.auth_tkt.AuthTKTMiddleware.html>`_.

    ``secret`` is requird, but can be set globally or locally.
    iÿÿÿÿ(tasboolRs>You must provide a 'secret' (in global or local configuration)N(tpaste.deploy.convertersRhRR^R-RE(RFtglobal_confRRRRGRHRh((s7/usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pytmake_auth_tkt_middlewareIs

(R&RR
thashlibRtImportErrorRtpasteRtobjectRR*R(R3RR6R5RERR'RgRk(((s7/usr/lib/python2.6/site-packages/paste/auth/auth_tkt.pyt<module>&s&G	#		


Youez - 2016 - github.com/yon3zu
LinuXploit