python 自动远程登陆 python 实现自动远程登陆scp文件实例代码
张伟灿 人气:0想了解python 实现自动远程登陆scp文件实例代码的相关内容吗,张伟灿在本文为您仔细讲解python 自动远程登陆的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:python,实现自动远程登陆scp文件,python,远程登陆,python,远程登陆scp文件,下面大家一起来学习吧。
python 实现自动远程登陆scp文件实例代码
实现实例代码:
#!/usr/bin/expect if {$argc!=3} { send_user "Usage: $argv0 {path1} {path2} {Password}\n\n" exit } set path1 [lindex $argv 0] set path2 [lindex $argv 1] set Password [lindex $argv 2] spawn scp ${path1} ${path2} expect { "Password:" { exec sleep 1 send "${Password}\r" } "*continue connecting*" { exec sleep 1 send "yes\r" expect "*Password:" { exec sleep 1 send "${Password}\r" } } } expect "*" send "exit\r" expect "*closed*" #send "exit\r" #expect "*" #exit #exec sleep 10
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
加载全部内容