Skip to content

Instantly share code, notes, and snippets.

@bruienne
Last active December 14, 2015 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bruienne/5066890 to your computer and use it in GitHub Desktop.
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.
#!/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
@bruienne
Copy link
Author

bruienne commented Mar 1, 2013

Cleaned up extraneous quotes in PlistBuddy set command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment