ó
    Ö›‘h…  ã                   óš   • S r SSKrSSKJr  SSKJrJrJrJr  SSK	J
r
  SSKJrJrJrJr  SSKJr  SSKJr   " S	 S
\R(                  5      rg)z‚
A Factory for SSH servers.

See also L{twisted.conch.openssh_compat.factory} for OpenSSH compatibility.

Maintainer: Paul Swartz
é    N)Úchain)ÚDictÚListÚOptionalÚTuple)Úerror)Ú_kexÚ
connectionÚ	transportÚuserauth)Úprotocol)ÚLoggerc                   ó  • \ rS rSr% Sr\\\\\	\\4      4      \
S'   \" 5       r\R                  r\R"                  \R&                  S.rSS jrS rS	 rS
 rS\\\\\	\\4      4      4S jrS\S\	\\4   4S jrS rSrg)Ú
SSHFactoryé   z
A Factory for SSH servers.
Úprimes)ó   ssh-userauths   ssh-connectionÚreturnNc                 óZ  • [        U S5      (       d  U R                  5       U l        [        U S5      (       d  U R                  5       U l        U R                  (       a  U R                  (       d  [
        R                  " S5      e[        U S5      (       d  U R                  5       U l        gg)z$
Check for public and private keys.
Ú
publicKeysÚprivateKeyszno host keys, failingr   N)	ÚhasattrÚgetPublicKeysr   ÚgetPrivateKeysr   r   Ú
ConchErrorÚ	getPrimesr   ©Úselfs    Ú]C:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/conch/ssh/factory.pyÚstartFactoryÚSSHFactory.startFactory&   s€   € ô �t˜\×*Ñ*Ø"×0Ñ0Ó2ˆDŒOÜ�t˜]×+Ñ+Ø#×2Ñ2Ó4ˆDÔØ�� d×&6×&6Ü×"Ò"Ð#:Ó;Ð;Ü�t˜X×&Ñ&ØŸ.™.Ó*ˆD�Kð 'ó    c                 óà  • [         R                  R                  X5      n[        [        R
                  " S U R                  R                  5        5       5      5      Ul        U R                  (       du  U R                  R                  S5        UR                   Vs/ s H=  n[        R                  " U5      (       d  [        R                  " U5      (       d  M;  UPM?     snUl        U$ s  snf )a  
Create an instance of the server side of the SSH protocol.

@type addr: L{twisted.internet.interfaces.IAddress} provider
@param addr: The address at which the server will listen.

@rtype: L{twisted.conch.ssh.transport.SSHServerTransport}
@return: The built transport.
c              3   ó@   #   • U  H  oR                  5       v •  M     g 7f©N)ÚsupportedSignatureAlgorithms)Ú.0Úkeys     r   Ú	<genexpr>Ú+SSHFactory.buildProtocol.<locals>.<genexpr>?   s   é € ð  Ú>W°s×0Ñ0×2Ð2Ò>Wùs   ‚zTdisabling non-fixed-group key exchange algorithms because we cannot find moduli file)r   ÚFactoryÚbuildProtocolÚlistr   Úfrom_iterabler   ÚvaluesÚsupportedPublicKeysr   Ú_logÚinfoÚsupportedKeyExchangesr	   ÚisFixedGroupÚisEllipticCurve)r   ÚaddrÚtÚkexAlgorithms       r   r,   ÚSSHFactory.buildProtocol3   sÁ   € ô ×Ñ×*Ñ*¨4Ó6ˆÜ $Ü×Òñ  Ø>B×>NÑ>N×>UÑ>UÔ>Wó ó ó!
ˆÔð
 �{�{Ø�I‰I�N‰Nð5ôð %&×$;Ò$;ó'â$;�LÜ×$Ò$ \×2Ñ2´d×6JÒ6JÈ<×6X÷ Ù$;ñ'ˆAÔ#ð
 ˆùò's   Â:C+ÃC+c                 ó   • [        S5      e)z­
Called when the factory is started to get the public portions of the
servers host keys.  Returns a dictionary mapping SSH key types to
public key strings.

@rtype: L{dict}
zgetPublicKeys unimplemented©ÚNotImplementedErrorr   s    r   r   ÚSSHFactory.getPublicKeysO   s   € ô "Ð"?Ó@Ð@r"   c                 ó   • [        S5      e)zÂ
Called when the factory is started to get the  private portions of the
servers host keys.  Returns a dictionary mapping SSH key types to
L{twisted.conch.ssh.keys.Key} objects.

@rtype: L{dict}
zgetPrivateKeys unimplementedr;   r   s    r   r   ÚSSHFactory.getPrivateKeysY   s   € ô "Ð"@ÓAÐAr"   c                 ó   • g)z®
Called when the factory is started to get Diffie-Hellman generators and
primes to use.  Returns a dictionary mapping number of bits to lists of
tuple of (generator, prime).
N© r   s    r   r   ÚSSHFactory.getPrimesc   s   � r"   Úbitsc                 óè   ^• S[         S[         4U4S jjnU R                  c   S5       e[        U R                  R                  5       US9nUS   n[        R
                  " U R                  U   5      $ )zj
Return a tuple of (g, p) for a Diffe-Hellman process, with p being as
close to C{bits} bits as possible.
Úir   c                 ó    >• [        U T-
  5      $ r%   )Úabs)rE   rC   s    €r   ÚkeyfuncÚ&SSHFactory.getDHPrime.<locals>.keyfuncp   s   ø€ Ü�q˜4‘x“=Ð r"   z(Factory should have been started by now.)r(   r   )Úintr   ÚsortedÚkeysÚrandomÚchoice)r   rC   rH   Ú
primesKeysÚrealBitss    `   r   Ú
getDHPrimeÚSSHFactory.getDHPrimej   sh   ø€ ð	!”sð 	!œs÷ 	!ð �{‰{Ñ&ÐRÐ(RÓRÐ&Ü˜DŸK™K×,Ñ,Ó.°GÑ<ˆ
Ø˜a‘=ˆÜ�}Š}˜TŸ[™[¨Ñ2Ó3Ð3r"   c                 óP   • US:X  d  [        US5      (       a  U R                  U   $ g)zÅ
Return a class to use as a service for the given transport.

@type transport:    L{transport.SSHServerTransport}
@type service:      L{bytes}
@rtype:             subclass of L{service.SSHService}
r   ÚavatarN)r   Úservices)r   r   Úservices      r   Ú
getServiceÚSSHFactory.getServicex   s-   € ð �oÓ%¬°¸H×)EÑ)EØ—=‘= Ñ)Ð)ð *Fr"   )r   r   r   )r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   rJ   r   r   Ú__annotations__r   r1   r   ÚSSHServerTransportr   r   ÚSSHUserAuthServerr
   ÚSSHConnectionrU   r    r,   r   r   r   rQ   rW   Ú__static_attributes__rA   r"   r   r   r      s¶   ‡ ñð �T˜#˜t E¨#¨s¨(¡OÑ4Ð4Ñ5Ñ6Ó6á‹8€DØ×+Ñ+€Hð "×3Ñ3Ø%×3Ñ3ñ€Hô
+òò8AòBð˜8 D¨¨d°5¸¸c¸±?Ñ.CÐ)CÑ$DÑEô ð4˜sð 4 u¨S°#¨X¡ô 4õ	*r"   r   )r]   rM   Ú	itertoolsr   Útypingr   r   r   r   Útwisted.conchr   Útwisted.conch.sshr	   r
   r   r   Útwisted.internetr   Útwisted.loggerr   r+   r   rA   r"   r   Ú<module>ri      s;   ðñó Ý ß .Ó .å ß CÓ CÝ %Ý !ôj*�×!Ñ!õ j*r"   