summaryrefslogtreecommitdiffstats
path: root/notFinishedCode
diff options
context:
space:
mode:
authorRefik Hadzialic2011-08-03 17:31:40 +0200
committerRefik Hadzialic2011-08-03 17:31:40 +0200
commitb9f06b128dc1769f7e4e00d18e11c54b482f57c9 (patch)
tree2eda0af67caa3ef2cbbc838e538baa463667823c /notFinishedCode
parentnew feature added. smart test and true table. (diff)
downloadgsm-selftest-b9f06b128dc1769f7e4e00d18e11c54b482f57c9.tar.gz
gsm-selftest-b9f06b128dc1769f7e4e00d18e11c54b482f57c9.tar.xz
gsm-selftest-b9f06b128dc1769f7e4e00d18e11c54b482f57c9.zip
SSH Tunneling class was started!
Diffstat (limited to 'notFinishedCode')
-rw-r--r--notFinishedCode/SSHTunnelClass.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/notFinishedCode/SSHTunnelClass.py b/notFinishedCode/SSHTunnelClass.py
new file mode 100644
index 0000000..39f05a4
--- /dev/null
+++ b/notFinishedCode/SSHTunnelClass.py
@@ -0,0 +1,22 @@
+import subprocess
+import string
+
+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
+
+ def startTunneling(self):
+ if self.__tunnelStarted == 0:
+ command = str(self.lPort) + ':' + self.rServer + ':' str(self.rPort)
+ uad = self.usern + '@' + self.rServer
+ result = subprocess.Popen(['ssh', '-f', '-g', '-A', '-X', '-N', '-L', command, uad], stdout = subprocess.PIPE, stderr = subprocces.STDOUT).communicate()[0]
+
+ def closeTunneling(self):