Skip to content

Paramiko.ssh_exception.SSHException: Error Reading SSH Protocol Banner. #2189

@emilduerme

Description

@emilduerme

Can anyone help.?

I keep getting Error: Paramiko.ssh_exception.SSHException: Error Reading SSH Protocol Banner.
when i try to disable the SSH on cisco switch. the SSHException is not working..
cisco version: Cisco IOS Software, C2960X Software (C2960X-UNIVERSALK9-M), Version 15.2(2)E6, R
netmiko
VERSION
4.1.2
paramiko
VERSION
2.12.0

my python file script:

from netmiko import ConnectHandler
from netmiko.exceptions import NetMikoTimeoutException
from paramiko.ssh_exception import SSHException
from paramiko.ssh_exception import AuthenticationException

IP_LIST = open('15_devices.txt')
for IP in IP_LIST:
print ('\n'+ IP.strip() + ' \n' )
RTR = {
'ip': IP,
'username': 'cisco',
'password': 'cisco123',
'device_type': 'cisco_ios',
'secret': 'cisco123',
}

try:
    net_connect = ConnectHandler(**RTR)
except NetMikoTimeoutException:
    print ('Device not reachable.')
    continue
except AuthenticationException:
    print ('Authentication Failure.')
    continue
except SSHException:
    print ('Make sure SSH is enabled in device.')
    continue

output = net_connect.send_command('show ip int brief')
print(output)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions