一个伪linux粉丝的blog

  1. 首页
  2. network
  3. 正文

anyconnect

28 1 月, 2021 2027点热度 2人点赞 0条评论

anyconnect vpn 一键登录保存密码的方法,Mac 、Windows、Android

Mac 下 安装 原版 anconnect ,然后使用如下脚本即可,断线自动重连。


#!/bin/bash
# connect some vpn without password
USERNAME= # your username
PASSWORD= # your password
VPN_URL="your vpn and port"
VPN_BIN="/opt/cisco/anyconnect/bin/vpn"
ANYCONNECT_PATH="/Applications/Cisco/Cisco AnyConnect Secure Mobility Client.app"
get_anyclient_ui_pid() {
local pid=$(ps -ef | grep "$ANYCONNECT_PATH" | grep -v 'grep' | awk '{print $2}')
echo $pid
if [[ -z "$pid" ]]; then
return 1
else
return 0
fi
}
kill_anyconnect_ui() {
$VPN_BIN disconnect
local pid=$(get_anyclient_ui_pid)
# echo "PID: $pid"
if [[ -n "$pid" ]]; then
kill -9 $pid
fi
}
open_client_ui() {
if ! get_anyclient_ui_pid &> /dev/zero; then
open "$ANYCONNECT_PATH"
fi
}
connect() {
# sudo /opt/cisco/anyconnect/bin/vpnagentd
kill_anyconnect_ui
$VPN_BIN -s << EOF
connect $VPN_URL
1
$USERNAME
$PASSWORD
EOF
open_client_ui
}
main() {
if [[ -z "$USERNAME" || -z "$PASSWORD" || -z "$VPN_URL" ]]; then
echo "Error: empty user info"
exit 1
fi
case "$1" in
stop|s )
$VPN_BIN disconnect
;;
* )
connect
esac
}
main "$*"

Windows 下 使用 openconnect-gui 这个软件即可保存密码,界面简洁。


Android 下 OpenConnect 这个app即可,不要使用思科原版 AnyConnect.

相关文章:

  1. Android rom for HTC Vogue6900
  2. Cisco: Internet to change forever
  3. putty(plink)内网一键翻墙
  4. IE-Plink-Polipo Through the Great Firewall
标签: anyconnect
最后更新:27 1 月, 2021

wanjie

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

This site uses Akismet to reduce spam. Learn how your comment data is processed.

归档
分类
  • network / 332篇
  • Uncategorized / 116篇
  • unix/linux / 122篇
  • 业界资讯 / 38篇
  • 公司杂事 / 11篇
  • 数码影像 / 12篇
  • 美剧 / 3篇
  • 美图共赏 / 21篇
  • 英语学习 / 3篇
标签聚合
Google Voice 泰国 刷机 gitlab 网站运营 虚拟主机 dreamhost unveiled today kernel d90 Google webhook brew docker VPS dreamhost空间 天翼live 邮件归档 squid iMac Linux k8s Ubuntu Nginx ldap postgres 职责 网通 nexus deepseek

COPYRIGHT © 2008-2025 wanjie.info. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang