-
Notifications
You must be signed in to change notification settings - Fork 1
/
satan2.sh
311 lines (250 loc) · 8.4 KB
/
satan2.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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
#!/usr/bin/env bash
#: satan2.sh
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
error=77
success=0
Check_AdminRights()
{
uid_root=0
if [ "$UID" -ne "$uid_root" ]
then
echo "${red}Error, please run the script with sudo.${reset}"
exit $error
elif [ "$UID" -eq "$uid_root" ]
then
main
else
echo
echo "${red}An unexpected error was caused.${reset}"
exit $error
fi
}
Ask_Yes_Or_No()
{
read -p "Are you sure you want to continue (nN/yY): " answer
case $answer in
[Yy]* ) ;;
[Nn]* ) echo;echo "Good luck to you.";exit$success;;
* ) echo "${red}A choice is required.${reset}";echo;Ask_Yes_Or_No
esac
}
Check_agreement()
{
Get_Banner
echo "${red}This product is designed for legal purposes only.
Any use of this product outside of a legal framework is strictly prohibited.
This product is intended for use by law enforcement, security professionals, and licensed individuals only.
By using this product, you agree to abide by all local, state, and federal laws.${reset}";echo
Ask_Yes_Or_No
}
Check_dependencies()
{
satan2dir=/mnt/satan2
clear
echo "Check dependencies..."
if command -v zuluCrypt-cli>/dev/null 2>&1;then
echo "${green}zuluCrypt-cli found.${reset}"
else
echo "${red}Error, missing dependencies.${reset}"
echo "${red}zuluCrypt-cli not found.${reset}"
exit $error
fi
if command -v cryptsetup>/dev/null 2>&1;then
echo "${green}cryptsetup found.${reset}"
else
echo "${red}Error, missing dependencies.${reset}"
echo "${red}cryptsetup not found.${reset}"
exit $error
fi
echo;echo
}
Get_Banner()
{
cat << "EOF"
,-.
___,---.__ /'|`\ __,---,___
,-' \` `-.____,-' | `-.____,-' // `-.
,' | ~'\ /`~ | `.
/ ___// `. ,' , , \___ \
| ,-' `-.__ _ | , __,-' `-. |
| / /\_ ` . | , _/\ \ |
\ | \ \`-.___ \ | / ___,-'/ / | /
\ \ | `._ `\\ | //' _,' | / /
`-.\ /' _ `---'' , . ``---' _ `\ /,-'
`` / \ ,='/ \`=. / \ ''
|__ /|\_,--.,-.--,--._/|\ __|
/ `./ \\`\ | | | /,//' \,' \
/ / ||--+--|--+-/-| \ \
| | /'\_\_\ | /_/_/`\ | |
\ \__, \_ `~' _/ .__/ /
`-._,-' `-._______,-' `-._,-'
__ ___ _____ ___ __ __ 2
(( ||=|| || ||=|| ||\\||
\_)) || || || || || || \||
EOF
echo;echo
}
main()
{
clear
Check_agreement
Check_dependencies
Get_Banner
echo "List of disks: ";echo"";lsblk -d|tail -n+2|awk '{print $1" "$4}'|nl -v 0 -w2 -s'> ';echo "";read -p "Your choice: " userchoice
disks=( $(lsblk -d|tail -n+2|awk '{print $1}') )
echo "${green}${disks[userchoice]} ${reset}selected."
echo;Ask_Yes_Or_No
echo;echo "Disk unmounting."
sudo umount /dev/${disks[userchoice]}
echo;echo "Disk formating."
sudo mkfs -t ext4 /dev/${disks[userchoice]} <<<y
if [[ ! -e $satan2dir ]]; then
echo "SATAN2 file not detected, creation."
sudo mkdir -p $satan2dir
else
echo "SATAN2 file detected, regeneration."
sudo rm -Rf $satan2dir
sudo mkdir -p $satan2dir
fi
echo;echo "Disk mounting."
sudo mount /dev/${disks[userchoice]} $satan2dir
echo;echo "Overwriting of data."
dd if=/dev/urandom of=/dev/${disks[userchoice]} bs=4096 status=progress
shred -n 2 -z -v /dev/${disks[userchoice]}
passwd="$(openssl rand -base64 42 | tr -dc 'a-zA-Z0-9!@#$%^&*()_+-=')"
passwd="$(echo $passwd|rev)"
rand=$[($RANDOM%10)+1]
passwd="$(echo $passwd|cut -c ${rand}-)"
passwd2="$(echo $passwd|base64)"
passwd2="$(echo $passwd2|rev)"
rand=$[($RANDOM%32)+1]
passwd2="$(echo $passwd2|cut -c ${rand}-)"
passwd=$passwd2$passwd
passwd="$(echo $passwd|rev)"
rand=$[($RANDOM%10)+1]
passwd="$(echo $passwd|cut -c ${rand}-)"
echo;echo "Disk unmounting."
sudo umount $disk /dev/${disks[userchoice]}
echo;echo "Encryption of the hard disk (SERPENT(TWOFISH(AES)))."
sudo zuluCrypt-cli -c -d /dev/${disks[userchoice]} -z ext4 -t tcrypt -g "/dev/urandom.serpent:twofish:aes.xts-plain64.256.whirlpool" -p $passwd -f ./satan2.sh -k
echo;echo "Disk formating."
sudo mkfs -t ext4 /dev/${disks[userchoice]} <<<y
if [[ ! -e $satan2dir ]]; then
sudo mkdir -p $satan2dir
else
sudo rm -Rf $satan2dir
sudo mkdir -p $satan2dir
fi
echo;echo "Disk mounting."
sudo mount /dev/${disks[userchoice]} $satan2dir
echo;echo "Overwriting of data."
dd if=/dev/urandom of=/dev/${disks[userchoice]} bs=4096 status=progress
shred -n 3 -z -v /dev/${disks[userchoice]}
passwd="$(openssl rand -base64 42 | tr -dc 'a-zA-Z0-9!@#$%^&*()_+-=')"
passwd="$(echo $passwd|rev)"
rand=$[($RANDOM%10)+1]
passwd="$(echo $passwd|cut -c ${rand}-)"
passwd2="$(echo $passwd|base64)"
passwd2="$(echo $passwd2|rev)"
rand=$[($RANDOM%32)+1]
passwd2="$(echo $passwd2|cut -c ${rand}-)"
passwd=$passwd2$passwd
passwd="$(echo $passwd|rev)"
rand=$[($RANDOM%10)+1]
passwd="$(echo $passwd|cut -c ${rand}-)"
echo;echo "Disk unmounting."
sudo umount $disk /dev/${disks[userchoice]}
echo;echo "Generation of a keyfile."
SIZE=2048
OUTFILE=./satan2.key
dd if=/dev/urandom of=$OUTFILE bs=$SIZE count=1048576
echo;echo "Encryption of the hard disk."
sudo zuluCrypt-cli -c -d /dev/${disks[userchoice]} -z ext4 -t luks -p $passwd -f $OUTFILE -k
echo;echo "Disk formating."
sudo mkfs -t ext4 /dev/${disks[userchoice]} <<<y
if [[ ! -e $satan2dir ]]; then
sudo mkdir -p $satan2dir
else
sudo rm -Rf $satan2dir
sudo mkdir -p $satan2dir
fi
echo;echo "Disk mounting."
sudo mount /dev/${disks[userchoice]} $satan2dir
echo;echo "Overwriting of data."
dd if=/dev/urandom of=/dev/${disks[userchoice]} bs=4096 status=progress
shred -n 2 -z -v /dev/${disks[userchoice]}
echo;echo "Disk unmounting."
sudo umount $disk /dev/${disks[userchoice]}
echo;echo "Generation of a keyfile."
SIZE=2048
OUTFILE=sarmat.bin
dd if=/dev/urandom of=$OUTFILE bs=$SIZE count=2097152
passwd="$(openssl rand -base64 42 | tr -dc 'a-zA-Z0-9!@#$%^&*()_+-=')"
passwd="$(echo $passwd|rev)"
rand=$[($RANDOM%10)+1]
passwd="$(echo $passwd|cut -c ${rand}-)"
passwd2="$(echo $passwd|base64)"
passwd2="$(echo $passwd2|rev)"
rand=$[($RANDOM%32)+1]
passwd2="$(echo $passwd2|cut -c ${rand}-)"
passwd=$passwd2$passwd
passwd="$(echo $passwd|rev)"
rand=$[($RANDOM%10)+1]
passwd="$(echo $passwd|cut -c ${rand}-)"
echo;echo "Encryption of the used keyfile."
sudo zuluCrypt-cli -c -d ./satan2.key -z ext4 -t luks -p $passwd -f $OUTFILE -k
echo;echo "Overwrite the used keyfile."
shred -n 8 -z -v ./satan2.key
echo;echo "Disk unmounting."
sudo umount /dev/${disks[userchoice]}
echo;echo "Disk formating."
sudo mkfs -t ext4 /dev/${disks[userchoice]} <<<y
if [[ ! -e $satan2dir ]]; then
sudo mkdir -p $satan2dir
else
sudo rm -Rf $satan2dir
sudo mkdir -p $satan2dir
fi
echo;echo "Disk mounting."
sudo mount /dev/${disks[userchoice]} $satan2dir
echo;echo "Overwriting of data."
dd if=/dev/urandom of=/dev/${disks[userchoice]} bs=4096 status=progress
shred -n 2 -z -v /dev/${disks[userchoice]}
passwd="$(openssl rand -base64 42 | tr -dc 'a-zA-Z0-9!@#$%^&*()_+-=')"
passwd="$(echo $passwd|rev)"
rand=$[($RANDOM%10)+1]
passwd="$(echo $passwd|cut -c ${rand}-)"
passwd2="$(echo $passwd|base64)"
passwd2="$(echo $passwd2|rev)"
rand=$[($RANDOM%32)+1]
passwd2="$(echo $passwd2|cut -c ${rand}-)"
passwd=$passwd2$passwd
passwd="$(echo $passwd|rev)"
rand=$[($RANDOM%10)+1]
passwd="$(echo $passwd|cut -c ${rand}-)"
echo;echo "Disk unmounting."
sudo umount $disk /dev/${disks[userchoice]}
echo;echo "Encryption of the hard disk using cryptsetup."
echo $passwd|sudo cryptsetup -y -v luksFormat /dev/${disks[userchoice]}
passwd="$(echo $passwd|rev)"
echo $passwd|sudo cryptsetup -y -v luksFormat /dev/${disks[userchoice]}
echo;echo "Disk formating."
sudo mkfs -t ext4 /dev/${disks[userchoice]} <<<y
if [[ ! -e $satan2dir ]]; then
sudo mkdir -p $satan2dir
else
sudo rm -Rf $satan2dir
sudo mkdir -p $satan2dir
fi
echo;echo "Disk mounting."
sudo mount /dev/${disks[userchoice]} $satan2dir
echo;echo "Overwriting of data."
dd if=/dev/urandom of=/dev/${disks[userchoice]} bs=4096 status=progress
shred -n 2 -z -v /dev/${disks[userchoice]}
echo;echo "Disk unmounting."
sudo umount /dev/${disks[userchoice]}
exit $success
}
Check_AdminRights