Last active
November 26, 2022 15:42
-
-
Save pyguerder/5abe6fed495954615599 to your computer and use it in GitHub Desktop.
A script to run WPScan periodically on a list of websites
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DATABASE_PATH="data/plugins.json" | |
SYMBOL="[!]" | |
TMPFILE="output.tmp" | |
declare -A WEBSITES | |
# List your WordPress websites here | |
WEBSITES['www.website1.dom']='[email protected],[email protected]' | |
WEBSITES['www.website2.dom']='[email protected],[email protected]' | |
# Run an update and compare sha1sum before and after | |
sha1_before=$(sha1sum 2>&1 $DATABASE_PATH | awk '{print $1}') | |
./wpscan.rb --update > $TMPFILE | |
sha1_after=$(sha1sum $DATABASE_PATH 2>&1 | awk '{print $1}') | |
if [ $sha1_before = $sha1_after ] ; then | |
echo "Vulnerabilities database has not changed. Exiting." | |
exit | |
else | |
echo "Vulnerabilities database has changed. Will test websites." | |
fi | |
for URL in "${!WEBSITES[@]}" | |
do | |
EMAIL=${WEBSITES[$URL]} | |
./wpscan.rb -r --no-color --batch --url $URL > $TMPFILE | |
if grep -q $SYMBOL $TMPFILE | |
then | |
echo "$URL is vulnerable! Emailing $EMAIL" | |
mail -s "$URL is vulnerable" $EMAIL < $TMPFILE | |
else | |
echo "$URL is OK" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Helllo,
I think your script would not work with WPScan v3 because of the WPScan.rb executable, I think it would be something like
/usr/local/bin/wpscan
or/usr/local/rvm/gems/default/wrappers/wpscan
with RVM.If you like something a bit more advanced and up to date, you can install WPWatcher : a Python wrapper for WPScan that manages scans on multiple sites and reports by email.