[Twisted-Python] SSH connection
![](https://secure.gravatar.com/avatar/f74c6f649da2bbdf30f77041943ea1bb.jpg?s=120&d=mm&r=g)
Paul, I am attempting to use Twisted, for a simple SSH connection... As a example, I am using "The Transport" example from the how to's... from twisted.conch import error from twisted.conch.ssh import transport from twisted.internet import defer class ClientTransport(transport.SSHClientTransport): def verifyHostKey(self, pubKey, fingerprint): if fingerprint != 'b1:94:6a:c9:24:92:d2:34:7c:62:35:b4:d2:61:11:84': return defer.fail(error.ConchError('bad key')) else: return defer.succeed(1) def connectionSecure(self): self.requestService(ClientUserAuth('user', ClientConnection())) But.... It appears that something was not installed with the installer? C:\develope\versions\test_code>ssh_test.py Traceback (most recent call last): File "C:\develope\versions\test_code\ssh_test.py", line 2, in ? from twisted.conch.ssh import transport File "C:\develope\Python23\Lib\site-packages\twisted\conch\ssh\transport.py", line 37, in ? from Crypto import Util ImportError: No module named Crypto I am assuming that there is a prequiste package that needs to be installed, presumably one of the multitude of Cryptography packages that I find on the Vaults of Parnassus.... Is this accurate? And if so, what package? On the assumption it is PyCrypto.... I tried to install PyCrypto... (The sad thing is that I'm running through all these hoops simply because I need to be able to make a SSH connection, and be able to read and write to the stream... (ala Telnetlib)) when I: setup.py install I receive: C:\develope\pycrypto-1.9a6>setup.py install running install running build running build_py running build_ext error: Python was built with version 6 of Visual Studio, and extensions need to be built with the same version of the compiler, but it isn't installed. Now I am running: C:\develope\pycrypto-1.9a6>python Python 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> I also have win32-157 installed.... Is there some way around this compile issue, does anyone know of a precompiled Windows binary for the PyCrypto kit?? - Benjamin
![](https://secure.gravatar.com/avatar/d7875f8cfd8ba9262bfff2bf6f6f9b35.jpg?s=120&d=mm&r=g)
Summary - you need to install PyCrypto, and if you do it from source that means you need to do it with a compiler installed. You can use mingw compiler with a bit of work (there's a howto somewhere), or you can find a pre-compiled version. http://webcleaner.sourceforge.net/ has instructions on compiling pycrypto on windows. Anyone have a precompiled exe we can put on the site?
![](https://secure.gravatar.com/avatar/fdaa75758deee2fce225653d708b9557.jpg?s=120&d=mm&r=g)
Schollnick, Benjamin [Fri, Feb 27, 2004 at 11:18:55AM -0500]:
On the assumption it is PyCrypto.... I tried to install PyCrypto...
Yes, you're right. The package is called py-amkCrypto in pkgsrc, homepage at http://www.amk.ca/python/code/crypto.html, works with py-twisted on Unix.
... and that's right! To build python packages you will sometimes need a C compiler. gcc for Windows is called "mingw" or "mingw32" (mingw.sf.net), but I suggest using Dev-C++ from Bloodshed.net (http://www.bloodshed.net/). To "teach" distutils to use mingw, you will need some voodo: http://sebsauvage.net/python/mingw.html
Propably it exists somewhere. Google! :)
![](https://secure.gravatar.com/avatar/f2bb7225b5047991e87a44acf37e8373.jpg?s=120&d=mm&r=g)
On Fri, 2004-02-27 at 11:18, Schollnick, Benjamin wrote:
Yes, it uses several modules, all of which are documented in the README and INSTALL files.
SSH is considerably more complex than telnet, and so has considerably more dependencies.
I had a binary for 1.9a5, I'll try to compile one for current CVS and put it up somewhere. -p -- Paul Swartz (o_ z3p at twistedmatrix dot com //\ http://www.twistedmatrix.com/users/z3p.twistd/ V_/_ AIM: Z3Penguin
![](https://secure.gravatar.com/avatar/d7875f8cfd8ba9262bfff2bf6f6f9b35.jpg?s=120&d=mm&r=g)
On Fri, 2004-02-27 at 11:44, Paul Swartz wrote:
I had a binary for 1.9a5, I'll try to compile one for current CVS and put it up somewhere.
Put it on twisted.sf.net/contrib/ and link to it on twistedmatrix.com/products/downloads/ in the dependencies section, as radix did for pyOpenSSL. -- Itamar Shtull-Trauring http://itamarst.org Looking for a job: http://itamarst.org/resume.html
![](https://secure.gravatar.com/avatar/d7875f8cfd8ba9262bfff2bf6f6f9b35.jpg?s=120&d=mm&r=g)
Summary - you need to install PyCrypto, and if you do it from source that means you need to do it with a compiler installed. You can use mingw compiler with a bit of work (there's a howto somewhere), or you can find a pre-compiled version. http://webcleaner.sourceforge.net/ has instructions on compiling pycrypto on windows. Anyone have a precompiled exe we can put on the site?
![](https://secure.gravatar.com/avatar/fdaa75758deee2fce225653d708b9557.jpg?s=120&d=mm&r=g)
Schollnick, Benjamin [Fri, Feb 27, 2004 at 11:18:55AM -0500]:
On the assumption it is PyCrypto.... I tried to install PyCrypto...
Yes, you're right. The package is called py-amkCrypto in pkgsrc, homepage at http://www.amk.ca/python/code/crypto.html, works with py-twisted on Unix.
... and that's right! To build python packages you will sometimes need a C compiler. gcc for Windows is called "mingw" or "mingw32" (mingw.sf.net), but I suggest using Dev-C++ from Bloodshed.net (http://www.bloodshed.net/). To "teach" distutils to use mingw, you will need some voodo: http://sebsauvage.net/python/mingw.html
Propably it exists somewhere. Google! :)
![](https://secure.gravatar.com/avatar/f2bb7225b5047991e87a44acf37e8373.jpg?s=120&d=mm&r=g)
On Fri, 2004-02-27 at 11:18, Schollnick, Benjamin wrote:
Yes, it uses several modules, all of which are documented in the README and INSTALL files.
SSH is considerably more complex than telnet, and so has considerably more dependencies.
I had a binary for 1.9a5, I'll try to compile one for current CVS and put it up somewhere. -p -- Paul Swartz (o_ z3p at twistedmatrix dot com //\ http://www.twistedmatrix.com/users/z3p.twistd/ V_/_ AIM: Z3Penguin
![](https://secure.gravatar.com/avatar/d7875f8cfd8ba9262bfff2bf6f6f9b35.jpg?s=120&d=mm&r=g)
On Fri, 2004-02-27 at 11:44, Paul Swartz wrote:
I had a binary for 1.9a5, I'll try to compile one for current CVS and put it up somewhere.
Put it on twisted.sf.net/contrib/ and link to it on twistedmatrix.com/products/downloads/ in the dependencies section, as radix did for pyOpenSSL. -- Itamar Shtull-Trauring http://itamarst.org Looking for a job: http://itamarst.org/resume.html
participants (4)
-
Itamar Shtull-Trauring
-
Michal Pasternak
-
Paul Swartz
-
Schollnick, Benjamin