Server IP : 111.118.215.189 / Your IP : 216.73.216.126 Web Server : Apache System : Linux md-in-83.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 User : a1673wkz ( 2475) PHP Version : 8.2.25 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /usr/lib/python2.7/site-packages/pyzor/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
� YF�Tc @ s� d Z d d l Z d d l Z d d l Z e j d � Z e j d � Z d � Z d e f d � � YZ d � Z e e j d d � Z d S( s� A collection of utilities that facilitate working with Pyzor accounts. Note that accounts are not necessary (on the client or server), as an "anonymous" account always exists.i����Nc C sm | j � j � j d � } | � } | j | | � j � � | j d | | f j d � � | j � j � S( s� Converts the key, timestamp (epoch seconds), and msg into a digest. lower(H(H(M) + ':' T + ':' + K)) M is message T is integer epoch timestamp K is hashed_key H is the hash function (currently SHA1) t utf8s :%d:%s( t as_stringt stript encodet updatet digestt hexdigestt lower( t hashed_keyt timestampt msgt hash_R ( ( s1 /usr/lib/python2.7/site-packages/pyzor/account.pyt sign_msg s c C s5 d | | j � f j d � } | | � j � j � S( s� Returns the hash key for this username and password. lower(H(U + ':' + lower(K))) K is key (hex string) U is username H is the hash function (currently SHA1) s %s:%sR ( R R R ( t keyt userR t result( ( s1 /usr/lib/python2.7/site-packages/pyzor/account.pyt hash_key s c C s� t | d � } | d } | d } t t j � | � t j k rU t j d � � n t | | � } | d =t | | | � } | | k r� t j d � � n d S( s Verify that the provided message is correctly signed. The message must have "User", "Time", and "Sig" headers. If the signature is valid, then the function returns normally. If the signature is not valid, then a pyzor.SignatureError() exception is raised.t Timet Usert Sigs# Timestamp not within allowed range.s Invalid signature.N( t intt abst timet pyzort MAX_TIMESTAMP_DIFFERENCEt SignatureErrorR R ( R t user_keyR R t provided_signaturet hashed_user_keyt correct_signature( ( s1 /usr/lib/python2.7/site-packages/pyzor/account.pyt verify_signature( s t Accountc B s e Z d � Z RS( c C s | | _ | | _ | | _ d S( N( t usernamet saltR ( t selfR R! R ( ( s1 /usr/lib/python2.7/site-packages/pyzor/account.pyt __init__@ s ( t __name__t __module__R# ( ( ( s1 /usr/lib/python2.7/site-packages/pyzor/account.pyR ? s c C sC y | j d � \ } } Wn t k r8 t d � � n X| | f S( Nt ,sd Invalid number of parts for key; perhaps you forgot the comma at the beginning for the salt divider?( t splitt ValueError( t sR! R ( ( s1 /usr/lib/python2.7/site-packages/pyzor/account.pyt key_from_hexstrF s t ( t __doc__R t hashlibR t sha1R R R t objectR R* t anonymous_usert Nonet AnonymousAccount( ( ( s1 /usr/lib/python2.7/site-packages/pyzor/account.pyt <module> s