def get_cam_config(target_ip, target_user, target_pass, cam_config_loc_on_pi):
config_name = cam_config_loc_on_pi.split("/")[-1]
localpath = tempfolder + config_name
try:
port = 22
ssh_tran = paramiko.Transport((target_ip, port))
print(" - connecting transport pipe... " + target_ip + " port:" + str(port))
ssh_tran.connect(username=target_user, password=target_pass)
sftp = paramiko.SFTPClient.from_transport(ssh_tran)
print("looking for " + str(cam_config_loc_on_pi))
sftp.get(cam_config_loc_on_pi, localpath)
print("--config file collected from pi--")
sftp.close()
ssh_tran.close()
except Exception as e:
print("!!! There was an issue, " + str(e))
return None
return localpath
评论列表
文章目录