Skip to content

Instantly share code, notes, and snippets.

Nick McSpadden nmcspadden

Block or report user

Report or block nmcspadden

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 / keychain_password.py
Created Mar 6, 2017
Storing and retrieving a generic password in the login.keychain in macOS via python and pyobjc
View keychain_password.py
import objc
from ctypes import c_char
from Foundation import NSBundle
Security = NSBundle.bundleWithIdentifier_('com.apple.security')
S_functions = [
('SecKeychainGetTypeID', 'I'),
('SecKeychainItemGetTypeID', 'I'),
('SecKeychainAddGenericPassword', 'i^{OpaqueSecKeychainRef=}I*I*I*o^^{OpaqueSecKeychainItemRef}'),
('SecKeychainOpen', 'i*o^^{OpaqueSecKeychainRef}'),
@pudquick
pudquick / xcode_get.py
Last active Aug 8, 2019
Stupid tricks: using stock macOS python subprocess with curl to download products from Apple's Developer Center
View xcode_get.py
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
DEV_SITE = 'https://developer.apple.com'
AUTH_SITE = 'https://idmsa.apple.com'
AUTH_PATH = '/IDMSWebAuth/authenticate'
APPIDKEY_PATH = "/services-account/download?path=%s"
@bruienne
bruienne / google_chrome_update_checker.py
Created Sep 27, 2016
Basic concept for querying for Google Chrome updates based on current Chrome version/OS/arch
View google_chrome_update_checker.py
#!/usr/bin/python
import xml.etree.ElementTree as ET
import requests
import uuid
params = {'cup2hreq': 'foo', 'cup2key': 'bar'}
platform = 'mac'
os_version = '10.12'
@jessepeterson
jessepeterson / getgrouplist_2.py
Last active May 30, 2018
getgrouplist using OS X-specific API
View getgrouplist_2.py
#!/usr/bin/python
import grp, pwd, os
from ctypes import *
from ctypes.util import find_library
libc = cdll.LoadLibrary(find_library('libc'))
# getgrouplist_2() is an undocumented API which, I beleive, retrives all of
# a user's groups instead of the maximum 16 groups which getgrouplist() gets
@timsutton
timsutton / auto-update-mas-apps.sh
Last active Mar 7, 2018
Clear storeagent cache and trigger Mac App Store app updates.
View auto-update-mas-apps.sh
#!/bin/sh
#
# Trigger an update of MAS (and softwareupdate) apps
#
# This seems to be all that's needed to schedule an immediate update of
# MAS apps. This should be run as a normal user. You can run this and
# tail the install log to get an idea of what's happening.
#
# You can also take a look at this user's ~/Library/Caches/com.apple.storagent
# directory to get a report on what apps were available, installable, etc.
@pudquick
pudquick / mas_updates.py
Last active Dec 24, 2018
Mac App Store updates
View mas_updates.py
# App Store playing
import urllib, urllib2, json, plistlib
###
# Utility function for performing an iTunes-style search
def perform_itunes_search(api_url, query_list=[]):
query_str = urllib.urlencode(query_list)
response_handle = urllib2.urlopen('https://itunes.apple.com/%s?%s' % (api_url, query_str))
@gregneagle
gregneagle / NSPredicateTester.py
Last active Jun 1, 2018
NSPredicateTester.py
View NSPredicateTester.py
#!/usr/bin/python
import sys
import os
from Foundation import NSDate
from Foundation import NSPredicate
def doComparison(comp_string, obj):
print 'Comparison: %s' % comp_string
You can’t perform that action at this time.