传递命令给KiTTY界面

huangapple go评论76阅读模式
英文:

Pass command to KiTTY UI

问题

I wish to automate the below task

  1. Launch KiTTY
  2. Enter username and password
  3. Login successfully
  4. Enter this below command to see the logs

tail -2000f /apps/test/good.log

I am able to achieve up to point 3 using below code

from subprocess import Popen
Popen("powershell kitty-0.73.1.1.exe sakthi@x.y.w.z -pw YYYY")

(new KiTTY windows is opened and user is logged in successfully)

But I don't know how to pass the below command

tail -2000f /apps/test/good.log

Note:
I am using Python3

I WANT THIS AUTOMATION AT UI LEVEL. I have around 5 to 6 log files to go through while testing. I don't want to open all the logs manually. So I am looking for a way to automate it.

I am using KiTTY, because it can re-connect automatically when there is any network problem.

英文:

I wish to automate the below task

  1. Launch KiTTY
  2. Enter username and password
  3. Login successfully
  4. Enter this below command to see the logs
tail -2000f /apps/test/good.log

I am able to achieve up to point 3 using below code

from subprocess import Popen
Popen("powershell kitty-0.73.1.1.exe sakthi@x.y.w.z -pw YYYY")

(new KiTTY windows is opened and user is logged in successfully)

But I don't know how to pass the below command

tail -2000f /apps/test/good.log

Note:
I am using Python3

I WANT THIS AUTOMATION AT UI LEVEL. I have around 5 to 6 log files to go through while testing. I don't want to open all the logs manually. So I am looking for a way to automate it.

I am using KiTTY, because it can re-connect automatically when there is any network problem.

答案1

得分: 2

KiTTY,以及PuTTY,都有-m命令行开关,用于提供SSH“exec”通道的命令。
这在:https://stackoverflow.com/q/39361444/850848 中有讨论。

KiTTY另外还有-cmd命令行开关,与-m相反,它模拟SSH“shell”通道上的按键输入。这相当于KiTTY的“自动命令”功能。
还请参阅 https://stackoverflow.com/q/22536723/850848

虽然如果你想自动化测试,最好使用本地的Python SSH模块,比如Paramiko

英文:

KiTTY, as well as PuTTY, has -m command-line switch to provide a command for SSH "exec" channel.
This is discussed in: https://stackoverflow.com/q/39361444/850848

KiTTY additionally has -cmd command-line switch, which (contrary to -m) simulates key strokes on SSH "shell" channel. It is an equivalent of KiTTY "Automatic Command" feature.
See also https://stackoverflow.com/q/22536723/850848


Though if you want to automate testing, you better use a native Python SSH module, like Paramiko.

huangapple
  • 本文由 发表于 2020年1月6日 15:42:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/59608345.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定