Skip to content

Instantly share code, notes, and snippets.

Avatar

Samuel Keeley keeleysam

View GitHub Profile
@pudquick
pudquick / unsign_plist.py
Created Jan 17, 2016
Getting an unsigned plist / mobileconfig from a signed one in python on OS X with pyObjC
View unsign_plist.py
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 Aug 29, 2015
SHA-1 PEM cert signature & CN extraction from a certificate via python on OS X
View cert_tricks.py
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
You can’t perform that action at this time.