#!/bin/bash
target="192.168.1.100"
password="123456"
/bin/expect -c "
set timeout 30
spawn ssh $target
expect {
\"*yes/no*\" { send \"yes\r\"; exp_continue }
\"*password*\" { send \"$password\r\" }
}
expect {
\"*password*\" { exit 1 }
}
"
if [ $? -eq 1 ]; then
echo
echo "ERROR PASSWORD"
fi
expect ssh登陆,发现密码错误后关闭连接
最新推荐文章于 2021-10-12 10:33:10 发布
3102

被折叠的 条评论
为什么被折叠?



