Skip to content

Instantly share code, notes, and snippets.

Joel Bruner brunerd

Block or report user

Report or block brunerd

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
@brunerd
brunerd / macHardwareIdentifiers.sh
Last active Jan 28, 2020
Shell one liners for getting Mac hardware Serial, UUID, and Board ID
View macHardwareIdentifiers.sh
#in order of speed (by milliseconds), faster first, slower second
#serial
mySerial=$(/usr/libexec/PlistBuddy -c "print :0:IOPlatformSerialNumber" /dev/stdin <<< "$(ioreg -a -p IODeviceTree -r -n / -d 1)")
mySerial=$(/usr/libexec/PlistBuddy -c "print :0:IOPlatformSerialNumber" /dev/stdin <<< "$(ioreg -ard1 -c IOPlatformExpertDevice)")
#uuid
myUUID=$(/usr/libexec/PlistBuddy -c "print :0:IOPlatformUUID" /dev/stdin <<< "$(ioreg -a -p IODeviceTree -r -n / -d 1)")
myUUID-$(/usr/libexec/PlistBuddy -c "print :0:IOPlatformUUID" /dev/stdin <<< "$(ioreg -ard1 -c IOPlatformExpertDevice)")
@brunerd
brunerd / maclTackle.command
Last active Mar 29, 2020
A hacky example to clean the com.apple.macl attribute from a file using zip to sidestep SIP on Catalina
View maclTackle.command
#!/bin/bash
#clean the com.apple.macl attribute from a file or folders using zip to sidestep SIP on Catalina
#WARNING: This will overwrite the original file/folders with the zipped version - DO NOT use on production data
#hold down command key at launch or touch /tmp/debug to enable xtrace command expansion
commandKeyDown=$(/usr/bin/python -c 'import Cocoa; print Cocoa.NSEvent.modifierFlags() & Cocoa.NSCommandKeyMask > 1')
[ "$commandKeyDown" = "True" -o -f /tmp/debug ] && set -x && xtraceFlag=1
#hacky example to clean the com.apple.macl attribute from a file using zip to sidestep SIP
: <<-EOL
@brunerd
brunerd / maclTrack.command
Last active Jan 7, 2020
Examine all the com.apple.macl entries on files and folders
View maclTrack.command
#!/bin/bash
: <<-EOL
MIT License
Copyright (c) 2020 Joel Bruner
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@brunerd
brunerd / repackPKGs.command
Created Oct 28, 2019
Repack expired packages and strip off certs
View repackPKGs.command
#!/bin/bash
#Joel "brunerd" Bruner - repack and expired pkg, stripping off all certs
#we can specify a target as an argument
target="$1"
#if target not specified we ask
while [ ! -d "${target}" -a ! -f "${target}" ]; do
read -p "Please provide a target file or folder: " target
done
@brunerd
brunerd / certChecker.command
Last active Jan 2, 2020
Check the signing certificates on pkg packages and apps
View certChecker.command
#!/bin/bash
#certChecker - gets the certificate expiration(s) from a pkg or an app and outputs as CSV
: <<-EOL
MIT License
Copyright (c) 2020 Joel Bruner (brunerd.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@brunerd
brunerd / shell_vers.sh
Last active Oct 25, 2019
Quickly get versions of items in /etc/shells
View shell_vers.sh
#!/bin/sh
#brunerd - shell_vers
#a simple version checker of available shells
#not guaranteed to always work (I'm looking at YOU dash!)
#specify another volume to test
target="$1"
#loop through /etc/shells either locally or on specified target volume
for shell in $(grep -v ^\# "${1}"/etc/shells); do
@brunerd
brunerd / removeSpawnOfZoomOpenerAllUsers.sh
Last active Aug 8, 2019
Removes all the ZoomOpener variants for all users
View removeSpawnOfZoomOpenerAllUsers.sh
#!/bin/bash
#Joel Bruner - removes all ZoomOpener variants for all users
#############
# VARIABLES #
#############
#folder names where lurking webservers live
folderNames=".ringcentralopener
.zoomus
View isVM
#!/bin/bash
#macOS - returns 0 or 1 depending on if we are a running in a VM or not
grep -c VMM <<< $(sysctl -n machdep.cpu.features)
@brunerd
brunerd / nothing
Last active Feb 10, 2020
Uses of : (no effect)
View nothing
#to officially do nothing
:
#there you go, this could be used when writing or troubleshooting a script and you have only a single item in an if clause
if [ "${this}" = "that" ]; then
#actually not sure what to do here, let's do nothing
:
else
echo "This else, I'll do"
You can’t perform that action at this time.