简体   繁体   English

有没有办法使用 Paramiko 和 Python 来获取您连接的 SSH 服务器的横幅?

[英]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.

相关问题 使用 Paramiko 从 SSH 服务器获取登录前横幅而不进行身份验证 - Fetch prelogin banner from SSH server using Paramiko without authenticating 获取paramiko.ssh_exception.SSHException:读取SSH协议标题到期连接时出错(Python) - Get paramiko.ssh_exception.SSHException: Error reading SSH protocol banner due connection (Python) 与 Python Paramiko 连接到 SSH 服务器,除了密码提示外,还需要使用 Enter 键提交键盘交互式横幅 - Connect with Python Paramiko to SSH server that in addition to password prompt requires submitting an keyboard interactive banner with Enter key Python - Paramiko - 不兼容的ssh服务器 - Python - Paramiko - incompatible ssh server 当您使用 Python 的 Paramiko 库进行 SSH 并从远程机器的 CLI 获取输出时,是否有一种简单的方法可以消除垃圾值? - Is there a simple way to get rid of junk values that come when you SSH using Python's Paramiko library and fetch output from CLI of a remote machine? 如何使用Paramiko获取SSH返回码? - How can you get the SSH return code using Paramiko? 使用Python Paramiko在后台运行远程SSH服务器的过程 - Running process of remote SSH server in the background using Python Paramiko 使用python paramiko分叉ssh - forking ssh using python paramiko 使用 Python Paramiko 嵌套 SSH - Nested SSH using Python Paramiko Python-Paramiko:使用 SSH 连接到服务器,未从“ls”命令获取 output - Python-Paramiko: Connected to server with SSH, not getting output from 'ls' command
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM