Skip to content

Instantly share code, notes, and snippets.

Avatar

Shea Craig sheagcraig

View GitHub Profile
View doing the enclave
from Foundation import NSString, NSUTF8StringEncoding
from Security import *
# As per: https://developer.apple.com/documentation/security/certificate_key_and_trust_services/keys/storing_keys_in_the_secure_enclave?language=objc
# and: https://developer.apple.com/documentation/security/certificate_key_and_trust_services/keys/generating_new_cryptographic_keys?language=objc#2863927
access = SecAccessControlCreateWithFlags(
kCFAllocatorDefault,
kSecAttrAccessibleWhenUnlockedThisDeviceOnly,
@sheagcraig
sheagcraig / bring_the_payne.py
Created May 4, 2017
Get IP Address for all computers in the JSS
View bring_the_payne.py
#!/usr/bin/env python
"""https://twitter.com/krispayne/status/859833552078225408:
@shea_craig is possible with python-jss to generate a list of IP addresses for
computers in the JSS?
"""
from operator import itemgetter
@sheagcraig
sheagcraig / README.md
Last active Nov 6, 2018
Uninstall Microsoft Lync
View README.md

UninstallLync

According to Microsoft, Lync must be completely uninstalled, following the procedures documented at https://technet.microsoft.com/en-us/library/jj945448(v=office.14).aspx, at least for Calendar functionality to work correctly.

This repo contains a python script for removing all referenced Lync components for all normal users on a machine, i.e., with homes in /Users.

It is somewhat naive in that it assumes the users have not moved the Lync keychain items out of the Login keychain and into some other keychain. It handles the potential for multiple "your.email@domain.com" certificates in the login keychain, however. This is all done by running the security command as a subprocess. Improvements could probably be made to do this all with the Security Framework and the PyObjC bridge, but this gets the job done.

Using UninstallLync in Your Environment

You will need to edit the pattern global APP_PW_PATTERN at the top of the uninstall_lync.py script to look for your environment's email domai

@sheagcraig
sheagcraig / uninstall_office2016.py
Created Sep 26, 2016
Silent Uninstall of Office 2016
View uninstall_office2016.py
#!/usr/bin/python
# Completely uninstall Office 2016, as per:
# https://support.office.com/en-us/article/Uninstall-Office-2016-for-Mac-eefa1199-5b58-43af-8a3d-b73dc1a8cae3
# and
# https://support.office.com/en-us/article/Troubleshoot-Office-2016-for-Mac-issues-by-completely-uninstalling-before-you-reinstall-ec3aa66e-6a76-451f-9d35-cba2e14e94c0?ui=en-US&rs=en-US&ad=US
import glob
import os
@sheagcraig
sheagcraig / Makefile
Last active Oct 26, 2017
Munki/Outset/PyObjC Self Service Set Apple Mail as Default Handler for mailto
View Makefile
include /usr/local/share/luggage/luggage.make
TITLE=set_apple_mail_handler
REVERSE_DOMAIN=com.sas
PAYLOAD=\
pack-usr-local-sas-sas.png \
pack-script-postinstall \
pack-outset-on-demand-set_apple_mail_handler.py \
PACKAGE_VERSION=1.0.0
@sheagcraig
sheagcraig / Makefile
Last active Aug 7, 2019
Set Microsoft Outlook as Default Handler for mailto, vcf, and ics
View Makefile
include /usr/local/share/luggage/luggage.make
TITLE=set_default_outlook
REVERSE_DOMAIN=com.sas
PAYLOAD=\
pack-outset-login-once-set_outlook_default_handler.py \
PACKAGE_VERSION=1.0.0
@sheagcraig
sheagcraig / turn-ssh-roaming-off
Last active Jan 21, 2016
Munki pkginfo to solve CVE-0216-0777 and CVE-0216-0778
View turn-ssh-roaming-off
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>_metadata</key>
<dict>
<key>created_by</key>
<string>itadmn</string>
<key>creation_date</key>
<date>2016-01-15T14:29:44Z</date>
@sheagcraig
sheagcraig / derFlounderTest.py
Last active Aug 29, 2015
Der Flounder Test
View derFlounderTest.py
#!/usr/bin/python
import ssl
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.poolmanager import PoolManager
from requests.packages.urllib3.contrib import pyopenssl
#import jss
@sheagcraig
sheagcraig / update_warranty_expires_group.py
Last active Aug 29, 2015
UpdateWarrantyExpiresGroup.py
View update_warranty_expires_group.py
#!/usr/bin/python
# 2015 Shea G. Craig
# ____ ______ __
# / ___/ ___\ \/ /
# | | _\___ \\ /
# | |_| |___) / \
# \____|____/_/\_\
# NO WARRANTY FOR YOU!
@sheagcraig
sheagcraig / ThunderstrikeVulnerabilityEA.py
Last active Aug 29, 2015
ThunderstrikeVulnerabilityEA.py
View ThunderstrikeVulnerabilityEA.py
#!/usr/bin/python
# Culled from https://gist.github.com/arubdesu/05b4172890450fa2d9e6
# Given a list of FW models and Thunderstrike patched FW versions,
# report on whether a machine has been patched.
import subprocess
import plistlib
You can’t perform that action at this time.