Server IP : 15.235.198.142 / Your IP : 216.73.216.149 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ballsack 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib/python3/dist-packages/twisted/words/protocols/jabber/__pycache__/ |
Upload File : |
� Ϫ�f� � � � d Z ddlmZ ddlmZ ddlmZ ddlmZm Z ddl mZmZ ddl mZmZ ddlmZ dd lmZmZmZ dd lmZmZmZ ddlmZmZ ddlmZmZm Z m!Z! dd l m"Z# e#jH sdZ"ne#Z" ed� Z& ed� Z'dZ(dZ) e*� Z+d� Z, G d� d� Z- G d� de-� Z. G d� de-� Z/ G d� de0� Z1 eejd � G d� d� � Z3 G d� de0� Z4 G d � d!e4� Z5 G d"� d#e4� Z6 G d$� d%e4� Z7 G d&� d'e3� Z8 G d(� d)ejr � Z9 G d*� d+ejt � Z: G d,� d-ejv ejx � Z= G d.� d/e0� Z>d0� Z? G d1� d2ej� � ZAd;d3�ZB eej� � G d4� d5� � ZD eej� � G d6� d7� � ZF G d8� d9eF� ZGg d:�ZHy# e%$ r dZ"Y ��hw xY w)<a2 XMPP XML Streams Building blocks for setting up XML Streams, including helping classes for doing authentication on either client or server side, and working with XML Stanzas. @var STREAM_AUTHD_EVENT: Token dispatched by L{Authenticator} when the stream has been completely initialized @type STREAM_AUTHD_EVENT: L{str}. @var INIT_FAILED_EVENT: Token dispatched by L{Authenticator} when the stream has failed to be initialized @type INIT_FAILED_EVENT: L{str}. @var Reset: Token to signal that the XML stream has been reset. @type Reset: Basic object. � )�hexlify)�sha1)�intern)�Optional�Tuple)�directlyProvides�implementer)�defer�protocol)�ConnectionLost)�failure�log� randbytes)�error�ijabber�jid)�domish� xmlstream)�STREAM_CONNECTED_EVENT�STREAM_END_EVENT�STREAM_ERROR_EVENT�STREAM_START_EVENT)�sslNz//event/stream/authdz//event/xmpp/initfailedz http://etherx.jabber.org/streamszurn:ietf:params:xml:ns:xmpp-tlsc �� � t | t � st d� �t |t � st d� �| � |� �}t |j d� � j � S )z� Create a SHA1-digest string of a session identifier and password. @param sid: The stream session identifier. @type sid: C{unicode}. @param password: The password to be hashed. @type password: C{unicode}. z/The session identifier must be a unicode objectz%The password must be a unicode objectzutf-8)� isinstance�str� TypeErrorr �encode� hexdigest)�sid�password�inputs �J/usr/lib/python3/dist-packages/twisted/words/protocols/jabber/xmlstream.py�hashPasswordr$ @ s[ � � �c�3���I�J�J��h��$��?�@�@��e�H�:��E�����W�%�&�0�0�2�2� c �( � e Zd ZdZd� Zd� Zd� Zd� Zy)� AuthenticatoraD Base class for business logic of initializing an XmlStream Subclass this object to enable an XmlStream to initialize and authenticate to different types of stream hosts (such as clients, components, etc.). Rules: 1. The Authenticator MUST dispatch a L{STREAM_AUTHD_EVENT} when the stream has been completely initialized. 2. The Authenticator SHOULD reset all state information when L{associateWithStream} is called. 3. The Authenticator SHOULD override L{streamStarted}, and start initialization there. @type xmlstream: L{XmlStream} @ivar xmlstream: The XmlStream that needs authentication @note: the term authenticator is historical. Authenticators perform all steps required to prepare the stream for the exchange of XML stanzas. c � � d | _ y �N�r ��selfs r# �__init__zAuthenticator.__init__h s � ���r% c � � y)a| Called by the XmlStream when the underlying socket connection is in place. This allows the Authenticator to send an initial root element, if it's connecting, or wait for an inbound root from the peer if it's accepting the connection. Subclasses can use self.xmlstream.send() to send any initial data to the peer. N� r+ s r# �connectionMadezAuthenticator.connectionMadek � � r% c � � |j d� r2|d j d� } t |d � t |d � f}nd}t | j j |� | j _ y# t t f$ r d}Y �Cw xY w)a� Called by the XmlStream when the stream has started. A stream is considered to have started when the start tag of the root element has been received. This examines C{rootElement} to see if there is a version attribute. If absent, C{0.0} is assumed per RFC 3920. Subsequently, the minimum of the version from the received stream header and the value stored in L{xmlstream} is taken and put back in L{xmlstream}. Extensions of this method can extract more information from the stream header and perform checks on them, optionally sending stream errors and closing the stream. �version�.r � )r r N)�hasAttribute�split�int� IndexError� ValueError�minr r3 )r, �rootElementr3 s r# � streamStartedzAuthenticator.streamStartedx s� � � �#�#�I�.�!�)�,�2�2�3�7�G� !��w�q�z�?�C��� �O�<�� �G�!$�T�^�^�%;�%;�W�!E������ � �+� !� �� !�s �A6 �6B � B c � � || _ y)a� Called by the XmlStreamFactory when a connection has been made to the requested peer, and an XmlStream object has been instantiated. The default implementation just saves a handle to the new XmlStream. @type xmlstream: L{XmlStream} @param xmlstream: The XmlStream that will be passing events to this Authenticator. Nr* �r, r s r# �associateWithStreamz!Authenticator.associateWithStream� s � � #��r% N)�__name__� __module__�__qualname__�__doc__r- r0 r= r@ r/ r% r# r'