[Twisted-Python] SSH connection

Paul Swartz z3p at twistedmatrix.com
Fri Feb 27 11:44:55 EST 2004


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20040227/ac7f0a55/attachment.pgp 


More information about the Twisted-Python mailing list