Python putty中跳转服务器登录的pywinauto自动化与putty中手动跳转服务器登录的行为不同

Python putty中跳转服务器登录的pywinauto自动化与putty中手动跳转服务器登录的行为不同,python,paramiko,putty,pywinauto,Python,Paramiko,Putty,Pywinauto,我手动登录到我的一个应用程序GUI控制台(https://localhost:port)通过跳转服务器托管在企业内部网络上的服务器上。具体步骤如下: 1. Open putty 2. ssh(port 22) to the jumpserverhost.domain.com(this is a linux server) 3. Enter user, and passcode(RSA token) 4. Ensure the putty session window is alive/open

我手动登录到我的一个应用程序GUI控制台(https://localhost:port)通过跳转服务器托管在企业内部网络上的服务器上。具体步骤如下:

1. Open putty
2. ssh(port 22) to the jumpserverhost.domain.com(this is a linux server)
3. Enter user, and passcode(RSA token)
4. Ensure the putty session window is alive/open
5. Now open browser and open the Application console - https://localhost:port
   NOTE: "We don't use the direct server IP, we use localhost ip-127.0.0.1 and the port on which the application GUI is running"
6. Enter Application GUI user/password and do your work on the Application
我的要求是自动执行上述步骤,以便登录到我的应用程序GUI登录。这就是我所做的

a. Use a pywinauto script to automate the exact human steps from steps 1-4 above
请检查我的答案,以了解我用于任务的脚本

尽管我的pywinauto脚本工作正常,并通过putty登录到跳转服务器,但我无法连接到应用程序GUI,请参见下图

但每次我使用上面的步骤1-4手动登录到跳转服务器时,应用程序GUI登录页面将在以下位置打开:。见下图

为什么它会通过自动脚本改变行为

我还查阅了许多文章,这些文章建议通过
paramiko
自动化ssh连接,在这种情况下它会工作吗?(考虑到连接到跳转服务器的ssh连接在连接到应用程序GUI之前需要处于活动状态)


我对跳转服务器工作原理的了解非常肤浅,请帮助。

因此我怀疑问题在于您使用Putty创建了到相关服务器的SSH隧道连接,而pywinauto命令可能只是打开了一个正常的SSH连接。您可以检查该服务器的Putty配置中是否在Connections>ssh>Tunnels下配置了ssh隧道

从我在你的报告中看到的情况来看,你在那里发出的命令似乎确实如此:

putty.exe -ssh uname@host.domain.com
不会创建隧道

如果要使用pywinauto的Putty命令行创建SSH隧道,应执行以下操作:

putty.exe -ssh uname@host.domain.com -L <server_port>:host.domain.com:<local_port>
putty.exe-sshuname@host.domain.com-L:host.domain.com:

为了添加更多细节,我还尝试创建到跳转服务器的ssh连接,并确保它不会过期。尽管paramiko脚本对我有效,但仍然无法连接到应用程序GUI:
https://127.0.0.1:
更多详细信息,我还尝试通过使用
pyautogui
自动完成原始问题中提到的步骤1-4中jumpserver登录的putty自动化,以实现相同的人工点击。该脚本工作正常,但我仍然无法从浏览器登录到应用程序URL,即使手动登录时可以访问该URL。这是否与jumpservers的行为有关?