| 10 | import tera |
| 11 | |
| 12 | class SSH(): |
| 13 | def __init__(self): |
| 14 | self.s = paramiko.SSHClient() |
| 15 | self.s.load_system_host_keys() |
| 16 | self.s.set_missing_host_key_policy(paramiko.AutoAddPolicy()) |
| 17 | |
| 18 | def run_cmd(self, ip, cmd): |
| 19 | try: |
| 20 | self.s.connect(ip) |
| 21 | stdin, stdout, stderr = self.s.exec_command(cmd) |
| 22 | self.s.close() |
| 23 | except: |
| 24 | traceback.print_exc() |
| 25 | return stdin, stdout, stderr |
| 26 | |
| 27 | def parse_input(): |
| 28 | parser = argparse.ArgumentParser() |