Created
May 18, 2020 23:09
-
-
Save ksator/8148c2332889f51b9f9ddb77cb15aefc to your computer and use it in GitHub Desktop.
ssh arista EOS devices using paramiko
This file contains 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
''' | |
python -V | |
Python 3.7.7 | |
pip freeze | grep paramiko | |
paramiko==2.7.1 | |
''' | |
import paramiko | |
import time | |
username='arista' | |
password='arista' | |
ip = "10.83.28.124" | |
client = paramiko.SSHClient() | |
client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) | |
client.connect(ip, port=22, username=username, password=password) | |
shell_session = client.invoke_shell() | |
output = shell_session.recv(65535) | |
print(output) | |
shell_session.send("show version\n") | |
time.sleep(1) | |
output = shell_session.recv(65535) | |
print(output) | |
shell_session.close() | |
shell_session.closed | |
client.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment