-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinhibitor.sh
97 lines (88 loc) · 2.73 KB
/
inhibitor.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
# Variables
VERSION="beta-0.1"
# Banner Function (Shows the banner lol)
function banner {
echo ""
echo " ** MDM Inhibitor by Francesco Masala **" # It's Me!
echo "** Tested on iPad Pro 10.5 with mosyle MDM + DUP**"
echo " Can cause a thermonuclear war lol" #I don't think but oke
echo ""
}
# Usage or Help Function (Shows the guide for using this script)
function usage {
echo ""
echo "Usage:"
echo -e "./inhibitor.sh --help Show this guide"
echo -e "./inhibitor.sh --inhibit Inhibits the MDM"
echo -e "./inhibitor.sh --backup Backups the MDM profile"
echo -e "./inhibitor.sh --restore-backup Revert the MDM profile"
echo -e "./inhibitor.sh --remove-backup Remove the MDM profile"
echo -e "./inhibitor.sh --version Shows the version of the script"
echo ""
}
# Backup function, in case you delete something important
function backup {
echo ""
echo " [!] Backup will be on /MDM-Backup [!]"
echo " [+] Starting Backup [+]"
echo " [~] Creating Directory [~]"
mkdir /MDM-Backup
echo " [!] Directory Created [!]"
echo " [!] Backing up profiles [!]"
cp -rf /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles/ /MDM-backup
echo " [✓] Done [✓]"
echo ""
}
# restore function, for restoring the backup
function restore {
echo ""
echo " [⭮] Reverting Backup [⭯]"
cp -rf /MDM-backup /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles/
echo " [✓] Done [✓]"
echo ""
}
# removeBackup function, for removing the backup
function removeBackup {
echo ""
echo "!! Deleting Backup !!"
rm -rf /MDM-backup
echo "!! Done !!"
echo ""
}
# Uhh, my favorite the inhibit function, this piece of code inhibits the MDM profile
function inhibit {
echo ""
echo "!! Inhibiting MDM profile !!"
rm -rf /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles/
echo "!! Done !!"
echo ""
}
# Shows the banner
banner
# Uhhh! Spaghetti code
if [ -z $1 ]; then
echo "Missing argument";
usage
######################################
elif [ $1 == "--help" ]; then
usage
######################################
elif [ $1 == "--backup" ]; then
backup
######################################
elif [ $1 == "--restore-backup" ]; then
restore
######################################
elif [ $1 == "--remove-backup" ]; then
removeBackup
######################################
elif [ $1 == "--inhibit" ]; then
inhibit
######################################
elif [ $1 == "--version" ]; then
echo "Version $VERSION"
######################################
else
usage
fi