Aug-07-2017, 08:12 PM
Hi All
My requirement is to simply ssh to a router using python paramiko
So I being new to python wrote this simple script but nothing happens when I run it.
But I CAN connect using this command in Ubuntu
admin1ubu@ubuntu01:~$ ssh -l user1 192.168.100.1
Password:
R1>
Here is the code that wrote
Please let me know what I am doing wrong
Thanks!

My requirement is to simply ssh to a router using python paramiko
So I being new to python wrote this simple script but nothing happens when I run it.
But I CAN connect using this command in Ubuntu
admin1ubu@ubuntu01:~$ ssh -l user1 192.168.100.1
Password:
R1>
Here is the code that wrote
#!/usr/bin/env python import paramiko import time session = paramiko.SSHClient() session.set_missing_host_key_policy(paramiko.AutoAddPolicy()) session.connect("192.168.100.1",port=22, username = "user1",password = "pass1") connection = session.invoke_shell() connection.send("terminal length 0\n") time.sleep(1) connection.send("\n") connection.send("configure terminal\n") time.sleep(1)Not even an error is given when I run this script
Please let me know what I am doing wrong
Thanks!