ó
    Ö›‘h  ã                   ó  • S r SSKrSSKJr  SSKJr  SSKJrJr  Sr	Sr
 " S S	\5      r " S
 S\5      r " S S\5      r " S S\5      r " S S\R                   5      r " S S5      r " S S\R                   5      r/ SQrg)z 
Ident protocol implementation.
é    N)Údefer)Úbasic)ÚfailureÚlogé   iÿÿ  c                   ó*   • \ rS rSrSrSrS\4S jrSrg)Ú
IdentErroré   z3
Can't determine connection owner; reason unknown.
zUNKNOWN-ERRORÚreturnc                 ó   • U R                   $ ©N)ÚidentDescription©Úselfs    Ú[C:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/protocols/ident.pyÚ__str__ÚIdentError.__str__   s   € Ø×$Ñ$Ð$ó    © N)	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Ústrr   Ú__static_attributes__r   r   r   r	   r	      s   † ñð 'Ðð%˜÷ %r   r	   c                   ó   • \ rS rSrSrSrSrg)ÚNoUseré   zu
The connection specified by the port pair is not currently in use or
currently not owned by an identifiable entity.
zNO-USERr   N©r   r   r   r   r   r   r   r   r   r   r   r      s   † ñð
 !Ór   r   c                   ó   • \ rS rSrSrSrSrg)ÚInvalidPorté'   a  
Either the local or foreign port was improperly specified. This should
be returned if either or both of the port ids were out of range (TCP
port numbers are from 1-65535), negative integers, reals or in any
fashion not recognized as a non-negative integer.
zINVALID-PORTr   Nr    r   r   r   r"   r"   '   s   † ñð &Ór   r"   c                   ó   • \ rS rSrSrSrSrg)Ú
HiddenUseré2   zy
The server was able to identify the user of this port, but the
information was not returned at the request of the user.
zHIDDEN-USERr   Nr    r   r   r   r%   r%   2   s   † ñð
 %Ór   r%   c                   ó<   • \ rS rSrSrS rS rS rS rS r	S r
S	rg
)ÚIdentServeré;   a½  
The Identification Protocol (a.k.a., "ident", a.k.a., "the Ident
Protocol") provides a means to determine the identity of a user of a
particular TCP connection. Given a TCP port number pair, it returns a
character string which identifies the owner of that connection on the
server's system.

Server authors should subclass this class and override the lookup method.
The default implementation returns an UNKNOWN-ERROR response for every
query.
c                 ó¬  • UR                  S5      n[        U5      S:w  a  U R                  5         g  [        [        U5      u  p4[
        Us=::  a
  [        ::  a-  O  O*[
        Us=::  a
  [        ::  a  O  OU R                  X45        g U R                  [        R                  " [        5       5      X45        g ! [         a    U R                  5          g f = f)NÚ,é   )ÚsplitÚlenÚinvalidQueryÚmapÚintÚ	_MIN_PORTÚ	_MAX_PORTÚ
validQueryÚ	_ebLookupr   ÚFailurer"   Ú
ValueError)r   ÚlineÚpartsÚportOnServerÚportOnClients        r   ÚlineReceivedÚIdentServer.lineReceivedH   sš   € Ø—
‘
˜3“ˆÜˆu‹:˜‹?Ø×ÑÕðÜ-0´°e«_Ñ*�ô
  Õ:´Ö:Ü! \Õ>´YÖ>à—O‘O LÕ?à—N‘NÜŸš¬«Ó6¸õøô ó $Ø×!Ñ!Ö#ð$ús   ³B6 Â6CÃCc                 ó8   • U R                   R                  5         g r   )Ú	transportÚloseConnectionr   s    r   r/   ÚIdentServer.invalidQuery\   s   € Ø�‰×%Ñ%Õ'r   c                 óF  • U R                   R                  5       R                  U4nU R                   R                  5       R                  U4n[        R
                  " U R                  X45      R                  U R                  X5      R                  U R                  X5        g)z·
Called when a valid query is received to look up and deliver the
response.

@param portOnServer: The server port from the query.
@param portOnClient: The client port from the query.
N)r?   ÚgetHostÚhostÚgetPeerr   ÚmaybeDeferredÚlookupÚaddCallbackÚ	_cbLookupÚ
addErrbackr5   )r   r:   r;   Ú
serverAddrÚ
clientAddrs        r   r4   ÚIdentServer.validQuery_   sv   € ð —^‘^×+Ñ+Ó-×2Ñ2°LÐ@ˆ
Ø—^‘^×+Ñ+Ó-×2Ñ2°LÐ@ˆ
Ü×Ò˜DŸK™K¨Ó@×LÑLØ�N‰N˜Ló	
ç
‰*�T—^‘^ \Õ
@r   c                 ó8   • Uu  pEU R                  SX#XE4-  5        g )Nz%d, %d : USERID : %s : %s)ÚsendLine)r   ÚresultÚsportÚcportÚsysNameÚuserIds         r   rI   ÚIdentServer._cbLookupm   s!   € Ø"ÑˆØ�‰Ð1°UÀ7Ð4SÑSÕTr   c                 óú   • UR                   " [        5      (       a!  U R                  SX#UR                  4-  5        g [        R
                  " U5        U R                  SX#[        UR                  5      4-  5        g )Nz%d, %d : ERROR : %s)Úcheckr	   rO   Úvaluer   Úerr)r   r   rQ   rR   s       r   r5   ÚIdentServer._ebLookupq   sZ   € Ø�=Š=œ×$Ñ$Ø�M‰MÐ/°5ÀÇÁÐ2OÑOÕPä�GŠG�GÔØ�M‰MØ%¨´zÀ'Ç-Á-Ó7PÐ(QÑQõr   c                 ó   • [        5       e)aù  
Lookup user information about the specified address pair.

Return value should be a two-tuple of system name and username.
Acceptable values for the system name may be found online at::

    U{http://www.iana.org/assignments/operating-system-names}

This method may also raise any IdentError subclass (or IdentError
itself) to indicate user information will not be provided for the
given query.

A Deferred may also be returned.

@param serverAddress: A two-tuple representing the server endpoint
of the address being queried.  The first element is a string holding
a dotted-quad IP address.  The second element is an integer
representing the port.

@param clientAddress: Like I{serverAddress}, but represents the
client endpoint of the address being queried.
©r	   )r   ÚserverAddressÚclientAddresss      r   rG   ÚIdentServer.lookupz   s   € ô. ‹lÐr   r   N)r   r   r   r   r   r<   r/   r4   rI   r5   rG   r   r   r   r   r(   r(   ;   s'   † ñ
òò((òAòUòõr   r(   c                   óx   • \ rS rSrSrSr SSKJr  \4S jrCS	 r
S
 rS rS rS rSrg! \	 a    SS jr Nf = f)ÚProcServerMixiné”   zDImplements lookup() to grab entries for responses from /proc/net/tcpÚLINUXr   )Úgetpwuidc                 ó   • U" U5      S   $ ©Nr   r   ©r   Úuidrd   s      r   ÚgetUsernameÚProcServerMixin.getUsernameœ   s   € Ù˜C“= Ñ#Ð#r   Nc                 ó   • [        5       er   r\   rg   s      r   ri   rj   ¢   s
   € Ü“,Ðr   c              #   ó¬   #   • [        S5       nUR                  5         U H  nUR                  5       v •  M     S S S 5        g ! , (       d  f       g = f7f)Nz/proc/net/tcp)ÚopenÚreadlineÚstrip)r   ÚfÚLs      r   ÚentriesÚProcServerMixin.entries¥   s8   é € Ü�/Ô" aØ�J‰JŒLÛ�Ø—g‘g“i”ñ ÷ #×"Ö"üs   ‚AŽ,Aº	AÁ
AÁAc                 ó¨   • SR                  [        [        [        R                  " S[        R
                  " S[        US5      5      5      5      5      $ )NÚ.Ú4Bz=Lé   )Újoinr0   r   ÚstructÚunpackÚpackr1   )r   Úhexstrs     r   ÚdottedQuadFromHexStringÚ'ProcServerMixin.dottedQuadFromHexString«   s9   € Ø�x‰xÜ””V—]’] 4¬¯ª°T¼3¸vÀr»?Ó)KÓLÓMó
ð 	
r   c                 óh   • UR                  S5      u  p#U R                  U5      n[        US5      nX#4$ )NÚ:rw   )r-   r}   r1   )r   ÚpackedÚaddrÚports       r   ÚunpackAddressÚProcServerMixin.unpackAddress°   s5   € Ø—\‘\ #Ó&‰
ˆØ×+Ñ+¨DÓ1ˆÜ�4˜‹}ˆØˆzÐr   c                 óÀ   • UR                  5       R                  5       nU R                  US   5      u  p4U R                  US   5      u  pV[        US   5      nX44XV4U4$ )Nr   r,   é   )ro   r-   r„   r1   )r   r8   r9   Ú	localAddrÚ	localPortÚ
remoteAddrÚ
remotePortrh   s           r   Ú	parseLineÚProcServerMixin.parseLine¶   sd   € Ø—
‘
“×"Ñ"Ó$ˆØ#×1Ñ1°%¸±(Ó;Ñˆ	Ø!%×!3Ñ!3°E¸!±HÓ!=Ñˆ
Ü�%˜‘(‹mˆØÐ%¨
Ð'?ÀÐDÐDr   c                 óÐ   • U R                  5        HI  nU R                  U5      u  pEnXR:X  d  M  US   US   :X  d  M,  U R                  U R                  U5      4s  $    [	        5       e)Nr   )rr   rŒ   ÚSYSTEM_NAMEri   r   )r   r]   r^   Úentrˆ   rŠ   rh   s          r   rG   ÚProcServerMixin.lookup½   s`   € Ø—<‘<–>ˆCØ)-¯©¸Ó)<Ñ&ˆI 3ØÕ*¨y¸©|¸}ÈQÑ?OÕ/OØ×(Ñ(¨$×*:Ñ*:¸3Ó*?Ð@Ò@ñ "ô
 ‹hˆr   r   r   )r   r   r   r   r   r�   Úpwdrd   ri   ÚImportErrorrr   r}   r„   rŒ   rG   r   r   r   r   ra   ra   ”   sO   † ÙNà€Kð
Ý à,4ô 	$ð ò ò
ò
òEõøð; ó ö	ðús   Œ+ «9¸9ra   c                   ó>   • \ rS rSr\\\\4rS r	S r
S rS rS rSrg)	ÚIdentClientéÆ   c                 ó   • / U l         g r   ©Úqueriesr   s    r   Ú__init__ÚIdentClient.__init__É   s	   € Øˆ�r   c                 ó  • U R                   R                  [        R                  " 5       X45        [	        U R                   5      S:”  a  U R                   S   S   $ U R                  SX4-  5        U R                   S   S   $ )z;
Lookup user information about the specified address pair.
r   éÿÿÿÿr   ú%d, %d)r™   Úappendr   ÚDeferredr.   rO   )r   r:   r;   s      r   rG   ÚIdentClient.lookupÌ   so   € ð 	�‰×ÑœUŸ^š^Ó-¨|ÐJÔKÜˆt�|‰|Ó˜qÓ Ø—<‘< Ñ# AÑ&Ð&à�‰�h ,Ð!=Ñ=Ô>Ø�|‰|˜BÑ Ñ"Ð"r   c                 óL  • U R                   (       d  [        R                  " SU< 35        g U R                   R                  S5      u  n  nU R	                  X!5        U R                   (       a7  U R                  SU R                   S   S   U R                   S   S   4-  5        g g )NzUnexpected server response: r   rž   r   r,   )r™   r   ÚmsgÚpopÚparseResponserO   )r   r8   ÚdÚ_s       r   r<   ÚIdentClient.lineReceived×   s�   € Ø�|�|Ü�GŠGÐ2°4±(Ð;Õ<à—l‘l×&Ñ& qÓ)‰GˆAˆq�!Ø×Ñ˜qÔ'Ø�|�|Ø—‘˜h¨$¯,©,°q©/¸!Ñ*<¸d¿l¹lÈ1¹oÈaÑ>PÐ)QÑQÕRð r   c                 ór   • U R                    H   nUS   R                  [        U5      5        M"     / U l         g rf   )r™   Úerrbackr	   )r   ÚreasonÚqs      r   ÚconnectionLostÚIdentClient.connectionLostà   s,   € Ø—”ˆAØˆa‰D�L‰Lœ FÓ+Ö,ñ àˆ�r   c                 ó”  • UR                  SS5      n[        U5      S:w  a  UR                  [        U5      5        g [	        [
        R                  U5      u  pEnUS:X  aW  U R                   H,  nUR                  U:X  d  M  UR                  U" U5      5          g    UR                  [        U5      5        g UR                  XV45        g )Nr€   r,   é   ÚERROR)
r-   r.   rª   r	   r0   r   ro   Ú
errorTypesr   Úcallback)r   Údeferredr8   r9   ÚportsÚtypeÚaddInfoÚets           r   r¥   ÚIdentClient.parseResponseå   s¢   € Ø—
‘
˜3 Ó"ˆÜˆu‹:˜‹?Ø×ÑœZ¨Ó-Õ.ä#&¤s§y¡y°%Ó#8Ñ ˆE˜Ø�w‹ØŸ/œ/�BØ×*Ñ*¨gÕ5Ø ×(Ñ(©¨D«Ô2Ùñ *ð × Ñ ¤¨DÓ!1Õ2à×!Ñ! 4 /Õ2r   r˜   N)r   r   r   r   r	   r   r"   r%   r²   rš   rG   r<   r­   r¥   r   r   r   r   r•   r•   Æ   s*   † Ø˜f k°:Ð>€Jòò	#òSòõ
3r   r•   )r	   r   r"   r%   r(   r•   ra   )r   ry   Útwisted.internetr   Útwisted.protocolsr   Útwisted.pythonr   r   r2   r3   Ú	Exceptionr	   r   r"   r%   ÚLineOnlyReceiverr(   ra   r•   Ú__all__r   r   r   Ú<module>rÀ      sŒ   ðñ
ó å "Ý #ß 'à€	Ø€	ô%�ô %ô!ˆZô !ô&�*ô &ô%�ô %ôV�%×(Ñ(ô V÷r/ñ /ôd,3�%×(Ñ(ô ,3ò^�r   