Skip to content

Instantly share code, notes, and snippets.

@kitzy
Created August 30, 2016 17:54
Show Gist options
  • Save kitzy/f5f89e3e490ba7829c69a7c6dda3334f to your computer and use it in GitHub Desktop.
Save kitzy/f5f89e3e490ba7829c69a7c6dda3334f to your computer and use it in GitHub Desktop.
A script to remove the OSX/Keydnap vulnerability distributed through Transmission.app
#!/bin/bash
#################
### Variables ###
#################
# Items at the system level to be removed
systemItems=(
/Applications/Transmission.app
/Library/Application\ Support/com.apple.iCloud.sync.daemon/
)
# Items at the user level to be removed
userItems=(
Library/Application\ Support/com.apple.iCloud.sync.daemon/icloudsyncd
Library/Application\ Support/com.apple.iCloud.sync.daemon/process.id
Library/LaunchAgents/com.apple.iCloud.sync.daemon.plist
Library/LaunchAgents/com.geticloud.icloud.photo.plist
)
#################
### Functions ###
#################
function deleteItems()
{
declare -a toDelete=("${!1}")
for item in "${toDelete[@]}"
do
if [[ ! -z "${2}" ]]
then
item=("${2}""${item}")
fi
echo "Looking for $item"
if [ -e "${item}" ]
then
echo "Removing $item"
rm -rf "${item}"
fi
done
}
####################
### Main Program ###
####################
# Delete system level items
deleteItems systemItems[@]
# Delete user level items
for dirs in /Users/*/
do
deleteItems userItems[@] "${dirs}"
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment