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 | |
# Some notes about using this script: | |
# - Configure the application path and bundle id below | |
# - This script needs to be run as the user you need to set the checkmark for | |
# - The setting will not take effect until they log out and log back in at least once | |
import os.path | |
from Foundation import NSHomeDirectory, CFPreferencesCopyMultiple, CFPreferencesSetMultiple, kCFPreferencesAnyUser, kCFPreferencesCurrentHost, NSMutableDictionary, NSURL, NSURLBookmarkCreationMinimalBookmark, NSMutableArray |
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
import objc | |
from Foundation import NSBundle | |
IOKit_bundle = NSBundle.bundleWithIdentifier_('com.apple.framework.IOKit') | |
functions = [ | |
("IORegistryEntryFromPath", b"II*"), | |
("IORegistryEntryCreateCFProperty", b"@I@@I"), | |
] |
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
import Foundation | |
//------------------------------------------------------- | |
// this is just setup / test environment stuff | |
// we would normally have the output from ldapsearch here | |
//------------------------------------------------------- | |
let fakeout = "netlogon: FwAA...\n" + | |
" lYXMw...........\n" + | |
" bGFy......=" |
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 | |
from Foundation import NSBundle | |
IOBluetooth = NSBundle.bundleWithIdentifier_('com.apple.Bluetooth') | |
IOBluetoothDevice = IOBluetooth.classNamed_('IOBluetoothDevice') | |
# remove configured devices | |
try: | |
devices = list(IOBluetoothDevice.configuredDevices()) | |
except: |
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 | |
import xml.etree.ElementTree as ET | |
import requests | |
import uuid | |
params = {'cup2hreq': 'foo', 'cup2key': 'bar'} | |
platform = 'mac' | |
os_version = '10.12' |
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
from ctypes import CDLL, Structure, c_uint32, c_int64, c_uint64, c_char, create_string_buffer, byref, c_ubyte, c_int16, c_int64, c_int32 | |
# when _DARWIN_FEATURE_64_BIT_INODE is not defined | |
class statfs32(Structure): | |
_fields_ = [ | |
("f_otype", c_int16), | |
("f_oflags", c_int16), | |
("f_bsize", c_int64), | |
("f_iosize", c_int64), | |
("f_blocks", c_int64), |
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
# Using: https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ObjCRuntimeRef | |
# Thank you to this for inspiration: https://github.com/MacLeek/trackmac/blob/master/trackmac/cocoa.py | |
import objc | |
from ctypes import CDLL, c_void_p, byref, c_char_p | |
from ctypes.util import find_library | |
from Foundation import NSMutableArray | |
Security = CDLL(find_library("Security")) | |
AuthorizationRightGet = Security.AuthorizationRightGet |
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
require 'ffi' | |
class Filesystem | |
extend FFI::Library | |
ffi_lib FFI::Library::LIBC | |
attach_function(:strerror, [:int], :string) | |
attach_function(:getmntinfo64, [:pointer, :int], :int) | |
class Statfs < FFI::Struct |
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 | |
"""Usage: symfind BINARY_PATH SEARCH_STR | |
symfind automates the usage of otool and nm to attempt to find out which | |
binary a symbol is defined in that's used within BINARY_PATH's code. | |
""" | |
import subprocess, os.path, sys, getopt |
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
# Tested on 10.11 | |
# Assumes your network is in a state to actually do the discovery and that you have | |
# automatic timezone discovery enabled in Date & Time and Location services enabled | |
# (Generally this means wifi enabled on your device and network stack is up) | |
# For enabling location services and auto, check Allister's work here: | |
# https://gist.github.com/arubdesu/b72585771a9f606ad800 | |
from Foundation import NSBundle | |
TZPP = NSBundle.bundleWithPath_("/System/Library/PreferencePanes/DateAndTime.prefPane/Contents/Resources/TimeZone.prefPane") |