Skip to content

Instantly share code, notes, and snippets.

Michael Lynn pudquick

Block or report user

Report or block pudquick

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pudquick
pudquick / main.m
Created Jun 28, 2017 — forked from steventroughtonsmith/main.m
Load Mach-O executable at runtime and execute its entry point
View main.m
void callEntryPointOfImage(char *path, int argc, char **argv)
{
void *handle;
int (*binary_main)(int binary_argc, char **binary_argv);
char *error;
int err = 0;
printf("Loading %s\n", path);
handle = dlopen (path, RTLD_LAZY);
@pudquick
pudquick / lockscreen.py
Created Dec 23, 2015
Programmatically immediately lock the screen of a Mac running OS X, regardless of security settings, screensaver settings, or Fast User Switch settings
View lockscreen.py
from ctypes import CDLL
loginPF = CDLL('/System/Library/PrivateFrameworks/login.framework/Versions/Current/login')
result = loginPF.SACLockScreenImmediate()
@pudquick
pudquick / Info.plist
Created Oct 29, 2019 — forked from steventroughtonsmith/Info.plist
[Catalyst] Registering for & responding to AppleScript events in a Mac Catalyst app
View Info.plist
<key>NSAppleScriptEnabled</key>
<true/>
<key>OSAScriptingDefinition</key>
<string>ScriptableTasks.sdef</string>
View fdsetup-for-crypt.mobileconfig
<?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>Privacy Preferences Policy Control</string>
<key>PayloadIdentifier</key>
@pudquick
pudquick / 00_notes.md
Last active Oct 14, 2019
Discovering variable/constant values in frameworks
View 00_notes.md
View 01_snip.txt
EFI found at IODeviceTree:/efi
Current EFI boot device string is: '<array><dict><key>IOMatch</key><dict><key>IOProviderClass
</key><string>IOMedia</string><key>IOPropertyMatch</key><dict><key>UUID</key><string>08A2DDE7
-7A58-44F0-ABF6-B721AD7C31AF</string></dict></dict><key>BLLastBSDName</key><string>disk1s2</s
tring></dict><dict><key>IOEFIDevicePathType</key><string>MediaFilePath</string><key>Path</key
><string>\FD77CA06-84E9-42D0-B5FE-6295D28CBB2F\System\Library\CoreServices\boot.efi</string><
/dict></array>'
Boot option is 8BE4DF61-93CA-11D2-AA0D-00E098032B8C:Boot0080
Processing boot option 'Mac OS X'
Boot option matches XML representation
@pudquick
pudquick / get_platform.py
Last active Oct 10, 2019
Get Mac's serial number, hardware UUID, and board-id via python
View get_platform.py
import objc
from Foundation import NSBundle
IOKit_bundle = NSBundle.bundleWithIdentifier_('com.apple.framework.IOKit')
functions = [("IOServiceGetMatchingService", b"II@"),
("IOServiceMatching", b"@*"),
("IORegistryEntryCreateCFProperty", b"@I@@I"),
]
View gist:98c52375dac3525d5de2
#!/usr/bin/env python
# To look at: https://github.com/kcrawford/mac-network/blob/master/lib/mac-network/wifi.rb
# To look at: https://stackoverflow.com/questions/28096630/mac-os-x-10-10-reorder-preferred-networks
'''
Playing around with CoreWLAN to return information about the wi-fi connection
Documentation:
https://developer.apple.com/library/mac/documentation/CoreWLAN/Reference/CWInterface_reference/translated_content/CWInterface.html
@pudquick
pudquick / marketing.py
Last active Oct 3, 2019
Using PrivateFrameworks to get marketing model information for Apple Macs without hitting their internet API (where possible) via python and pyobjc
View marketing.py
# Tested on 10.11
# Note:
# The marketing information embedded in the ServerInformation.framework is not the same as what
# About This Mac displays - there are differences.
#
# For example:
# ServerInformation: 15" MacBook Pro with Retina display (Mid 2015)
# About This Mac: MacBook Pro (Retina, 15-inch, Mid 2015)
#
@pudquick
pudquick / Example.scpt
Created Mar 3, 2018
Make DMGs from folders
View Example.scpt
property destination_for_dmgs : "/Users/mike/Desktop"
on open the_items
repeat with an_item in the_items
set the_info to info for an_item
if kind of the_info is "Folder" then
set dmg_path to quoted form of (destination_for_dmgs & "/" & (name of the_info) & ".dmg")
set src_path to quoted form of POSIX path of an_item
set vol_name to quoted form of (name of the_info)
set command_str to "hdiutil create " & dmg_path & " -volname " & vol_name & " -srcfolder " & src_path
You can’t perform that action at this time.