Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import paramiko
- def open_ssh_conn(ip):
- try:
- #Logging into device
- session = paramiko.SSHClient()
- session.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- session.connect(ip, username = "username", password = "password")
- connection = session.invoke_shell()
- except paramiko.AuthenticationException:
- print "* Invalid username or password!"
- print "* Closing program...n"
- #Calling the SSH function
- open_ssh_conn("192.168.100.1")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement