Skip to content

Instantly share code, notes, and snippets.

View bruienne's full-sized avatar

Pepijn Bruienne bruienne

View GitHub Profile
@bruienne
bruienne / org.my.logoutwatcher.plist
Last active November 3, 2023 23:04
logout watcher LA
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.my.logoutwatcher</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/myorg/logoutwatcher.sh</string>
</array>
@bruienne
bruienne / gist:ec5205408b9e52bd5cfc
Last active September 12, 2023 21:42
Linux DMG/PKG notes
@bruienne
bruienne / logoutwatcher.sh
Last active July 26, 2023 21:58
logout watcher
onLogout() {
# Insert whatever script you need to run at logout
exit
}
echo "INFO - Watching ${HOME}" >> /var/log/org.my.log
trap 'onLogout' SIGINT SIGHUP SIGTERM
while true; do
@bruienne
bruienne / osx_parse_incompatible_apps.py
Last active September 30, 2022 13:09
Downloads and parses MigrationIncompatibleApplicationsList.plist for OS X versions 10.7-10.11
#!/usr/bin/python
# pylint: disable=fixme, line-too-long, missing-docstring, C0103
# Many parts of this were taken from Greg Neagle's COSXIP (https://github.com/munki/createOSXinstallPkg)
# No parsing of 'BannedRegexMatchVersion' keys currently because regex is hard.
#
# Output prints a list of incompatible apps for each major OS X version
# with its version and optional file listing of the target app.
import plistlib
@bruienne
bruienne / find32bit.py
Created January 25, 2018 17:08
Find 32-bit executables in a given path. Uses the macholib module that ships with macOS.
#!/usr/bin/python
from macholib import MachO
import macholib
import os
import sys
path = sys.argv[1]
for root, dirs, files in os.walk(path):
@bruienne
bruienne / pbzx.c
Last active August 7, 2022 19:50
PBZX handling of Yosemite-style Payload archives
//
// main.c
// pbzx
//
// Created by PHPdev32 on 6/20/14.
// Licensed under GPLv3, full text at http://www.gnu.org/licenses/gpl-3.0.txt
//
#include <stdint.h>
#include <stdio.h>
@bruienne
bruienne / google_chrome_update_checker.py
Created September 27, 2016 19:24
Basic concept for querying for Google Chrome updates based on current Chrome version/OS/arch
#!/usr/bin/python
import xml.etree.ElementTree as ET
import requests
import uuid
params = {'cup2hreq': 'foo', 'cup2key': 'bar'}
platform = 'mac'
os_version = '10.12'
@bruienne
bruienne / myorg.pf.plist
Created April 4, 2016 18:35
Sample LD to load a custom ruleset without modifying Apple's standard PF config
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE plist PUBLIC "-//Apple Computer/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>myorg.pf.plist</string>
<key>Program</key>
<string>/usr/local/bin/pfstart.sh</string>
<key>ProgramArguments</key>
<array>
@bruienne
bruienne / pfstart.sh
Created April 4, 2016 18:40
Sample script to chainload a custom ruleset into PF, avoids editing Apple's standard config
#!/bin/bash -x
# Wait for networking to be up, just in case
/usr/sbin/ipconfig waitall
# Loop on the presence of the standard Apple ruleset before proceeding
# This way we don't accidentally get overruled (SWIDT) if com.apple.pfctl
# happens to be loaded after myorg.pf.
count=0
while [[ $(pfctl -sr 2>&1 | egrep "apple" | wc -l) -eq 0 && $count -lt 12 ]]; do
@bruienne
bruienne / getosversionfromdmg.py
Last active April 16, 2021 05:29
Get OS X version from DMG
#!/usr/bin/python
#
# getosversionfromdmg.py
#
# Copyright (c) 2014 The Regents of the University of Michigan
#
# Retrieves the OS version and build from the InstallESD.dmg contained in
# a typical "Install (Mac) OS X <Name>.app" bundle.
#
# To run: