[Twisted-Python] SSH connection

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

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?

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.
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.
... 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
Is there some way around this compile issue, does anyone know of a precompiled Windows binary for the PyCrypto kit??
Propably it exists somewhere. Google! :)

On Fri, 2004-02-27 at 11:18, Schollnick, Benjamin wrote:
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
Yes, it uses several modules, all of which are documented in the README and INSTALL files.
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))
SSH is considerably more complex than telnet, and so has considerably more dependencies.
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??
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

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