From b99193ba68f947802245a288940e54904ecbee61 Mon Sep 17 00:00:00 2001 From: Triatmoko Date: Fri, 18 Nov 2011 13:23:49 +0100 Subject: final version --- Under-Testing/Server-Code-New/SSHTunnelBoxClass.py | 44 ---------------------- 1 file changed, 44 deletions(-) delete mode 100644 Under-Testing/Server-Code-New/SSHTunnelBoxClass.py (limited to 'Under-Testing/Server-Code-New/SSHTunnelBoxClass.py') diff --git a/Under-Testing/Server-Code-New/SSHTunnelBoxClass.py b/Under-Testing/Server-Code-New/SSHTunnelBoxClass.py deleted file mode 100644 index 1b76d0b..0000000 --- a/Under-Testing/Server-Code-New/SSHTunnelBoxClass.py +++ /dev/null @@ -1,44 +0,0 @@ -#Here is a tutorial how to generate and copy your RSA SSH public key :) -#>>> http://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-ssh-copy-id/ -import subprocess -from time import sleep - -class SSHTunneling: - - def __init__(self, localPort, remotePort, remoteServer, username, password): - self.lPort = localPort - self.rPort = remotePort - self.rServer = remoteServer - - self.usern = username - self.passw = password - - self.__tunnelStarted = 0 - self.__sshTunnel = 1 - - def startTunneling(self): - if self.__tunnelStarted == 0: - command = str(self.lPort) + ':' + self.rServer + ':' + str(self.rPort) - uad = self.usern + '@' + self.rServer - - try: - self.__sshTunnel = subprocess.Popen(['ssh','-p','7884','-N', '-L', command, uad], stdin=subprocess.PIPE, stdout=subprocess.PIPE) - sleep(2) - self.__tunnelStarted = 1 - return 1 - except Exception, e: - error = str(e) - return 0 - - def killTunneling(self): - if self.__tunnelStarted == 1: - try: - self.__sshTunnel.kill() - self.__tunnelStarted = 0 - return 1 - - except Exception, e: - error = str(e) - return 0 - - -- cgit v1.2.3-55-g7522