wordpress_vuln_checker/check_wp_vuln.sh

62 lines
1.1 KiB
Bash
Executable file

#!/usr/bin/env bash
# query wpvuln db for vulnerabilities
function plugin {
curl -H "Authorization: Token token=$WPSCANDB_API_TOKEN" https://wpscan.com/api/v3/plugins/$1 2> /dev/null | \
python -m json.tool
}
function theme {
curl -H "Authorization: Token token=$WPSCANDB_API_TOKEN" https://wpscan.com/api/v3/themes/$1 2> /dev/null | \
python -m json.tool
}
function all {
curl -H "Authorization: Token token=$WPSCANDB_API_TOKEN" https://wpscan.com/api/v3/wordpresses/$1 2> /dev/null | \
python -m json.tool
}
function usage {
echo "Usage: $(basename $0) <options> <plugin/theme/wpversion>"
echo "options:"
echo " --help display this help page"
echo " --plugin query api for a specific plugin"
echo " --theme query api for specific theme"
echo " --all retrieve all vulnerabilities in a specific wp version number"
}
if [ -z $1 ]; then
usage
exit
elif [ $# -gt 2 ]; then
echo "too many arguments"
echo " "
usage
exit
fi
case "$1" in
'--help')
usage
;;
'--plugin')
plugin $2
;;
'--theme')
theme $2
;;
'--all')
all $2
;;
esac