ϪfldZddlmZddlmZmZddlmZmZm Z ddl m Z ddl m Z ddlmZmZddlmZdd lmZmZGd d ZGd d Zeej0GddZGddej4ZdZy)z\ TAP plugin for creating telnet- and ssh-accessible manhole servers. @author: Jp Calderone ) implementer)servicestrports)manhole manhole_sshtelnet)insults)keys)checkersportal)protocol)filepathusageceZdZdZdZy)makeTelnetProtocolc||_yN)r )selfr s ;/usr/lib/python3/dist-packages/twisted/conch/manhole_tap.py__init__zmakeTelnetProtocol.__init__s  chtj}|jf}tj|g|Sr)rAuthenticatingTelnetProtocolr TelnetTransport)rauthargss r__call__zmakeTelnetProtocol.__call__s.22 ~%%d2T22rN__name__ __module__ __qualname__rrrrrrs 3rrceZdZdZdZy)chainedProtocolFactoryc||_yr) namespace)rr&s rrzchainedProtocolFactory.__init__ s "rc^tjtj|jSr)r ServerProtocolrColoredManholer&rs rrzchainedProtocolFactory.__call__#s%%g&<&z,_StupidRealm.requestAvatar..3sr)rITelnetProtocolr.r/r0NotImplementedError)ravatarId interfacess r requestAvatarz_StupidRealm.requestAvatar.sR  ! !Z /&&$$$d&7&7O4;N;NO  "##rN)rr r!rr;r"rrr,r,'s ! $rr,c@eZdZgdgdgdgdgdgdgZdZdZy ) Options) telnetPorttNzMstrports description of the address on which to listen for telnet connections)sshPortsNzJstrports description of the address on which to listen for ssh connections)passwdpz /etc/passwdz1name of a passwd(5)-format username/password file) sshKeyDirNz2Directory where the autogenerated SSH key is kept.) sshKeyNameNz server.keyz&Filename of the autogenerated SSH key.) sshKeySizeNiz,Size of the automatically generated SSH key.cLtjj|d|d<y)Nr&)rr=rr*s rrzOptions.__init__\s t$ [rcD|d|dtjdyy)Nr>r@zd <t!j|d| }|j#||S) a; Create a manhole server service. @type options: L{dict} @param options: A mapping describing the configuration of the desired service. Recognized key/value pairs are:: "telnetPort": strports description of the address on which to listen for telnet connections. If None, no telnet service will be started. "sshPort": strports description of the address on which to listen for ssh connections. If None, no ssh service will be started. "namespace": dictionary containing desired initial locals for manhole connections. If None, an empty dictionary will be used. "passwd": Name of a passwd(5)-format username/password file. "sshKeyDir": The folder that the SSH server key will be kept in. "sshKeyName": The filename of the key. "sshKeySize": The size of the key, in bits. Default is 4096. @rtype: L{twisted.application.service.IService} @return: A manhole service. r&rBr>r@rDrEr)getDataDirectoryrFrGsssh-rsa) r MultiServicer FilePasswordDBr,rTelnetBootstrapProtocolr r(rr)r Portalr ServerFactoryrrsetServiceParentr TerminalRealmr$ ConchFactorytwisted.python._appdirsrNrFilePathchildr _getPersistentRSAKeyint publicKeys privateKeys)optionssvcr&checker telnetRealm telnetPortal telnetFactory telnetServicesshRealm sshPortal sshFactorykeyDirrN keyLocationsshKey sshServices r makeServicerlgs>    C $I %%gh&78G|"  * *  " "  " "   }}[7)<  ..0 !3L!A  (()> N &&s+y,,.*@*K'MM(WI6  --i8 ; #4 4[)F @%'F''/55gl6KL **;GLrwsv '166)")%*33NN V]] $ $ $ ,emm,^Mr