summaryrefslogtreecommitdiffstats
path: root/notFinishedCode
diff options
context:
space:
mode:
authorRefik Hadzialic2011-08-17 13:19:18 +0200
committerRefik Hadzialic2011-08-17 13:19:18 +0200
commita90ecc22931ef30e236dd39c8695147691a03a42 (patch)
tree5646afad3bf1dc3a35f853c458f3404d973b452c /notFinishedCode
parentChanged the display messages! (diff)
downloadgsm-selftest-a90ecc22931ef30e236dd39c8695147691a03a42.tar.gz
gsm-selftest-a90ecc22931ef30e236dd39c8695147691a03a42.tar.xz
gsm-selftest-a90ecc22931ef30e236dd39c8695147691a03a42.zip
Changed the SSHTunneling script class
Diffstat (limited to 'notFinishedCode')
-rw-r--r--notFinishedCode/SSHTunnelClass.py24
1 files changed, 20 insertions, 4 deletions
diff --git a/notFinishedCode/SSHTunnelClass.py b/notFinishedCode/SSHTunnelClass.py
index 39f05a4..be2d145 100644
--- a/notFinishedCode/SSHTunnelClass.py
+++ b/notFinishedCode/SSHTunnelClass.py
@@ -4,7 +4,7 @@ import string
class SSHTunneling:
def __init__(self, localPort, remotePort, remoteServer, username, password):
- self.lPort = localport
+ self.lPort = localPort
self.rPort = remotePort
self.rServer = remoteServer
@@ -15,8 +15,24 @@ class SSHTunneling:
def startTunneling(self):
if self.__tunnelStarted == 0:
- command = str(self.lPort) + ':' + self.rServer + ':' str(self.rPort)
+ 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]
+ #result = subprocess.Popen(['ssh', '-f', '-g', '-A', '-X', '-N', '-L', command, uad, '&'], stdout = subprocess.PIPE, stderr = subprocess.STDOUT, stdin = subprocess.PIPE).communicate()[0]
+ #result = subprocess.Popen(['ssh', '-f', '-g', '-A', '-X', '-N', '-L', command, uad])
+ result = subprocess.Popen(['ssh', '-f', '-L', command, uad, 'sleep', '40'])
+ stdout = subprocess.PIPE
+ stderr = subprocess.PIPE
+ output = result.communicate()
+ status = result.poll()
+ print 'ovo je output', stdout
+ print 'stderr ', stderr
+ print 'ovo je status', status
+ # while status == 0:
+ # status = result.poll()
+ # print 'test'
+ #print output
+# def closeTunneling(self):
- def closeTunneling(self):
+x = SSHTunneling(34675, 5000, '132.230.4.202', 'rz-gsm-testing', 'r')
+y = x.startTunneling()
+#print y