Last active
February 25, 2025 08:26
-
-
Save hcgatewood/b0c1969cddea1e730783bac13c9249b4 to your computer and use it in GitHub Desktop.
Log in to Palo Alto Networks GlobalProtect VPN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vpnon connects to GlobalProtect VPN. | |
# | |
# NOTE: GlobalProtect must be running. | |
# | |
# REF: https://gist.github.com/kaleksandrov/3cfee92845a403da995e7e44ba771183 | |
# | |
# Usage: vpnon | |
function vpnon { | |
osascript <<EOF | |
tell application "System Events" to tell process "GlobalProtect" | |
if not (exists window 1) then click menu bar item 1 of menu bar 2 # activate GlobalProtect menubar window | |
if (exists (first UI element of window 1 whose title is "Connect")) then | |
click (first UI element of window 1 whose title is "Connect") | |
repeat until (exists (first UI element of window 1 whose title is "Disconnect")) | |
delay 5 | |
if not (exists window 1) then click menu bar item 1 of menu bar 2 # ensure GlobalProtect menubar window is open | |
end repeat | |
end if | |
if exists window 1 then click menu bar item 1 of menu bar 2 # close GlobalProtect menubar window | |
end tell | |
EOF | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment