Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cisco-nexus(config)# username edwin password THISisWHERIAMtypingPWD<0x08>NG
- % Invalid command at '^' marker.
- cisco-nexus(config)#
- username edwin password THISisWHERIAMtypingPWDNG
- import paramiko
- import time
- import re
- class ssh:
- def __init__(self, ip, user, pwd):
- self.ip = ip
- self.user = user
- self.pwd = pwd
- def device_conn(self):
- remote_con = paramiko.SSHClient()
- remote_con.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- remote_con.connect(hostname=self.ip, username=self.user, password=self.pwd, look_for_keys=False, allow_agent=False)
- remote_ses = remote_con.invoke_shell()
- output = remote_ses.recv(1000)
- time.sleep(1)
- remote_ses.send("conf t"+"n")
- time.sleep(0.5)
- remote_ses.send("username edwin password THISisWHERIAMtypingPWDNG"+"n")
- time.sleep(0.5)
- output = remote_ses.recv(10000)
- print output
- with open("device.txt","rb") as dev:
- for fw in dev:
- print fw.strip()
- ob = ssh(fw.strip(), "user", "pwd")
- output = ob.device_conn()
Add Comment
Please, Sign In to add comment