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"
<?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 / 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 / .gitignore
Last active April 5, 2023 14:29
Toy Declarative Management Flask server
/*.status.json
@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 / gist:4053def24038a72d72cbfabc3120fc8c
Created January 24, 2017 19:22
changed dmgmounter.py behavior
import os
class DmgMounter(object):
"""Base class for Processors that need to mount disk images."""
DMG_EXTENSIONS = ['.dmg', '.iso', '.DMG', '.ISO']
#pylint: disable=invalid-name
def parsePathForDMG(self, pathname):
"""Helper method for working with paths that reference something
@jessepeterson
jessepeterson / findbadacls.py
Last active November 28, 2016 20:30
Finds bad ACE qualifiers (user/group UUIDs) in ACLs on files on macOS. Takes a list of file/directory names on stdin.
#!/usr/bin/python
'''
Takes a list of file names/paths on stdin and checks to see if they have
unresolvable ACE entries in their ACLs. E.g. ACEs which have a non-resolvable
UUID on the system.
Usage:
find /some/file/path | /path/to/findbadacls.py
'''
@jessepeterson
jessepeterson / plist2gostruct.py
Created November 2, 2016 18:07
convert Apple plist to set of golang structs
import sys
import plistlib
pl = plistlib.readPlist(sys.argv[1])
structs = []
def struct_from_dict(name, vals):
global structs
@jessepeterson
jessepeterson / getgrouplist_2.py
Last active May 30, 2018 16:30
getgrouplist using OS X-specific API
#!/usr/bin/python
import grp, pwd, os
from ctypes import *
from ctypes.util import find_library
libc = cdll.LoadLibrary(find_library('libc'))
# getgrouplist_2() is an undocumented API which, I beleive, retrives all of
# a user's groups instead of the maximum 16 groups which getgrouplist() gets
@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