Hi All,
When connecting to a Cisco device using Netmiko, it uses en to enter privilege mode and then supplies the secret value from the dictionary. I have a Cisco_ASA that uses "login" instead of "en" therefore when I try connect with secret in my dictionary it fails (I checked the debug file) - how can I change the secret command from en to login instead?
I've read the following documentation - https://media.readthedocs.org/pdf/netmiko/stable/netmiko.pdf but I'm still not sure.
ip = raw_input('Device IP: ')
un = raw_input('Username: ')
pw = getpass.getpass()
cisco_asa = {
'device_type': 'cisco_asa',
'ip': ip,
'username': un,
'password': pw,
'secret': pw, # If commented out, doesn't enter priv mode but logs in
'verbose': False,
}
try:
net_connect = ConnectHandler(**cisco_asa)
prompt = net_connect.find_prompt()
net_connect.disconnect()
print(prompt)
except ##
Looking at the code, it appears Netmiko expects you to log in using a Level 15 account. If you provide a secret, this method gets executed which is where the enable is coming from.
Have you tried logging in with a level 15 accound and no secret?
Thanks @OzNetNerd, the conf URL provided assisted me.
I think I've managed to solve my issue due to your assistance.
@JoshuaSmeda Adding onto this, if you leave your enable secret as blank (null string) or completely unset (i.e. don't pass it to ConnectHandler), then Netmiko will automatically try to do login for the Cisco ASA (using the username/password you provided).