I hereby claim:
- I am tmanternach on github.
- I am trvr (https://keybase.io/trvr) on keybase.
- I have a public key whose fingerprint is 2455 488A B35E D481 8F3D 4636 A139 3538 368C F30A
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
(* | |
Toggle GlobalProtect VPN with AppleScript | |
Tested using macOS Sequoia 15.1.1 and GlobalProtect version 6.2.3-270 | |
Written by Trevor Manternach, August 2023. | |
*) | |
tell application "System Events" to tell process "GlobalProtect" | |
click menu bar item 1 of menu bar 2 | |
set statusText to name of static text 1 of window 1 | |
if statusText is "Not Connected" then |
tell application "Dock" | |
activate | |
end tell | |
tell application "System Events" | |
tell process "Dock" | |
set frontmost to true | |
activate | |
tell list 1 | |
perform action "AXShowMenu" of UI element "Jump Desktop" | |
delay 0.2 |
<html> | |
<head> | |
<title>[%pagetitle%]</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
[%rssLink%] | |
[%facebookmetadata%] | |
[%twittermetadata%] |
# This server {} block is used to re-direct port 80/http traffic to port 443/https. Pretty common 301 re-direct. | |
server { | |
if ($host = static.trevormanternach.com) { | |
return 301 https://$host$request_uri; | |
} # managed by Certbot | |
listen 80; | |
server_name static.trevormanternach.com; | |
return 404; # managed by Certbot | |
} |
""" | |
This script retrieves DHCP leases information from a Palo Alto Networks firewall using its API. | |
It sends a request to the specified host with an API key to fetch DHCP lease information for a given network interface. The retrieved data is then parsed and printed in JSON format. | |
Usage: | |
- Make sure to set the necessary environment variables for 'HOST', 'KEY', and 'INTERFACE' using a .env file. | |
- Ensure the required libraries are installed, including 'os', 'requests', 'json', 'xmltodict', 'urllib3', and 'dotenv'. | |
Example: |