Package diffpy :: Package pdfgui :: Package control :: Module connection :: Class Connection
[hide private]
[frames] | no frames]

Class Connection

source code

SSH2 Connection and tunnel support

Data member:
transport: a paramiko transport object
session: a paramiko session
channel: a fake channel for HTTP transport through ssh tunnelling

host: remote host name
user: remote account user name
port: remote port
auth: authentication type
passwd: password for remote account
keyFile: local file for RSA/DSA keys
passphrase: passphrase of RSA/DSA 



Instance Methods [hide private]
 
__init__(self, owner)
initialize...
source code
 
isConnected(self)
check if this connection is still alive...
source code
 
connect(self, host, user, port, auth, passwd=None, keyFile=None, passphrase=None)
make a ssh2 connection to the remote host.
source code
 
close(self)
close remote connection All the tunnel will be closed as well.
source code
 
__rsa_auth(self, transport)
Authorize connection with default rsa key location.
source code
 
__dsa_auth(self, transport)
Authorize connection with default dsa key location.
source code
 
getXMLRPCTransport(self)
make a HTTP transport to remote host through SSH tunnelling.
source code
 
openTunnel(self, address)
As requested by xmlrpclib.Transport, open a ssh2 tunnel...
source code
 
execute(self, cmd, n=1024)
execute a command...
source code
Class Variables [hide private]
  DefaultPort = 22
  PSWDAUTH = 0
  RSAAUTH = 1
  DSAAUTH = 2
Method Details [hide private]

__init__(self, owner)
(Constructor)

source code 
initialize

owner -- object who starts the connection

isConnected(self)

source code 
check if this connection is still alive
        

connect(self, host, user, port, auth, passwd=None, keyFile=None, passphrase=None)

source code 
make a ssh2 connection to the remote host. 

host -- remote host machine
user -- username 
port -- port of remote ssh service
auth -- authenticate method, PSWDAUTH,RSAAUTH,DSAAUTH
passwd --  only required if use PSWDAUTH
keyFile -- only required if use RSAAUTH or DSAAUTH
passphrase -- only required if use RSAAUTH or DSAAUTH, and passphrase is set

__rsa_auth(self, transport)

source code 
Authorize connection with default rsa key location.

transport -- paramiko transport

__dsa_auth(self, transport)

source code 
Authorize connection with default dsa key location.

transport -- paramiko transport

getXMLRPCTransport(self)

source code 
make a HTTP transport to remote host through SSH tunnelling. 

return: a xmlrpc  transport instance

openTunnel(self, address)

source code 
As requested by xmlrpclib.Transport, open a ssh2 tunnel

address -- host:port string
return: a sshe tunnel

execute(self, cmd, n=1024)

source code 
execute a command

cmd -- command to be run remotely
n -- size of output to be returned
return -- output