|
|
@ -216,6 +216,8 @@ except: |
|
|
|
def connect_ssh(): |
|
|
|
def connect_ssh(): |
|
|
|
global shell, ssh |
|
|
|
global shell, ssh |
|
|
|
print 'connect_ssh' |
|
|
|
print 'connect_ssh' |
|
|
|
|
|
|
|
print paramiko.AutoAddPolicy() |
|
|
|
|
|
|
|
|
|
|
|
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) |
|
|
|
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) |
|
|
|
try: |
|
|
|
try: |
|
|
|
ssh.connect('127.0.0.1', public.getSSHPort()) |
|
|
|
ssh.connect('127.0.0.1', public.getSSHPort()) |
|
|
@ -226,14 +228,14 @@ def connect_ssh(): |
|
|
|
ssh.connect('localhost', public.getSSHPort()) |
|
|
|
ssh.connect('localhost', public.getSSHPort()) |
|
|
|
except: |
|
|
|
except: |
|
|
|
return False |
|
|
|
return False |
|
|
|
import firewalls |
|
|
|
# import firewalls |
|
|
|
fw = firewalls.firewalls() |
|
|
|
# fw = firewalls.firewalls() |
|
|
|
get = common.dict_obj() |
|
|
|
# get = common.dict_obj() |
|
|
|
get.status = '0' |
|
|
|
# get.status = '0' |
|
|
|
fw.SetSshStatus(get) |
|
|
|
# fw.SetSshStatus(get) |
|
|
|
ssh.connect('127.0.0.1', public.GetSSHPort()) |
|
|
|
ssh.connect('127.0.0.1', public.getSSHPort()) |
|
|
|
get.status = '1' |
|
|
|
# get.status = '1' |
|
|
|
fw.SetSshStatus(get) |
|
|
|
# fw.SetSshStatus(get) |
|
|
|
shell = ssh.invoke_shell(term='xterm', width=100, height=29) |
|
|
|
shell = ssh.invoke_shell(term='xterm', width=100, height=29) |
|
|
|
shell.setblocking(0) |
|
|
|
shell.setblocking(0) |
|
|
|
return True |
|
|
|
return True |
|
|
|