Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import paramiko
- from paramiko_expect import SSHClientInteraction
- class Connection:
- def __init__(self):
- self.client = paramiko.SSHClient()
- self.client.load_system_host_keys()
- self.client.set_missing_host_key_policy(paramiko.AutoAddPolicy)
- self.client.connect(hostname='192.168.1.24', username='ozcan', password='ozcan')
- self.interact = SSHClientInteraction(self.client, timeout=10, display=True,
- tty_width=100, tty_height=100)
- self.abc = self.interact
- @staticmethod
- def get_interact(instance):
- return instance.interact
- qwe = Connection.get_interact(Connection())
- qwe.expect(r'.*\$\s+')
- qwe.send('ls')
- qwe.expect(r'.*\$\s+')
- qwe.take_control()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement