Skip to content

Instantly share code, notes, and snippets.

@gengwg
Last active August 9, 2016 22:12
Show Gist options
  • Save gengwg/d4838000c8446ec95b1b591d72638d01 to your computer and use it in GitHub Desktop.
Save gengwg/d4838000c8446ec95b1b591d72638d01 to your computer and use it in GitHub Desktop.
Connect to Cisco ASA
```python
#!/usr/bin/env python
from netmiko import ConnectHandler
from getpass import getpass
ip_address = raw_input("Enter IP address: ")
username = raw_input("Enter username: ")
device = {
'device_type': 'cisco_asa',
'ip': ip_address,
'username': username,
'password': getpass('Enter SSH password: '),
'secret': getpass('Enter enable password: '),
'port': 22,
}
net_connect = ConnectHandler(**device)
output = net_connect.send_command_expect('show version')
print output
```
Ref:
https://github.com/ktbyers/netmiko/blob/master/netmiko/base_connection.py
https://github.com/ktbyers/netmiko/issues/157
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment