Skip to content

Instantly share code, notes, and snippets.

@triti
Last active August 29, 2015 14:17
Show Gist options
  • Save triti/ac945399eb1f151bc6fc to your computer and use it in GitHub Desktop.
Save triti/ac945399eb1f151bc6fc to your computer and use it in GitHub Desktop.
Simple script to fix /mach_kernel file visibility. Can be uploaded as a software payload in Absolute Manage.
#!/bin/bash
# https://gist.github.com/ac945399eb1f151bc6fc
# Simple script to set the hidden file flag on /mach_kernel.
# Adapted from Rich Trouton's adaption of Tim Sutton's script.
# Link: https://derflounder.wordpress.com/2015/03/11/fixing-mach_kernel-file-visibility-using-casper/
# Link: http://macops.ca/security-updates-leaving-mach_kernel-visible/
if [[ -e /mach_kernel ]]; then
# Simple test for a static substring in Bash
if [[ "$(/bin/ls -lO /mach_kernel)" != *hidden* ]]; then
echo "/mach_kernel is visible. Setting hidden flag."
/usr/bin/chflags hidden /mach_kernel
fi
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment