forked from rafket/pam_duress
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdecoyscripts.sh
More file actions
executable file
·22 lines (20 loc) · 845 Bytes
/
decoyscripts.sh
File metadata and controls
executable file
·22 lines (20 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This action must be run as root" 1>&2
exit 1
elif [ $# -ne 1 ]
then
echo -e "Usage: decoyscripts.sh numberOfEntries\n Creates a number of random user-password combinations along with random encrypted actions seemingly generated by the adduser program\n numberOfEntries: The number of decoy username-password-action combinations to be generated";
else
for i in `seq 1 $1`;
do
salt=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9./' | fold -w 16 | head -n 1)
hash=$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 64 | head -n 1)
echo $salt:$hash >> /usr/share/duress/hashes
size=$RANDOM
let "size %= 10240"
size+=16
openssl rand -out /usr/share/duress/actions/$hash -rand /dev/urandom $size
sed -i "1s/^/Salted__/" /usr/share/duress/actions/$hash
done
fi