Skip to content

Instantly share code, notes, and snippets.

View keeleysam's full-sized avatar
💾

Samuel Keeley keeleysam

💾
View GitHub Profile
@pudquick
pudquick / unsign_plist.py
Created January 17, 2016 04:05
Getting an unsigned plist / mobileconfig from a signed one in python on OS X with pyObjC
import objc
from Foundation import NSBundle
Security_bundle = NSBundle.bundleWithIdentifier_('com.apple.security')
CMSDecoderRef = objc.createOpaquePointerType("CMSDecoderRef", b"^{CMSDecoder}", None)
functions = [('CMSDecoderCreate', b'io^^{CMSDecoder}'),
('CMSDecoderUpdateMessage', b'i^{CMSDecoder}*I'),
('CMSDecoderFinalizeMessage', b'i^{CMSDecoder}',),
@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