Created
August 30, 2016 17:51
-
-
Save kitzy/fa9c38c05828c3afa70ebc8afa28c437 to your computer and use it in GitHub Desktop.
A Casper extension attribute to detect OSX/Keydnap
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
<?xml version="1.0" encoding="UTF-8"?> | |
<extensionAttribute> | |
<displayName>Transmission Vulnerability</displayName> | |
<description>Detects the existence of OSX/Keydnap. Returns "VULNERABLE" if found and "NOT VULNERABLE" if not.</description> | |
<dataType>string</dataType> | |
<scriptContentsMac>#!/bin/bash | |
| |
################# | |
### Variables ### | |
################# | |
| |
# Items at the system level to be checked | |
systemItems=( | |
/Applications/Transmission.app/Contents/Resources/License.rtf | |
/Volumes/Transmission/Transmission.app/Contents/Resources/License.rtf | |
/Library/Application\ Support/com.apple.iCloud.sync.daemon/ | |
) | |
| |
# Items at the user level to be checked | |
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 checkItems() | |
{ | |
declare -a toCheck=("${!1}") | |
| |
for item in "${toCheck[@]}" | |
do | |
if [[ ! -z "${2}" ]] | |
then | |
item=("${2}""${item}") | |
fi | |
| |
if [ -e "${item}" ] | |
then | |
echo "<result>VULNERABLE</result>" | |
exit 0 | |
fi | |
done | |
} | |
| |
#################### | |
### Main Program ### | |
#################### | |
| |
# Check system level items | |
checkItems systemItems[@] | |
| |
# Check user level items | |
for dirs in /Users/*/ | |
do | |
checkItems userItems[@] "${dirs}" | |
done | |
| |
echo "<result>NOT VULNERABLE</result>" | |
| |
exit 0 | |
</scriptContentsMac> | |
<scriptContentsWindows/> | |
</extensionAttribute> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment