expect实现自动登录
来源:互联网 发布:java退格符是什么意思 编辑:程序博客网 时间:2024/06/05 15:07
apt-get install expect
#!/usr/bin/expect
set timeout 2 //设置2秒spawn scp scp.c root@192.168.1.118: //执行命令
expect "root@192.168.1.118's password:" //如果出现这个提示,那么就执行下面这个密码输入过去
send "nosoup4u\r"
set timeout 2 设置2秒
interact 不知道。
-------------------------下面这个实现了参数,system("expect.sh 192.168.1.118" ) , 成功了。哈哈-------------------------------------
#!/usr/bin/expect
set ip [lindex $argv 0]
spawn scp scp.c root@$ip:
expect "root@192.168.*'s password:"
send "nosoup4u\r"
interact
--------------------------------------------------------------
sudo cd /root/<<EOF
cwj
EOF
这也能够,只是不能够实现联机。
-------------except里面的参数传递接收--------------------
if {$argc!=5} {
send_user "Usage: $argv0 {fcip} {ftpip} {username} {password} {version}\n\n"
exit
}
set fcip [lindex $argv 0]
set ftpip [lindex $argv 1]
set username [lindex $argv 2]
set password [lindex $argv 3]
set version [lindex $argv 4]
- expect实现自动登录
- linux expect, spawn 用expect实现自动登录的脚本
- linux expect实现自动登录脚本
- Linux 通过 expect 实现 tenlnet 自动登录
- 使用expect自动登录
- 使用expect自动登录
- 自动登录expect使用
- expect脚本自动登录
- 使用expect实现自动交互,自动登录脚本
- 利用Expect实现telnet自动登录并执行command
- expect实现scp ssh自动输入密码登录
- Linux使用expect脚本实现远程机器自动登录
- shell脚本通过expect实现自动单边无密登录
- 利用expect实现SSH登录密码的自动填充
- mac使用expect实现自动登录跳板机
- Linux expect自动登录ssh
- expect实现自动登陆
- expect实现ftp自动下载
- Hook技术之4 在自己的进程中注入一个Dll到别人的进程
- Writing a very small KMDF driver
- Android 4.0 Launcher源码分析系列(二)
- windows播放函数PlaySound
- SQL普通行列转换 (纵表转横表 )
- expect实现自动登录
- MFC文本编程
- JSP中的数据库操作(2):JSP页面中的数据库查询
- as3遍历对象所有属性的方法
- 常用的一些显示日期的格式
- 数据库基础知识总结(二)--语言
- 分享5个在线看奥运会的网站
- int,string,char ,string,char*类型转换
- IFormattable,IFormatProvider,ICustomFormatter---C#自定义格式字符串