[英]Is there a way using Paramiko and Python to get the banner of the SSH server you connected to?
Is there a way using Paramiko and Python to get the banner of the SSH server you attempt to connect to?有没有办法使用 Paramiko 和 Python 来获取您尝试连接的 SSH 服务器的横幅?
I am dealing with an ultra secure server setup process for many machines and the passwords are generated via a predefined cipher key which get's printed out at with the SSH banner.我正在处理许多机器的超安全服务器设置过程,密码是通过预定义的密钥生成的,该密钥与 SSH 横幅一起打印出来。 I have access to the utility that will give me the password, but I need the text in the banner to actually generate the initial password.
我可以访问为我提供密码的实用程序,但我需要横幅中的文本才能实际生成初始密码。
Looks like this wasn't a feature.看起来这不是一个功能。 Good thing I requested it and the totally awesome developers put it in...
好在我要求它并且非常棒的开发人员将它放入......
https://github.com/paramiko/paramiko/issues/273 https://github.com/paramiko/paramiko/issues/273
# !/usr/bin/python
import paramiko
def grab_banner(ip_address, port):
client = paramiko.SSHClient()
client.load_system_host_keys()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
client.connect(ip_address, port=port, username='username', password='bad-password-on-purpose')
except:
return client._transport.get_banner()
if __name__ == '__main__':
print grab_banner('192.168.1.26', 22)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.