Skip to content

Instantly share code, notes, and snippets.

@dims
Created June 2, 2014 12:03
Show Gist options
  • Save dims/59be0c075f29e7ec26a8 to your computer and use it in GitHub Desktop.
Save dims/59be0c075f29e7ec26a8 to your computer and use it in GitHub Desktop.
Expect script for logging into VPN using Anyconnect client (works on osx and linux)
#!/usr/bin/expect
set timeout 20
spawn "/opt/cisco/anyconnect/bin/vpn"
expect "VPN>" { send "connect server.ip.address.or.hostname\r" }
expect "*sername*" { send "MY_USERID\r" }
expect "*assword*" { send "MY_PASSWORD\r" }
expect "state: Connected" { send "exit\r" }
interact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment