我有烦人的问题,
我有PC <> SERVER <>网元
只能从服务器(DCN)访问网络元素,因此我需要jump ssh。 我写了下面的脚本,它正在pycharm上工作,但是当用pyinstaller解压缩它时 它崩溃了,我认为它是模块问题。
带有paramiko的初始脚本在python上以EXE的形式运行正常,但是当我从jumpssh import SSHSession进行创建时,会出现问题。一旦添加此行,它就可以在pycharmm上工作,但不能作为EXE工作。 在崩溃之前,我已经附加了CMD的打印屏幕。
我真的需要您的帮助,这是我的工作。
##libraries
import paramiko
from jumpssh import SSHSession
###Def
def func_1() :
NE = input("\nPlease Enter the NE VM Name ")
stdin, stdout, stderr = ssh.exec_command("v1830cli -v " + NE + ' -a')
outlines = stdout.readlines()
resp = ''.join(outlines)
print(resp)
def func_4() :
NE_name = input("Please Enter the NE IP ")
# establish ssh connection between your local machine and the jump server
gateway_session = SSHSession(ipa, user, password=passw).open()
# from jump server, establish connection with a remote server
remote_session = gateway_session.get_remote_session(NE_name, password='ALu12#')
print(remote_session)
## The command to be excuted
print(" NE VM name : ") + print(remote_session.get_cmd_output('hostname'))
.....
.....
ask = str(input("\n Please Enter function number : "))
## choosing option
##option 1 >> to show all information
if ask == '1':
func_1()
...
....