Skip to content

Instantly share code, notes, and snippets.

@korylprince
korylprince / check-agent.sh
Created August 24, 2023 18:50
Check macOS Lightspeed Filter Agent
#!/bin/zsh
# Checks if Lightspeed Filter Agent processes are running, binaries are installed, and Network Extension is running
# If a component is not installed or not running, returns "Error: <error reason>"
# Otherwise returns mobilefilter version
# check for installed binaries
if ! test -f /Applications/.lightspeed-agent/lsproxy; then
printf "<result>Error: lsproxy binary not found</result>"
exit 1
@korylprince
korylprince / micromdm_webhook.py
Created August 22, 2023 14:38
MicroMDM Webhook
from flask import Flask, request, abort
import base64
import plistlib
import json
app = Flask(__name__)
def clean_json(obj):
if isinstance(obj, dict):
new = dict()
@korylprince
korylprince / get_user.go
Created May 31, 2023 18:22
Get console user on macOS using SCDynamicStoreCopyConsoleUser
package main
import (
"fmt"
"os/user"
"strconv"
)
//#cgo LDFLAGS: -framework SystemConfiguration
/*
@korylprince
korylprince / inspect.go
Created February 21, 2023 23:53
Inspect MicroMDM Device Command Queue
package main
import (
"fmt"
"os"
"github.com/boltdb/bolt"
"github.com/micromdm/micromdm/platform/queue"
)
@korylprince
korylprince / Caddyfile
Created November 3, 2022 03:17
Open Source Cybersecurity Example
vaultwarden.{$DOMAIN}:443 {
tls {$EMAIL}
reverse_proxy vaultwarden:80 {
header_up X-Real-IP {remote_host}
}
reverse_proxy /notifications/hub vaultwarden:3012
}
@korylprince
korylprince / generate.go
Created May 16, 2022 15:10
Lightspeed Smart Agent localhost certificate generation
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/sha512"
"crypto/x509"
"crypto/x509/pkix"
"encoding/pem"
"errors"
# usage: python3 verify.py /path/to/request
import base64, plistlib, tempfile, os, subprocess, re, sys
request = sys.argv[1]
# open request
with open(request) as f:
plist = plistlib.loads(base64.b64decode(f.read()))
# write separate chain certificates
@korylprince
korylprince / cleanup.py
Last active December 9, 2020 17:40
macOS Cleanup Script
#!/usr/bin/python
import os
import shutil
system_folders = [
"/Applications/AVer+.app",
"/Applications/AVerVision 2.app",
"/Applications/Algodoo.app",
"/Applications/GIMP.app",
"/Applications/GarageBand.app",
See screenshot here: https://imgur.com/a/zEvyKxx
Dear Administrator,
We’re writing to let you know that due to low usage, the App Maker product will be shut down on January 19, 2021. Google Cloud will continue to invest in providing customers with best-in-class solutions in the low-code/no-code space. While we regret the inconvenience this may cause, we’re committed to helping your organization navigate this change.
What do I need to do?
Review the list of apps for [REDACTED] in the attached CSV file. The list includes application name, creator name, last modified date, and a link to your Admin console with application-specific usage stats and project information.
App creators in your organization will need to review their use cases in the “replacement product” section and take action by the dates listed in the schedule below.
@korylprince
korylprince / caddy.bin
Created October 1, 2019 15:52
caddy_diagnostics
#!/bin/sh
find /share/caddy