CasperSecurity

Current Path : /lib/python3/dist-packages/supervisor/medusa/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/supervisor/medusa/__pycache__/auth_handler.cpython-310.pyc

o

VƧ\~�@s�dZddlZddlZddlZddlmZmZddlmZmZddlm	Z	ddlm
Z
ddlmm
Z
ddlmmZejZddlmmZGdd�d�ZGd	d
�d
�Ze�dej�ZdS)z>$Id: auth_handler.py,v 1.6 2002/11/25 19:40:23 akuchling Exp $�N)�	as_string�as_bytes)�encodestring�decodestring)�long)�md5c@sFeZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)�auth_handler�defaultcCs.t|�|_||_||_t��|_t��|_dS�N)�dictionary_authorizer�
authorizer�handler�realm�counter�
pass_count�
fail_count)�self�dictr
r�r�@/usr/lib/python3/dist-packages/supervisor/medusa/auth_handler.py�__init__#s


zauth_handler.__init__cCs|j�|�Sr
)r
�match�r�requestrrrr*szauth_handler.matchcCs�tt|j�}|rg|��}|dkrXtt|jd�}z
ttt|���}Wntj�	d|�|�
d�YdS|�dd�}|j�
|�rQ|j��||_|j�|�dS|�|�dStj�	d|�|�|�dS|�|�dS)N�basic�z"malformed authorization info <%s>
i��:�z$unknown/unsupported auth method: %s
)�
get_header�
AUTHORIZATION�header�lowerrrr�sys�stderr�write�error�splitr�	authorizer�	increment�	auth_infor
�handle_request�handle_unauthorized)rr�scheme�cookie�decodedr)rrrr*.s(

	zauth_handler.handle_requestcCs:|j��|j�d�d|d<d|j|d<|�d�dS)N�close�
ConnectionzBasic realm="%s"zWWW-Authenticatei�)rr(�channel�set_terminatorrr%rrrrr+Rs

z auth_handler.handle_unauthorizedcCs\|jjj}ttt����}|dd�dkr|dd�}tt|��}d�|||g�}|�|�S)zEA digest-authentication <nonce>, constructed as suggested in RFC 2069���N�Lr)	r1�server�ip�strr�time�id�join�
apply_hash)rrr6�now�private_key�noncerrr�
make_nonce[s

zauth_handler.make_noncecCs(t�}|�|�|��}t|�dd�S)z;Apply MD5 to a string <s>, then wrap it in base64 encoding.Nr3)r�update�digestr)r�s�m�drrrr;es
zauth_handler.apply_hashcCsHt�d|j�g}t|jd�r|�|j���|�t�d��t�|�S)NzB<li>Authorization Extension : <b>Unauthorized requests:</b> %s<ul>�statusz</ul>)�	producers�simple_producerr�hasattrr
�appendrE�composite_producer)r�rrrrrEms����
zauth_handler.statusN)r	)
�__name__�
__module__�__qualname__rrr*r+r?r;rErrrrr"s
$	
rc@seZdZdd�Zdd�ZdS)rcCs
||_dSr
�r)rrrrrr}s
zdictionary_authorizer.__init__cCs(|\}}||jvr|j||krdSdS)NrrrO)rr)�username�passwordrrrr'�szdictionary_authorizer.authorizeN)rLrMrNrr'rrrrr|srzAuthorization: ([^ ]+) (.*))�RCS_ID�rer"r8�supervisor.compatrrrrrr�supervisor.medusa.counter�medusar�!supervisor.medusa.default_handler�default_handlerr�supervisor.medusa.producersrFrr�compile�
IGNORECASErrrrr�<module>s$Z�
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY