forked from jmahlman/Mac-Admin-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremove-AWCapp.sh
59 lines (50 loc) · 2 KB
/
remove-AWCapp.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/sh
#
#
# Created by John Mahlman, University of the Arts Philadelphia ([email protected])
# Name: remove-AWCapp
#
# Purpose: Run this on a machine to remove the "Mac Adware Cleaner.app" adware. This script doesn't check
# specifically for the app running, we scope this to machines that have the app in inventory.
#
# Changelog
#
# 2/28/18 - Newly created script
#
#
awcPID=`ps -A | grep -m1 '[M]ac Adware Cleaner' | awk '{print $1}'`
# Get the current logged in user that we'll be modifying
if [ ! -z "$3" ]; then
user=$3
else
user=$(python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");')
fi
if [[ $awcPID != "" ]]; then
echo "Killing Mac Adware Cleaner"
killall "Mac Adware Cleaner"
else
echo "Mac Adware Cleaner not running/not found"
fi
if [[ -e "/Applications/Mac Adware Cleaner.app" ]]; then
rm -Rf "/Applications/Mac Adware Cleaner.app"
echo "Remmoved /Applications/Mac Adware Cleaner.app"
fi
if [[ -e "/Applications/_MACOSX/Mac Adware Cleaner.app" ]]; then
rm -Rf "/Applications/_MACOSX/Mac Adware Cleaner.app"
echo "Remmoved /Applications/_MACOSX/Mac Adware Cleaner.app"
fi
if [[ -d "/Users/$user/Library/Mac Adware Cleaner" ]]; then
rm -Rf "/Users/$user/Library/Mac Adware Cleaner"
echo "Removed /Users/$user/Library/Mac Adware Cleaner"
fi
if [[ -d "/Users/$user/Library/Application Support/Mac Adware Cleaner" ]]; then
rm -Rf "/Users/$user/Library/Application Support/Mac Adware Cleaner"
echo "Removed /Users/$user/Application Support/Library/Mac Adware Cleaner"
fi
if [[ -d "/Users/$user/Library/Application Support/awc" ]]; then
rm -Rf "/Users/$user/Library/Application Support/awc"
echo "Removed /Users/$user/Application Support/Library/awc"
fi
# Now the scary part..find a file in /private/var/folders...
find /private/var/folders -name "helperamc" -type d -exec rm -rf {} \;
exit 0