[Twisted-Python] failure to connect to sshsimpleserver.py

Hello, I'm just starting to use twisted (having quickly read through the book "Twisted: Network Programming Essentials"), and I am unable to successfully use one of the example scripts: doc/conch/examples/ sshsimpleserver.py . I am using python 2.5.2 and today's svn of twisted and pycrypto on RedHat AS5 x84-64. I experienced similar results with 8.1.0 . I am able to start the server with no problem, but when I start a client that connects to it, I get: 2008-09-23 21:51:08+0000 [-] Log opened. 2008-09-23 21:51:08+0000 [-] __main__.ExampleFactory starting on 5022 2008-09-23 21:51:08+0000 [-] Starting factory <__main__.ExampleFactory instance at 0x17e60a28> 2008-09-23 21:51:10+0000 [__main__.ExampleFactory] disabling diffie- hellman-group-exchange because we cannot find moduli file 2008-09-23 21:51:10+0000 [SSHServerTransport,0,127.0.0.1] kex alg, key alg: diffie-hellman-group1-sha1 ssh-rsa 2008-09-23 21:51:10+0000 [SSHServerTransport,0,127.0.0.1] outgoing: aes256-ctr hmac-sha1 none 2008-09-23 21:51:10+0000 [SSHServerTransport,0,127.0.0.1] incoming: aes256-ctr hmac-sha1 none 2008-09-23 21:51:10+0000 [SSHServerTransport,0,127.0.0.1] Unhandled Error Traceback (most recent call last): File "/usr/DiamondBack/stow/twisted-20080923_svn-py2.5/lib/ python2.5/site-packages/twisted/python/log.py", line 51, in callWithLogger return callWithContext({"system": lp}, func, *args, **kw) File "/usr/DiamondBack/stow/twisted-20080923_svn-py2.5/lib/ python2.5/site-packages/twisted/python/log.py", line 36, in callWithContext return context.call({ILogContext: newCtx}, func, *args, **kw) File "/usr/DiamondBack/stow/twisted-20080923_svn-py2.5/lib/ python2.5/site-packages/twisted/python/context.py", line 59, in callWithContext return self.currentContext().callWithContext(ctx, func, *args, **kw) File "/usr/DiamondBack/stow/twisted-20080923_svn-py2.5/lib/ python2.5/site-packages/twisted/python/context.py", line 37, in callWithContext return func(*args,**kw) --- <exception caught here> --- File "/usr/DiamondBack/stow/twisted-20080923_svn-py2.5/lib/ python2.5/site-packages/twisted/internet/selectreactor.py", line 146, in _doReadOrWrite why = getattr(selectable, method)() File "/usr/DiamondBack/stow/twisted-20080923_svn-py2.5/lib/ python2.5/site-packages/twisted/internet/tcp.py", line 463, in doRead return self.protocol.dataReceived(data) File "/usr/DiamondBack/stow/twisted-20080923_svn-py2.5/lib/ python2.5/site-packages/twisted/conch/ssh/transport.py", line 314, in dataReceived self.dispatchMessage(messageNum, packet[1:]) File "/usr/DiamondBack/stow/twisted-20080923_svn-py2.5/lib/ python2.5/site-packages/twisted/conch/ssh/transport.py", line 329, in dispatchMessage f(payload) File "/usr/DiamondBack/stow/twisted-20080923_svn-py2.5/lib/ python2.5/site-packages/twisted/conch/ssh/transport.py", line 740, in ssh_KEX_DH_GEX_REQUEST_OLD NS(self.factory.privateKeys[self.keyAlg].sign(exchangeHash))) File "/usr/DiamondBack/stow/twisted-20080923_svn-py2.5/lib/ python2.5/site-packages/twisted/conch/ssh/keys.py", line 659, in sign signature = self.keyObject.sign(digest, '')[0] File "/usr/DiamondBack/stow/pycrypto-20080923_git-py2.5/lib/ python2.5/site-packages/Crypto/PublicKey/pubkey.py", line 76, in sign return self._sign(M, K) exceptions.TypeError: _sign() takes exactly 2 arguments (3 given) 2008-09-23 21:51:10+0000 [SSHServerTransport,0,127.0.0.1] connection lost I have tried starting the client both as 'ssh localhost -p 5022' as well as running the sshsimpleclient.py script with the same results. I have also tried connecting from a different host into the server, with the same results. Any help in resolving this issue and realizing a working example of an ssh server would be greatly appreciated. Thank you, Glen Mabey

On Tue, 23 Sep 2008 16:58:48 -0500, Glen Mabey <glen.mabey@swri.org> wrote:
Hello,
I'm just starting to use twisted (having quickly read through the book "Twisted: Network Programming Essentials"), and I am unable to successfully use one of the example scripts: doc/conch/examples/ sshsimpleserver.py .
I am using python 2.5.2 and today's svn of twisted and pycrypto on RedHat AS5 x84-64. I experienced similar results with 8.1.0 .
This looks a lot like a bug in PyCrypto:
I am able to start the server with no problem, but when I start a client that connects to it, I get:
[snip] File "/usr/DiamondBack/stow/pycrypto-20080923_git-py2.5/lib/ python2.5/site-packages/Crypto/PublicKey/pubkey.py", line 76, in sign return self._sign(M, K) exceptions.TypeError: _sign() takes exactly 2 arguments (3 given)
This is a file in PyCrypto itself, calling a method in PyCrypto itself, and passing the wrong arguments. You might want to try using the last release of PyCrypto instead of the latest development snapshot. You might also want to file a bug with the PyCrypto maintainer (it seems there's a new one now) to get this fixed. Jean-Paul

Hi Jean-Paul, On Sep 23, 2008, at 5:06 PM, Jean-Paul Calderone wrote:
This looks a lot like a bug in PyCrypto:
Yeah, I should have noticed that myself.
This is a file in PyCrypto itself, calling a method in PyCrypto itself, and passing the wrong arguments.
You might want to try using the last release of PyCrypto instead of the latest development snapshot. You might also want to file a bug with the PyCrypto maintainer (it seems there's a new one now) to get this fixed.
I did revert to 2.0.1 and the problem did go away. I will file a bug report to the PyCrypto guy. Thank you, Glen Mabey
participants (2)
-
Glen Mabey
-
Jean-Paul Calderone