summaryrefslogtreecommitdiffstats
path: root/notFinishedCode/SSHTunnelClass.py
diff options
context:
space:
mode:
Diffstat (limited to 'notFinishedCode/SSHTunnelClass.py')
-rw-r--r--notFinishedCode/SSHTunnelClass.py36
1 files changed, 26 insertions, 10 deletions
diff --git a/notFinishedCode/SSHTunnelClass.py b/notFinishedCode/SSHTunnelClass.py
index be2d145..e71f2ee 100644
--- a/notFinishedCode/SSHTunnelClass.py
+++ b/notFinishedCode/SSHTunnelClass.py
@@ -1,6 +1,6 @@
import subprocess
import string
-
+from time import sleep
class SSHTunneling:
def __init__(self, localPort, remotePort, remoteServer, username, password):
@@ -19,20 +19,36 @@ class SSHTunneling:
uad = self.usern + '@' + self.rServer
#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
+
+
+
+# result = subprocess.Popen(['ssh', '-f', '-L', command, uad, 'sleep', '40'])
+# stdout = subprocess.PIPE
+# stderr = subprocess.PIPE
+# output = result.communicate()
+# status = result.poll()
+
+
+ return subprocess.Popen(['ssh', '-N', '-L', command, uad], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
+# stat = ssh_proc.poll()
+# while stat == None:
+# stat = ssh_proc.poll()
+# sleep(1)
+# print 'test'
+# print stat
+# 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):
-x = SSHTunneling(34675, 5000, '132.230.4.202', 'rz-gsm-testing', 'r')
+x = SSHTunneling(50000, 80, '132.230.4.202', 'rz-gsm-testing', 'r')
y = x.startTunneling()
+print 'Tunnel started '
+sleep(50)
+y.kill()
+print 'kill tunnel'
#print y