-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.sh
executable file
·184 lines (168 loc) · 5.11 KB
/
install.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#!/bin/bash
#####################################
# Parasite Installer Justin0a0 2016 #
#####################################
if [ "$EUID" -ne 0 ]; then
printf "\nPlease run this script as root.\n\n"
exit
fi
REPOS=('kext' 'library' 'Crucible')
DIRS=('/tmp/parasite' '/Library/Parasite/Crucible' '/Library/Parasite/Extensions' '/Library/Parasite')
KEXT=('Parasite.kext' '/Library/Extensions')
FRAMEWORK=('ParasiteRuntime.framework' '/Library/Frameworks')
CRUCIBLE=('Crucible.bundle' '/Library/Parasite/Extensions')
funcTestFiles() {
if [ -e ${KEXT[1]}/${KEXT[0]} ] || [ -e ${FRAMEWORK[1]}/${FRAMEWORK[0]} ] || [ -e ${CRUCIBLE[1]}/${CRUCIBLE[0]} ]
then
return 0
else
return 1
fi
}
funcTestInstall() {
if [ $1 ];
then
if funcTestFiles;
then
printf '\nAlready installed either uninstall \nor Update Parasite.\n\n'
funcRemoveTemp
exit
fi
else
if ! funcTestFiles;
then
printf '\nParasite not found!\nPlease Install first.\n\n'
funcRemoveTemp
exit
fi
fi
}
funcDownload() {
printf 'Downloading Files...\n'
for REPO in "${REPOS[@]}"; do
LINK=$(curl -s https://api.github.com/repos/ParasiteTeam/$REPO/releases/latest | grep 'browser_' | cut -d\" -f4)
printf "Downloading $REPO...\n"
curl -sL $LINK > "$REPO.zip"
printf "Done.\n"
printf "Unpacking $REPO...\n"
unzip -qq "$REPO.zip"
printf "Done.\n"
rm "$REPO.zip"
done
}
funcMoveFiles() {
printf 'Moving files into place...\n'
mv -f ${KEXT[0]} ${KEXT[1]}/${KEXT[0]}
mv -f ${FRAMEWORK[0]} ${FRAMEWORK[1]}/${FRAMEWORK[0]}
mv -f ${CRUCIBLE[0]} ${CRUCIBLE[1]}/${CRUCIBLE[0]}
}
funcSetPerms() {
printf 'Setting file permissions...\n'
chmod -R 755 {${KEXT[1]}/${KEXT[0]},${FRAMEWORK[1]}/${FRAMEWORK[0]}}
chown -R root:wheel {${KEXT[1]}/${KEXT[0]},${FRAMEWORK[1]}/${FRAMEWORK[0]}}
}
funcKext() {
if [ $1 ];
then
kextload ${KEXT[1]}/${KEXT[0]} 2>&1
if [ $? != 0 ];
then
printf 'Kext loading failed. Did you read the notice?\nIf it is disabled please let us know\nhttps://github.com/ParasiteTeam/installer/issues'
else
printf 'Kext successfully loaded!\n'
fi
else
kextunload ${KEXT[1]}/${KEXT[0]} 2>&1
if [ $? != 0 ];
then
printf 'Kext is currently unloaded.\n'
else
printf 'Kext successfully unloaded!\n'
fi
fi
}
funcRemoveFiles() {
printf 'Removing files...\n'
rm -rf ${KEXT[1]}/${KEXT[0]}
rm -rf ${FRAMEWORK[1]}/${FRAMEWORK[0]}
rm -rf ${CRUCIBLE[1]}/${CRUCIBLE[0]}
rm -f ${DIRS[3]}/.accepted
}
funcRemoveDirs() {
printf '\n-----------------------NOTICE---------------------------\nRemoving Directories will delete anything you have\ninstalled for Parasite or Crucible.\n--------------------------------------------------------\n'
printf 'Would you like to remove the directories?[Y/n]'
read ans
case "$ans" in
y|Y)
printf 'Removing Parasite directories...\n'
rm -rf ${DIRS[3]}
;;
*);;
esac
}
funcRemoveTemp() {
rm -r ${DIRS[0]}
}
funcNotices() {
printf '\n-----------------------NOTICE---------------------------\nParasite requires kext signature checking to be disabled.\nTo disable please reboot your computer into recovery mode\nOpen terminal from the utilities menu and enter\n"csrutil enable --without kext" to disable kext signature\nchecking or "csrutil disable" to disable SIP in its\nentirety (Not Recomended)\n--------------------------------------------------------\n'
printf 'Have you already disabled checking kext signatures?[Y/n]'
read ans
case "$ans" in
y|Y);;
*) exit;;
esac
printf '\n-----------------------WARNING--------------------------\nParasite allows runtime code injection. As such it is\npossible for somebody to abuse this for malware and\nother nefarious purposes. Please take note to what you\ninstall, and only install from trusted sources!!!\n--------------------------------------------------------\n'
printf 'Do you understand and accept the above risks with Parasite?[Y/n]'
read ans
case "$ans" in
y|Y);;
*) exit;;
esac
}
for DIR in "${DIRS[@]}"; do
mkdir -p $DIR
done
cd ${DIRS[0]}
select choice in 'Install Parasite' 'Update Parasite' 'Uninstall Parasite' 'Exit'
do
case $REPLY in
1)
if [[ ! -e ${DIRS[3]}/.accepted ]]; then
funcNotices
fi
funcTestInstall 1
printf 'Installing Parasite...\n'
funcDownload
funcMoveFiles
funcSetPerms
funcKext 1
printf 'Parasite successfully installed!\n'
touch ${DIRS[3]}/.accepted
funcRemoveTemp
;;
2)
funcTestInstall
printf 'Updating Parasite...\n'
funcKext
funcRemoveFiles
funcDownload
funcMoveFiles
funcSetPerms
funcKext 1
printf 'Parasite updated!\n'
funcRemoveTemp
;;
3)
funcTestInstall
printf 'Uninstalling Parasite...\n'
funcKext
funcRemoveFiles
funcRemoveDirs
printf 'Parasite has been uninstalled.\nSorry to see you go :(\n'
;;
4)
printf '\nExiting...\n\n'
;;
esac
break
done