import paramiko def fw_exec(self, command): def fw_exec(self, command): FW_USER = ‘‘ FW_PASSWD = ‘‘ FW_HOST = ‘‘ paramiko.util.log_to_file(‘paramiko_log.txt‘) ssh=paramiko.SSHClient() ssh.load_system_host_keys() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(FW_HOST,port=22,username=FW_USER,password=FW_PASSWD,compress=True) stdin, stdout, stderr = ssh.exec_command(command) logtxt = stdout.read() print logtxt ssh.close()gtxt ssh.close()
时间: 2024-10-18 01:15:14