forked from Vivek170952/Lincheck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinprivcheck.sh
148 lines (109 loc) · 3.64 KB
/
linprivcheck.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
#!/bin/bash
RED="\e[1;31m"
GREEN="\e[1;32m"
ENDCOLOR="\e[0m"
echo -e " _ _ _ _ "
echo -e "| | (_)_ __ ___| |__ ___ ___| | __"
echo -e "| | | | '_ \ / __| '_ \ / _ \/ __| |/ /"
echo -e "| |___| | | | | (__| | | | __/ (__| < "
echo -e "|_____|_|_| |_|\___|_| |_|\___|\___|_|\_\\\\"
echo
echo -e "${RED}[+] Running SUID commands...${ENDCOLOR}"
echo
echo -e "[*] Running this command : ${GREEN}find / -perm -4000 2>/dev/null${ENDCOLOR}"
echo
find / -perm -4000 2>/dev/null | while read line; do echo -e "$line"; done
echo
echo "========================================================================"
echo
echo -e " [*] Running this command : ${GREEN}find / -perm -u=s -type f 2>/dev/null${ENDCOLOR}"
echo
find / -perm -u=s -type f 2>/dev/null | while read line; do echo -e "$line"; done
echo
echo "========================================================================"
echo
echo -e " [*] Running this command : ${GREEN}find / -perm -4000 2>/dev/null${ENDCOLOR}"
echo
find / -perm -4000 2>/dev/null | while read line; do echo -e "$line"; done
echo
echo "========================================================================"
echo -e " [*] Running this command : ${GREEN}getcap -r / 2>/dev/null${ENDCOLOR} "
echo
getcap -r / 2>/dev/null | while read line; do echo -e "$line"; done
echo
echo "========================================================================"
echo
echo -e "${RED}[+] Checking for writable files...${ENDCOLOR}"
passwd=`ls -la /etc/passwd`
shadow=`ls -la /etc/shadow`
sudoers=`ls -la /etc/sudoers`
for i in "$passwd" "$shadow" "$sudoers"
do
echo -e "$i"
done
echo
echo "========================================================================"
echo
echo -e "${RED}[+] Checking system version...${ENDCOLOR}"
echo
echo -e "[*] Running this command : ${GREEN}cat /etc/issue${ENDCOLOR}"
echo
cat /etc/issue 2> /dev/null
echo
echo -e "[*] Running this command : ${GREEN}cat /etc/*-release${ENDCOLOR}"
echo
cat /etc/*-release 2> /dev/null
echo
echo -e "[*] Running this command : ${GREEN}cat /etc/lsb-release${ENDCOLOR}"
echo
cat /etc/lsb-release 2> /dev/null
echo
echo -e "[*] Running this command : ${GREEN}cat /etc/redhat-release${ENDCOLOR}"
echo
cat /etc/redhat-release 2> /dev/null
echo
echo "========================================================================"
echo
echo -e "${RED}[+] Checking kernal version...${ENDCOLOR}"
echo
echo -e "[*]Running this command : ${GREEN}cat /proc/version${ENDCOLOR}"
echo
cat /proc/version 2> /dev/null
echo
echo -e "[*] Running this command : ${GREEN}uname -a${ENDCOLOR}"
echo
uname -a 2> /dev/null
echo
echo -e "[*]Running this command : ${GREEN}uname -mrs${ENDCOLOR}"
echo
uname -mrs 2> /dev/null
echo
echo -e "[*] Running this command : ${GREEN}ls /boot | grep vmlinuz${ENDCOLOR}"
echo
ls /boot | grep vmlinuz 2> /dev/null
echo
echo "========================================================================"
echo
echo -e "${RED}[+] Checking for cronatabs... (If nothing found run pspy)${ENDCOLOR}"
echo
echo -e "[*] Running this command : ${GREEN}crontab -l${ENDCOLOR}"
echo
crontab -l 2> /dev/null
echo
echo -e "[*] Running this command : ${GREEN}ls -al /etc/ | grep cron${ENDCOLOR}"
echo
ls -al /etc/ | grep cron 2> /dev/null
echo
echo -e "[*] Running this command : ${GREEN}ls -al /etc/ | grep cron${ENDCOLOR}"
echo
ls -al /etc/ | grep cron 2> /dev/null
echo
echo -e "[*] Running this command : ${GREEN}cat /etc/crontab${ENDCOLOR}"
echo
cat /etc/crontab 2> /dev/null
echo
echo -e "[*] Running this command : ${GREEN}cat /etc/anacrontab${ENDCOLOR}"
echo
cat /etc/anacrontab 2> /dev/null
echo
echo "====================== END ======================="