用telnet连接成功了,连接的是一台我的steam游戏服务器,游戏服务里面有许多指令,比如"say hello"就说"hello",会话模式下输入"say hello"一切正常,我嫌会话模式信息刷新太快了,进入了命令模式,命令模式下输入"send say hello",说我发送了"say hello",但是指令并没有生效,试了一两个小时,发现输入"send say hello"后,紧接着进入会话模式,按下回车,指令就生效了,好像是服务器的指令没有得到确认。但是命令模式下无论是"send say hello\n","send say hello\r","send say hello\n\r","send say hello\r\n"都试过了,都没有效果,什么ao、esc、brk、synch都试过了,都无效,网上攻略查了几个小时,都没有相关说明,请求前辈帮助。
1条回答 默认 最新
战在春秋 2017-02-19 21:12关注脚本范例:
spawn telnet <machine ip> expect "login:" send "<username>\n" expect "Password:" send "<password>\n" send "bash\n" send "cd /opt\n" send "ls -ltr\n" ? (if you are not giving \n then it will wait for your response or you have to type enter manually). interact解决 无用评论 打赏 举报