-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwp-wordlist.sh
68 lines (60 loc) · 1.89 KB
/
wp-wordlist.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
#!/bin/bash
# Color variables
RED="\e[31m"
GREEN="\e[32m"
ENDCOLOR="\e[0m"
# Help function
help() {
echo -e "${RED}Usage:${ENDCOLOR}"
echo -e "${GREEN}bash wp-wordlist.sh [option] [output_file]${ENDCOLOR}"
echo -e "${RED}Options:${ENDCOLOR}"
echo -e "${GREEN}-p, --plugin\tGenerate a wordlist of WordPress plugins${ENDCOLOR}"
echo -e "${GREEN}-t, --theme\tGenerate a wordlist of WordPress themes${ENDCOLOR}"
echo -e "${GREEN}-h, --help\tDisplay this help message${ENDCOLOR}"
}
# Generate WordPress wordlist
wp_wordlist() {
option="$1"
output_file="$2"
if [[ "$option" == "plugin" ]]; then
curl -s https://plugins.svn.wordpress.org/ | tail -n +5 | sed -e 's/<[^>]*>//g' -e 's/\///' -e 's/ \+//gp' | grep -v "Powered by Apache" | sort -u > "$output_file"
elif [[ "$option" == "theme" ]]; then
curl -s https://themes.svn.wordpress.org/ | tail -n +5 | sed -e 's/<[^>]*>//g' -e 's/\///' -e 's/ \+//gp' | grep -v "Powered by Apache" | sort -u > "$output_file"
else
echo -e "${RED}Invalid option.${ENDCOLOR}"
help
exit 1
fi
}
# Parse command-line arguments
if [ $# -eq 0 ]; then
help
exit 1
fi
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-p|--plugin)
output_file="$2"
wp_wordlist "plugin" "$output_file"
echo -e "${GREEN}WordPress plugin wordlist generated successfully in '$output_file'.${ENDCOLOR}"
exit 0
;;
-t|--theme)
output_file="$2"
wp_wordlist "theme" "$output_file"
echo -e "${GREEN}WordPress theme wordlist generated successfully in '$output_file'.${ENDCOLOR}"
exit 0
;;
-h|--help)
help
exit 0
;;
*)
echo -e "${RED}Invalid option.${ENDCOLOR}"
help
exit 1
;;
esac
shift
done