Skip to content

Instantly share code, notes, and snippets.

@ihebski
Created March 19, 2022 19:29
Show Gist options
  • Select an option

  • Save ihebski/579e16f70d0ad48684d060aa79c68b66 to your computer and use it in GitHub Desktop.

Select an option

Save ihebski/579e16f70d0ad48684d060aa79c68b66 to your computer and use it in GitHub Desktop.

Revisions

  1. ihebski created this gist Mar 19, 2022.
    22 changes: 22 additions & 0 deletions vpn.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    #!/usr/bin/expect -f

    # Constants
    set user ""
    set pass ""
    set timeout -1

    # Options
    match_max 100000
    log_user 0

    # Access to device
    spawn sudo openvpn vpn_file.ovpn

    expect "*?sername:*"
    send -- "$user\r"

    expect "*?assword:*"
    send -- "$pass\r"

    interact
    close