Created
September 8, 2020 06:37
-
-
Save ddutt/588858e15b98897ab8987b68fe5e1029 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async def async_ssh(host, port=22, user='vagrant', password='vagrant'): | |
conn = await asyncssh.connect(host, port=port, | |
username=user, password=password, | |
client_keys=None, known_hosts=None) | |
output = await conn.run(command) | |
# print(f'{host}, {output.stdout.strip()}, {output.exit_status}') | |
conn.close() | |
def netmiko_ssh(host, port=22, user='vagrant', password='vagrant'): | |
dev_connect = { | |
'device_type': 'autodetect', | |
'host': host, | |
'port': port, | |
'username': user, | |
'password': password | |
} | |
net_connect = ConnectHandler(**dev_connect) | |
output = net_connect.send_command(command, use_textfsm=False) | |
net_connect.disconnect() | |
# print(output) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment