This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# Function returns a dict containing the results of `diskutil info /dev/disk` | |
import plistlib | |
import subprocess | |
def disk_info(disk): | |
cmd = ['/usr/sbin/diskutil', 'info', '-plist', disk] | |
(results, error) = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Get network interface. We sleep so that the interface has a chance to come up! | |
# Substitute the 0.0.0.0 address if you have a specific route that you want to test, however this may impact | |
# portability if a machine spends more time without access to that route than with. | |
# Give the interface a chance to come up - useful if this is used in any boot up processes | |
while [ $(route get 0.0.0.0 2>/dev/null | grep -c interface) != 1 ]; do | |
sleep 5 | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
'''Converts a standard Wi-Fi configuration profile for iOS/macOS that uses | |
a user certificate, and converts it into a SystemConfiguration profile type | |
that can be used to connect to a Wi-Fi network at macOS login screen. | |
This is useful where you need a laptop to be able to bind to an AD or LDAP | |
server, or just want to have user credential free Wi-Fi connection at the | |
system level.''' | |
import os | |
import plistlib |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Shamelessly stolen from https://loefflmann.blogspot.com.au/2015/03/finding-os-x-version-and-build-in-install-os-x-app.html | |
# Provide the path to the installer file from the command line. | |
if [[ ! -z $1 ]]; then | |
os_installer_path="$1" | |
echo "Attaching ${1}" | |
hdiutil attach "${os_installer_path}/Contents/SharedSupport/InstallESD.dmg" -quiet -noverify -nobrowse -mountpoint /Volumes/InstallESD.$$ | |
hdiutil attach "/Volumes/InstallESD.$$/BaseSystem.dmg" -quiet -noverify -nobrowse -mountpoint /Volumes/BaseSystem.$$ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# User path | |
/usr/bin/getconf DARWIN_USER_DIR | |
# Temp directory | |
# Note - $TMPDIR is the same as this | |
/usr/bin/getconf DARWIN_USER_TEMP_DIR | |
# Cache directory |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
'''List APFS containers and return properties. Free to use/abuse/improve/laugh at''' | |
import plistlib | |
import subprocess | |
import sys | |
from collections import namedtuple | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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>PayloadContent</key> | |
<dict> | |
<key>com.apple.touristd</key> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This will import a VirtualBox OVA file for the currently logged in user; by default, when `VBoxManage import` is run in | |
# root environment, it will import the VM into a folder in the root user home directory. | |
# Handy for enabling self-service installs of a VM. | |
# The script is _very_ basic and doesn't have any form of version management/removal/upgrade capability, but this | |
# should be relatively easily expandable with the right `VBoxManage` commands. | |
# | |
# This example is for use in a package that doesn't actually install the OVA on disk, but imports it direct from the .pkg | |
# file. Essentially 'payload free', but not ;) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
"""Current user logged into macOS, shamelessly stealing macmule's get current | |
logged in user from https://macmule.com/2014/11/19/how-to-get-the-currently-logged-in-user-in-a-more-apple-approved-way/""" | |
import pwd | |
import sys | |
from collections import namedtuple | |
try: | |
from SystemConfiguration import SCDynamicStoreCopyConsoleUser |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Find valid code signing certificates with: | |
#/usr/bin/security find-identity -p codesigning -v | |
#Eg: | |
#[carl@pegasus]:outset # security find-identity -p codesigning -v | |
# 1) A898234JHSDFH38WERKHJSDFLJ2UY4092367HJK9H4J18 "Mac Developer: [email protected] (ABC01FFFGH)" | |
# 1 valid identities found | |
#Code Sign file with: | |
#/usr/bin/codesign -s "Mac Developer: [email protected] (ABC01FFFGH)" -i <bundleID> <file> |