Skip to content

Instantly share code, notes, and snippets.


Shea Craig sheagcraig

View GitHub Profile
import datetime
import json
import requests
from requests_oauthlib import OAuth2Session
from oauthlib.oauth2 import BackendApplicationClient
from config import client_id, client_secret, refresh_token
def run():
View fdsetup-for-crypt.mobileconfig
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<string>Privacy Preferences Policy Control</string>
zrzka /
Last active Oct 19, 2020
iOS Keychain for Pythonista (WIP)
from ctypes import c_int, c_void_p, POINTER, byref, c_ulong
from objc_util import (
load_framework, c, ns, ObjCInstance, nsdata_to_bytes, NSString, NSData, NSNumber,
ObjCClass, NSArray, NSDictionary
from enum import Enum, IntFlag
from typing import Union
import datetime
ygini / Reversing 10.13 RootGate, hands
Last active Oct 22, 2018
Work in progress, notes for the current state
View Reversing 10.13 RootGate, hands

Reversing 10.13 RootGate, hands notes

Inital discovery process

Original state of the root.plist

Dict {
    smb_sid = Array {
sudo /usr/libexec/PlistBuddy -x -c 'Print :ShadowHashData' /var/db/dslocal/nodes/Default/users/root.plist | awk '/\t[^\<]/{print $1}' | base64 -D | plutil -convert xml1 -o - -- - | python -c 'import plistlib; import sys; plist = plistlib.readPlistFromString(; print plist["SALTED-SHA512-PBKDF2"]["iterations"]'
rkitover / python-3.6.3-custom-static-openssl.patch
Created Nov 16, 2017
Patch for Python 3.6.3 to use a custom static OpenSSL
View python-3.6.3-custom-static-openssl.patch
diff -ruN Python-3.6.3.orig/
--- Python-3.6.3.orig/ 2017-10-02 22:52:02.000000000 -0700
+++ 2017-11-16 13:35:45.000000000 -0800
@@ -811,10 +811,15 @@
exts.append( Extension('_socket', ['socketmodule.c'],
depends = ['socketmodule.h']) )
# Detect SSL support for the socket module (via _ssl)
+ openssl_root = os.getenv('OPENSSL_ROOT')
search_for_ssl_incs_in = [
pudquick /
Created Jul 14, 2017
Locking the screen of my Mac and playing a sound file with pyObjC
approved_UUIDs = ['your-beacon-UUID-here'] # see line 64
path_to_lock_sound = '/Users/frogor/Desktop/car_lock.m4a'
path_to_warn_sound = '/Users/frogor/Desktop/viper_warning.m4a'
import time
import objc
from objc import NO
from Foundation import NSBundle, NSClassFromString, NSObject, NSRunLoop, NSDate, NSUUID, NSMakeRange, NSURL
from AVFoundation import AVAudioPlayer
pudquick /
Last active Aug 8, 2019
Stupid tricks: using stock macOS python subprocess with curl to download products from Apple's Developer Center
from subprocess import Popen, PIPE, STDOUT, check_output
from mimetools import Message
from StringIO import StringIO
from urlparse import urlparse, parse_qs
from urllib import quote, basejoin, urlencode
AUTH_PATH = '/IDMSWebAuth/authenticate'
APPIDKEY_PATH = "/services-account/download?path=%s"
pudquick /
Last active Dec 8, 2018
Accessing battery details via python and pyobjc on macOS / OS X
import objc
from Foundation import NSBundle
IOKit = NSBundle.bundleWithIdentifier_('')
functions = [("IOServiceGetMatchingService", b"II@"),
("IOServiceMatching", b"@*"),
("IORegistryEntryCreateCFProperties", b"IIo^@@I"),
("IOPSCopyPowerSourcesByType", b"@I"),
("IOPSCopyPowerSourcesInfo", b"@"),
pudquick /
Created Sep 10, 2016
An example of conversion of ctypes pointers to pyobjc objects that's compatible with pyobjc versions earlier than 2.5
# Using:
# Thank you to this for inspiration:
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
You can’t perform that action at this time.