Skip to content

Instantly share code, notes, and snippets.

View AndrewWCarson's full-sized avatar
🐦

Andrew Worth Carson AndrewWCarson

🐦
View GitHub Profile
@AndrewWCarson
AndrewWCarson / .vimrc
Created November 12, 2019 20:32
vim settings and such....
" Andrew Worth Carson
" (C) 2017
" Rebind <Leader> key
let mapleader = ","
" Rebind copy & paste
vmap <Leader>c :w !pbcopy<CR>
" Bind quicksave commands
@AndrewWCarson
AndrewWCarson / Restart Addigy Devices(MDM).py
Created October 30, 2019 17:35
Restart All Devices in a Policy
#!/usr/bin/python
# Addigy API Credentials
client_id = 'YOUR ADDIGY API CLIENT_ID HERE'
client_secret = 'YOUR ADDIGY API CLIENT_SECRET HERE'
policy_name = 'YOUR POLICY NAME HERE'
# Libraries
import sys
import requests
@AndrewWCarson
AndrewWCarson / Export Addigy Events.py
Created August 2, 2019 00:29
An example iterating through events in the Addigy API and outputting them to a .csv file.
#!/usr/local/bin/python3
# Addigy API Credentials
client_id = 'YOUR ADDIGY API CLIENT_ID HERE'
client_secret = 'YOUR ADDIGY API CLIENT_SECRET HERE'
# Libraries
import sys
import requests
import json
@AndrewWCarson
AndrewWCarson / Validate Recovery Key.sh
Created June 25, 2019 20:48
This wraps the `fdesetup validaterecovery -inputplist` for easy remote execution. Edit the fvKey variable in the script with your key or run it with the key as an argument.
#!/bin/bash
fvKey="CN72-EJBE-8LTH-EL99-RDN5-OMXB"
if [[ $1 != '' ]]; then
fvKey="$1"; fi
sudo fdesetup validaterecovery -inputplist <<EOF
<?xml version="1.0" encoding="UTF-8"?>
@AndrewWCarson
AndrewWCarson / bom.py
Created June 14, 2019 03:07 — forked from pudquick/bom.py
Parsing of bom files in pure python
# Python routines for parsing bom files
#
# Examples so far:
#
# dump_bom(filename) - prints diagnostic structure information about bom file (including path list)
from ctypes import BigEndianStructure, c_char, c_uint8, c_uint16, c_uint32, sizeof, memmove, addressof
class BOMHeader(BigEndianStructure):
_pack_ = 1
@AndrewWCarson
AndrewWCarson / diff-root-catalina.out
Created June 10, 2019 00:26
A diff of `sudo ls -alO /` on with and without the /.rootro flag in Catalina (Build 19A471t).
andrew@Andrews-MBP ~ % diff ro*
4d3
< srwxrwxrwx - .dbfseventsd
6a6
> -rw-r--r-- - .rootro
12c12
< drwxr-xr-x - Users
---
> drwxr-xr-x sunlnk Users
username@macos-10 ~ % sudo touch /lol
touch: /lol: Read-only file system
username@macos-10 ~ % sudo chmod +x /
username@macos-10 ~ % ls -al /
total 21
drwxr-xr-x 30 root admin 960 Jun 7 16:13 .
[ truncated ]
username@macos-10 ~ % sudo chmod -x /
@AndrewWCarson
AndrewWCarson / Supervised.sh
Created June 6, 2019 20:30
Outputs True/False based on the device "Supervised" status (determined by whether the device has gone through Device Enrollment provisioning).
#!/bin/bash
if /usr/libexec/mdmclient QuerySecurityInfo | grep -m1 EnrolledViaDEP | grep 1 >&/dev/null; then
echo "True"
else
echo "False"
fi
@AndrewWCarson
AndrewWCarson / Enable Location Services.sh
Created June 2, 2019 16:44
Enables location services on macOS 10.14 Mojave.
#!/bin/bash
/usr/bin/defaults write /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd LocationServicesEnabled -int 1
@AndrewWCarson
AndrewWCarson / Stealth Mode.sh
Created May 28, 2019 20:09
Report True/False based on Stealth Mode settings.
#!/bin/bash
if /usr/libexec/ApplicationFirewall/socketfilterfw --getstealthmode | grep enabled >& /dev/null; then
echo "true"
elif /usr/libexec/ApplicationFirewall/socketfilterfw --getstealthmode | grep disabled >& /dev/null; then
echo "false"
else
echo "Error: could not read valid Stealth Mode value."
fi