Skip to content

Instantly share code, notes, and snippets.

#include <CoreFoundation/CoreFoundation.h>
CFPropertyListRef _CFPreferencesCopyApplicationMap(CFStringRef userName, CFStringRef hostName);
int main()
{
CFPropertyListRef app_map;
app_map = _CFPreferencesCopyApplicationMap(kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
@pudquick
pudquick / root.plist
Created July 31, 2014 21:47
root record
<?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>dsAttrTypeStandard:AppleMetaNodeLocation</key>
<array>
<string>/Local/Default</string>
</array>
<key>dsAttrTypeStandard:AuthenticationAuthority</key>
<array>
@pudquick
pudquick / unified_history.sh
Last active October 21, 2020 01:55
Unified history in bash (with a focus on OS X)
# You need to add these two lines to your bash environment
shopt -s histappend
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
# In most *nix variants, that means adding them to your .bashrc file.
# However, on OS X, the default session for Terminal is a login session,
# meaning that it doesn't run .bashrc.
# As such, you'll need to include these commands into your
# .profile or .bash_profile (whichever you have/want).
@pudquick
pudquick / exec-priv.sh
Created August 18, 2014 00:14
An example of using execute-with-privileges verb of security command to bypass GUI for a CLI authorization prompt
# This expects that you're already running as sudo'd / root account
cat <<EOF | security -i
authorize -C adminUserNameHere com.apple.uninstalld.uninstall
execute-with-privileges /usr/sbin/uninstall /Applications/SomeMASapp.app
EOF
# In the example above, if you're already running as root / sudo'd admin,
# you still get a prompt for the password of the account in question.
# We aren't dodging proving we know the password - we're just doing it
@pudquick
pudquick / uninstalld.md
Last active August 26, 2024 14:58
com.apple.uninstalld.uninstall in detail - how to read the authorization.plist / auth.db

A study of the 'com.apple.uninstalld.uninstall' right

From /System/Library/Security/authorization.plist:

<key>com.apple.uninstalld.uninstall</key>
<dict>
    <key>class</key>
    <string>rule</string>
@pudquick
pudquick / pygame.md
Last active August 29, 2015 14:06
Steps to install (most of) pygame cleanly for 10.9

Downloads:

@pudquick
pudquick / cert_tricks.py
Last active August 29, 2015 14:08
SHA-1 PEM cert signature & CN extraction from a certificate via python on OS X
import base64, hashlib
from ctypes import CDLL, POINTER, Structure, create_string_buffer, byref
from ctypes.util import find_library
Security = CDLL(find_library('Security'))
# Importing this via C because haven't figured out how to mix in pyObjc version yet
c_CoreFoundation = CDLL(find_library('CoreFoundation'))
class OpaqueType(Structure):
pass
@pudquick
pudquick / installer.txt
Created October 27, 2014 19:07
Strings on Installer framework
IFJS_IFDContext
IFJS: Package Authoring Error: system.run()/runOnce() require <options allow-external-scripts='yes'/>
IFJS: Path for embedded script %s not available
IFJS: Error while running task %s %s
IFJS: %s: Error getting process info for PSN %d:%d
IFJS: *** exception: %s
IFJS: choices delegate must respond to allChoices and choiceForIdentifier:
IFJS: Package Authoring Error: access to path "%s" requires <options allow-external-scripts='true'>
IFJS: Failed to stat root path %s (%s)
_IFJS_IFDCustomizationItemClassDefinition
@pudquick
pudquick / reg_check.ps1
Created October 31, 2014 00:06
Powershell check a registry key on IPs
$TESTREG = "SOFTWARE\\Adobe\\Adobe ARM\\1.0\\ARM"
$TESTKEY = "iCheck"
$IPS = Get-Content 'C:\Users\yourname\Desktop\ips.txt'
$OUTPUT = 'C:\Users\yourname\Desktop\ips_log.txt'
function GetName($ipaddr) {
# Resolve a computer name if we can
try {
[System.Net.Dns]::GetHostByAddress($ipaddr).HostName
} catch [System.Exception] {