Open romio28 opened 6 months ago
@romio28 Can you turn on Netmiko logging and see what it shows?
Bellow the debug log:
`DEBUG:paramiko.transport:starting thread (client mode): 0xf0a55ee0
DEBUG:paramiko.transport:Local version/idstring: SSH-2.0-paramiko_3.4.0
DEBUG:paramiko.transport:Remote version/idstring: SSH-2.0-OpenSSH_5.3
INFO:paramiko.transport:Connected (version 2.0, client OpenSSH_5.3)
DEBUG:paramiko.transport:=== Key exchange possibilities ===
DEBUG:paramiko.transport:kex algos: diffie-hellman-group-exchange-sha256, diffie-hellman-group14-sha1
DEBUG:paramiko.transport:server key: ssh-rsa
DEBUG:paramiko.transport:client encrypt: aes128-ctr, aes192-ctr, aes256-ctr
DEBUG:paramiko.transport:server encrypt: aes128-ctr, aes192-ctr, aes256-ctr
DEBUG:paramiko.transport:client mac: hmac-sha1, hmac-sha2-512, hmac-sha2-256
DEBUG:paramiko.transport:server mac: hmac-sha1, hmac-sha2-512, hmac-sha2-256
DEBUG:paramiko.transport:client compress: none, zlib@openssh.com
DEBUG:paramiko.transport:server compress: none, zlib@openssh.com
DEBUG:paramiko.transport:client lang:
System is ready now.
[type ? for help]
A10_DEVICE_NAME-Active-affinity-def-vMaster[1/1]>
DEBUG:netmiko:read_channel:
DEBUG:netmiko:read_channel:
DEBUG:netmiko:write_channel: b'show version\n'
DEBUG:netmiko:read_channel: show version
Thunder Series Unified Application Service Gateway TH4440S
Copyright 2007-2018 by A10 Networks, Inc. All A10 Networks products are
protected by one or more of the following US patents:
.......
64-bit Advanced Core OS (ACOS) version 4.1.1-P8, build 114 (Apr-10-2018,22:39)
Booted from Hard Disk primary image
Serial Number:
Firmware version: 12.4
aFleX version: 2.0.0
aXAPI version: 3.0
Hard Disk primary image (default) version 4.1.1-P8, build 114
Hard Disk secondary image version 4.1.1-P8, build 114
Compact Flash primary image (default) version 4.1.1-P8, build 114
Last configuration saved at May-2-2024, 17:09
Hardware: 12 CPUs(Stepping 2), Single 93G Hard disk
Memory 31846 Mbyte, Free Memory 11621 Mbyte
Hardware Manufacturing Code:
Current time is May-6-2024, 21:49
The system has been up 1251 days, 1 hour, 0 minute
A10_DEVICE_NAME-Active-affinity-def-vMaster[1/1]>
DEBUG:netmiko:read_channel:
DEBUG:netmiko:read_channel:
DEBUG:paramiko.transport:EOF in transport thread
DEBUG:paramiko.transport:starting thread (client mode): 0xf0a5cf70
DEBUG:paramiko.transport:Local version/idstring: SSH-2.0-paramiko_3.4.0
DEBUG:paramiko.transport:Remote version/idstring: SSH-2.0-OpenSSH_5.3
INFO:paramiko.transport:Connected (version 2.0, client OpenSSH_5.3)
DEBUG:paramiko.transport:=== Key exchange possibilities ===
DEBUG:paramiko.transport:kex algos: diffie-hellman-group-exchange-sha256, diffie-hellman-group14-sha1
DEBUG:paramiko.transport:server key: ssh-rsa
DEBUG:paramiko.transport:client encrypt: aes128-ctr, aes192-ctr, aes256-ctr
DEBUG:paramiko.transport:server encrypt: aes128-ctr, aes192-ctr, aes256-ctr
DEBUG:paramiko.transport:client mac: hmac-sha1, hmac-sha2-512, hmac-sha2-256
DEBUG:paramiko.transport:server mac: hmac-sha1, hmac-sha2-512, hmac-sha2-256
DEBUG:paramiko.transport:client compress: none, zlib@openssh.com
DEBUG:paramiko.transport:server compress: none, zlib@openssh.com
DEBUG:paramiko.transport:client lang:
DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: ..... DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: System is ready now.
DEBUG:netmiko:read_channel: [type ? for help]
A10_DEVICE_NAME-Active-affinity-def-vMaster[1/1]> DEBUG:netmiko:Pattern found: ([>#]) Last login: Mon May 6 21:49:49 2024 from 172.17.248.8
System is ready now.
[type ? for help]
A10_DEVICE_NAME-Active-affinity-def-vMaster[1/1]> DEBUG:netmiko:read_channel: DEBUG:netmiko:write_channel: b'\n' DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: A10_DEVICE_NAME-Active-affinity-def-vMaster[1/1]> DEBUG:netmiko: Parenthesis found in pattern.
pattern: (#|>)
This can be problemtic when used in read_until_pattern().
You should ensure that you use either non-capture groups i.e. '(?:' or that the parenthesis completely wrap the pattern '(pattern)' DEBUG:netmiko:Pattern found: (#|>) A10_DEVICE_NAME-Active-affinity-def-vMaster[1/1]> DEBUG:netmiko:read_channel: DEBUG:netmiko:[find_prompt()]: prompt is A10_DEVICE_NAME-Active-affinity-def-vMaster[1/1]> DEBUG:netmiko:write_channel: b'\n' DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: A10_DEVICE_NAME-Active-affinity-def-vMaster[1/1]> DEBUG:netmiko:Pattern found: (A10_DEVICE_NAME-Active-affinity-def-vMaster[1/1].*) A10_DEVICE_NAME-Active-affinity-def-vMaster[1/1]> DEBUG:netmiko:write_channel: b'enable\n' DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: enable Password: DEBUG:netmiko:Pattern found: (enable) enable DEBUG:netmiko:read_channel: DEBUG:netmiko:Pattern found: ((?:A10_DEVICE_NAME-Active-affinity-def-vMaster[1/1]|ssword)) Password DEBUG:netmiko:write_channel: b'\n' DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel:
DEBUG:netmiko:read_channel: Enter Old Password: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: .... DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:write_channel: b'\n' DEBUG:netmiko:read_channel: % Access denied
A10_DEVICE_NAME-Active-affinity-def-vMaster[1/1]> DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:write_channel: b'exit\n' DEBUG:paramiko.transport:EOF in transport thread `
@romio28 Can you show your entire code and your entire exception stack trace (i.e. all the lines of the exception stack trace).
debug file: test.log
Code:
`from netmiko import SSHDetect, ConnectHandler import logging logging.basicConfig(filename='test.log', level=logging.DEBUG) logger = logging.getLogger("netmiko")
device = { "device_type": "autodetect", "host": "192.168.100.87", "username": "admin", "password": "admin123", }
guesser = SSHDetect(**device) best_match = guesser.autodetect() print(best_match) # Name of the best device_type to use further print(guesser.potential_matches) # Dictionary of the whole matching result device["device_type"] = best_match
with ConnectHandler(**device) as connection: print(connection.find_prompt())`
The problem is in the find_prmpt() function, it trying to go in enable mode, it work if I add the secret password:
"C:\Users\PycharmProjects\backup\venv\Scripts\python.exe" "C:/Users//PycharmProjects/backup/test.py"
a10
{'a10': 99}
Traceback (most recent call last):
File "C:\Users\PycharmProjects\backup\test.py", line 20, in
Pattern not detected: 'A10_DEVICE_NAME\-Active\-affinity\-def\-vMaster\[1/1\]' in output.
Things you might try to fix this:
Increase the read_timeout to a larger value.
You can also look at the Netmiko session_log or debug log for more information.
Process finished with exit code 1
The A10 driver requires enable password (as A10 requires enable mode to disable output paging and Netmiko requires this).
https://github.com/ktbyers/netmiko/blob/develop/netmiko/a10/a10_ssh.py#L9-L12
Hello, I'm trying to add the ssh auto detect for A10 device:
Command output:
A10DEVICE-Active-affinity-def-vMaster[1/1]>show version Thunder Series Unified Application Service Gateway TH3030S Copyright 2007-2017 by A10 Networks, Inc. All A10 Networks products are
protected by one or more of the following US patents:
.... 64-bit Advanced Core OS (ACOS) version 4.1.1-P5, build 20 (Sep-12-2017,18:18) Booted from Hard Disk primary image Serial Number: ......................... aFleX version: 2.0.0 aXAPI version: 3.0 Hard Disk primary image (default) version 4.1.1-P5, build 20 Hard Disk secondary image version 4.1.1-P5, build 20 Last configuration saved at May-2-2024, 17:05 Hardware: 8 CPUs(Stepping 9), Single 74G Hard disk Memory 16373 Mbyte, Free Memory 7376 Mbyte Hardware Manufacturing Code: ................. Current time is May-6-2024, 14:26 The system has been up 39 days, 14 hours, 35 minutes A10DEVICE-Active-affinity-def-vMaster[1/1]>
But i recive this error:
192.168.25.15 An exception occurred:
Pattern not detected: 'A10DEVICE\-Active\-affinity\-def\-vMaster\[1/1\]' in output.
Things you might try to fix this:
You can also look at the Netmiko session_log or debug log for more information.
Any help please?