/
update_convert_cms_explorer_dicts.sh
executable file
·85 lines (75 loc) · 3.95 KB
/
update_convert_cms_explorer_dicts.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
#!/usr/bin/env sh
# Description: This script grabs all the excellent CMS Explorer dictionaries, updates them and converts them into DirBuster format (much faster than CMS Explorer)
#
# owtf is an OWASP+PTES-focused try to unite great tools and facilitate pen testing
# Copyright (c) 2011, Abraham Aranguren <name.surname@gmail.com> Twitter: @7a_ http://7-a.org
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the copyright owner nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
RootDir=$1
wget http://cms-explorer.googlecode.com/files/cms-explorer-1.0.tar.bz2; bunzip2 *; tar xvf *; rm -f *.tar 2> /dev/null
CMS_EXPLORER_DIR="$RootDir/tools/restricted/cms-explorer/cms-explorer-1.0"
CMS_DICTIONARIES_DIR="$RootDir/dictionaries/restricted/cms"
mkdir -p $CMS_DICTIONARIES_DIR
DICTIONARIES="$CMS_EXPLORER_DIR/drupal_plugins.txt
$CMS_EXPLORER_DIR/joomla_themes.txt
$CMS_EXPLORER_DIR/wp_plugins.txt
$CMS_EXPLORER_DIR/drupal_themes.txt
$CMS_EXPLORER_DIR/wp_themes.txt
$CMS_EXPLORER_DIR/joomla_plugins.txt"
echo "[*] Going into directory: $CMS_EXPLORER_DIR"
cd $CMS_EXPLORER_DIR
echo "[*] Updating cms-explorer.pl dictionaries.."
./cms-explorer.pl -update
# leaving the directory in order to copy the lists from dict_root
cd ../../
echo "[*] Copying updated dictionaries from $CMS_EXPLORER_DIR to $CMS_DICTIONARIES_DIR"
for i in $(echo $DICTIONARIES); do
cp $i $CMS_DICTIONARIES_DIR # echo "[*] Copying $i .."
done
cd $CMS_DICTIONARIES_DIR
DIRBUSTER_PREFIX="dir_buster"
for cms in $(echo "drupal joomla wp"); do
mkdir -p $cms # Create CMS specific directory
rm -f $cms/* # Remove previous dictionaries
mv $cms* $cms 2> /dev/null # Move relevant dictionaries to directory, getting rid of "cannot move to myself" error, which is ok
cd $cms # Enter directory
for dict in $(ls); do # Now process each CMS-specific dictionary and convert it
cat $dict | tr '/' "\n" | sort -u > $DIRBUSTER_PREFIX.$dict # Convert to DirBuster format (i.e. get rid of the "/" and duplicate parent directories)
rm -f $dict # Remove since this only works with CMS explorer
done
# Create all-in-one CMS-specific dictionaries:
cat $DIRBUSTER_PREFIX* > $DIRBUSTER_PREFIX.all.$cms.txt
cd ..
done
echo "[*] Creating all-in-one CMS dictionaries for DirBuster and CMS Explorer"
for bruteforcer in $(echo "$DIRBUSTER_PREFIX"); do
ALLINONE_DICT="$bruteforcer.all_in_one.txt"
rm -f $ALLINONE_DICT # Remove previous, potentially outdated all-in-one dict
for all_dict in $(find . -name *all*.txt | grep $bruteforcer); do
cat $all_dict >> $ALLINONE_DICT
done
cat $ALLINONE_DICT | sort -u > $ALLINONE_DICT.tmp # Remove duplicates, just in case
mv $ALLINONE_DICT.tmp $ALLINONE_DICT
done