自动输入用户名密码脚本

manjaro 连接vpn

需要安装 expect 

#!/usr/bin/expect 
vpn_host='' group
='' user_name='' password='' spawn sudo openconnect --csd-wrapper=/usr/lib/openconnect/csd-post.sh ${vpn_host} expect { "*GROUP:*" { set timeout 300 send "${group}\r" exp_continue } "*Username:*" { set timeout 300 send "${user_name}\r" exp_continue } "*Password:*" { set timeout 300 send "${password}\r" exp_continue } timeout { puts "connect is timeout" exit 3 } }

 

posted @ 2021-01-05 23:29  繁忙的蜜蜂  阅读(1062)  评论(0编辑  收藏  举报