Skip to content

Instantly share code, notes, and snippets.

View jessepeterson's full-sized avatar

Jesse Peterson jessepeterson

View GitHub Profile
@jessepeterson
jessepeterson / micromdm-save-apple-signer.diff
Created April 29, 2024 22:35
micromdm save apple signer
diff --git a/mdm/enroll/transport_http.go b/mdm/enroll/transport_http.go
index 043a3e6..78a6fee 100644
--- a/mdm/enroll/transport_http.go
+++ b/mdm/enroll/transport_http.go
@@ -3,8 +3,10 @@ package enroll
import (
"context"
"errors"
+ "fmt"
"io/ioutil"
@jessepeterson
jessepeterson / app_map.c
Last active October 23, 2023 07:32
_CFPreferencesCopyApplicationMap example
/* re-implementation of the behaviour that the /usr/bin/defaults application
* uses to read sandboxed preference data */
#include <CoreFoundation/CoreFoundation.h>
#define EX_BUNDLE_ID "com.apple.mail"
#define EX_KEY "JunkMailBehavior"
// undocumented, internal CFPreferences API call
extern CFDictionaryRef _CFPreferencesCopyApplicationMap(CFStringRef userName, CFStringRef hostName);
<?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>PayloadContent</key>
<array>
<dict>
<key>PayloadDisplayName</key>
<string>Dock</string>
<key>PayloadIdentifier</key>
@jessepeterson
jessepeterson / .gitignore
Last active April 5, 2023 14:29
Toy Declarative Management Flask server
/*.status.json
@jessepeterson
jessepeterson / mk_pkg_manifest.py
Created April 13, 2016 15:55
Create an Apple software distribution manifest for an Apple pkg installer (see http://help.apple.com/deployment/osx/#/ior5df10f73a)
#!/usr/bin/python
# create a "wireless manifest" for Apple pkg installers. for details
# on the manifest see: http://help.apple.com/deployment/osx/#/ior5df10f73a
import subprocess
from tempfile import mkdtemp
import os
from xml.dom.minidom import parse, parseString
from hashlib import md5
@jessepeterson
jessepeterson / main.go
Created October 19, 2022 20:45
Invalid XML for plist ... successful?
package main
import (
"fmt"
"log"
"github.com/groob/plist"
)
const cmdPlist = `C "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@jessepeterson
jessepeterson / esxiupload.sh
Created December 22, 2015 20:29
ESXi datastore upload helper (uses curl)
#!/bin/sh
if [ $# -lt 5 ]; then
echo "$0 <host> <user> <datastore> <folder> <filepath>"
echo
echo " examples:"
echo " $0 10.0.0.1 root datastore1 ISOs /tmp/Linux.iso"
exit 1
fi
@jessepeterson
jessepeterson / remove_ilife_dvd.sh
Created May 23, 2013 03:10
Remove iLife '11 (DVD installer)
#!/bin/sh
# Remove *all* components of iLife '11 as installed by the "DVD" installer
rm -rf \
"/Applications/iWeb.app" \
"/Library/Audio/Apple Loops/Apple/iLife Sound Effects" \
"/Applications/GarageBand.app" \
"/Library/Audio/Apple Loops/Apple/Apple Loops for GarageBand" \
"/Applications/iDVD.app" \
@jessepeterson
jessepeterson / cmd-dumper.go
Created January 9, 2020 22:35
Dump a UDID's various command state in a MicroMDM database
package main
import (
"flag"
"fmt"
"log"
"os"
"github.com/boltdb/bolt"
"github.com/micromdm/micromdm/platform/pubsub/inmem"
@jessepeterson
jessepeterson / reponotify.py
Last active August 5, 2019 16:40
reposado update notification: reports changed Apple products between repo_sync runs
#!/usr/bin/python
'''
reposado update notification: reports changed Apple products between repo_sync runs
Checks the current list of updates versus the previous list of updates and
reports on the changes. Run this script after your repo_sync run to see the
changes between syncs. You can then hand this report off in email if you wish.
For example: