如何将 echo y 传递给 plink.exe 以进行首次连接 [英] How to pass echo y to plink.exe for first connection

查看:25
本文介绍了如何将 echo y 传递给 plink.exe 以进行首次连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想把echo y传给plink.exe,让plink执行一个命令.如何实现?

os.system(' c:/netapp/python/plink.exe admin@192.168.1.1 -pw xxx 正常运行时间 > c:/netapp/python/12.txt')

<块引用>

服务器的主机密钥未缓存在注册表中.你不能保证服务器就是您认为的计算机.服务器的 rsa2 密钥指纹为:ssh-rsa 2048 9d:08:37:a8:d0:34:a3:d2:d8:e5:09:7e:63:08:a9:1b如果您信任此主机,请输入y"将密钥添加到

将密钥存储在缓存中?(是/否)

解决方案

不要!

验证主机密钥指纹是保护连接的一个组成部分.盲目接受任何主机密钥将使您容易受到man-in-the-middle攻击.


相反,使用 -hostkey 开关 以提供预期/已知主机密钥的指纹.

c:/netapp/python/plink.exe admin@192.168.1.1 -pw xxx -hostkey 9d:08:37:a8:d0:34:a3:d2:d8:e5:09:7e:63:08:a9:1b 你的命令在这里


不要使用诸如将 y 送入 Plink 输入之类的技巧.不仅没有安全感.但是如果没有主机密钥提示(因为主机密钥已经缓存),y 将作为你正在执行的命令的输入.什么可能导致不良结果.

I would like to pass echo y to plink.exe, so that plink execute a command. How it can be achieved?

os.system(' c:/netapp/python/plink.exe admin@192.168.1.1 -pw xxx  uptime > c:/netapp/python/12.txt')

The server's host key is not cached in the registry. You have no guarantee that the server is the computer you think it is. The server's rsa2 key fingerprint is: ssh-rsa 2048 9d:08:37:a8:d0:34:a3:d2:d8:e5:09:7e:63:08:a9:1b If you trust this host, enter "y" to add the key to

Store key in cache? (y/n)

解决方案

Do not!

Verifying host key fingerprint is an integral part of securing your connection. Blindly accepting any host key will make you vulnerable to the man-in-the-middle attacks.


Instead, use the -hostkey switch to provide the fingerprint of the expected/known host key.

c:/netapp/python/plink.exe admin@192.168.1.1 -pw xxx -hostkey 9d:08:37:a8:d0:34:a3:d2:d8:e5:09:7e:63:08:a9:1b your command here


Do not use hacks like feeding y to Plink input. Not only it is insecure. But if there is no host key prompt (because the host key is already cached), the y will end up as an input to the command you are executing. What may lead to undesired results.

这篇关于如何将 echo y 传递给 plink.exe 以进行首次连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆