Last active
December 14, 2015 09:39
-
-
Save bruienne/5066890 to your computer and use it in GitHub Desktop.
Set Flash plugin minimum version to currently installed version while evaluating Xprotect.meta.plist changes. Note $3 entries for easy use in a payload-free package.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function version { echo "$@" | awk -F. '{ printf("%d.%d.%d.%d\n", $1,$2,$3,$4); }'; } | |
if [[ -e "$3/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/XProtect.meta.plist" ]]; then | |
CURRENT_FLASH_BUILD=`/usr/libexec/PlistBuddy -c "print :CFBundleShortVersionString" "$3/Library/Internet Plug-Ins/Flash Player.plugin/Contents/Info.plist"` | |
XPROTECT_FLASH_BUILD=`/usr/libexec/PlistBuddy -c "print :PlugInBlacklist:10:'com.macromedia.Flash Player.plugin':MinimumPlugInBundleVersion" "$3/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/XProtect.meta.plist"` | |
if [[ $(version ${CURRENT_FLASH_BUILD}) < $(version ${XPROTECT_FLASH_BUILD}) ]]; then | |
logger "Current Flash version (${CURRENT_FLASH_BUILD}) is less than the minimum build required by Xprotect (${XPROTECT_FLASH_BUILD}), reenabling." | |
/usr/libexec/PlistBuddy -c "set :PlugInBlacklist:10:'com.macromedia.Flash Player.plugin':MinimumPlugInBundleVersion ${CURRENT_FLASH_BUILD}" "$3/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/XProtect.meta.plist" | |
else | |
logger "Current Flash version is ${CURRENT_FLASH_BUILD} and Xprotect minimum build is ${XPROTECT_FLASH_BUILD}, nothing to do here." | |
fi | |
else | |
logger "Xprotect not found, skipping." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cleaned up extraneous quotes in PlistBuddy set command.