From 155add4d398ae8a4a610d78b8284a0ccd3eb86cf Mon Sep 17 00:00:00 2001 From: Julien Voisin Date: Tue, 24 Mar 2015 10:59:18 +0100 Subject: Add a script to run the thingy --- phpmalwarefinder | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 phpmalwarefinder diff --git a/phpmalwarefinder b/phpmalwarefinder new file mode 100755 index 0000000..66cdb92 --- /dev/null +++ b/phpmalwarefinder @@ -0,0 +1,54 @@ +#!/bin/bash + +YARA=$(which yara) +CONFIG_PATH='/etc/phpmalwarefinder/malwares.yara' + +show_help() { + cat << EOF +Usage ${0##*/} [-dhw] + -c Optional path to a configuration file + -f Fast mode + -h Show this help message + -v Verbose mode +EOF +} + +OPTIND=1 +while getopts "c:fhv" opt; do + case "$opt" in + h) + show_help + exit 0 + ;; + f) + OPTS="${OPTS} -f" + ;; + c) + CONFIG_PATH=${OPTARG} + ;; + v) + OPTS="${OPTS} -s" + ;; + '?') + show_help + exit 1 + ;; + esac +done +shift "$((OPTIND-1))" + +if [ ! -e ${YARA} ] +then + echo "Can't find yara. Did you installed it?" + exit 1 +fi + +if [ ! -e ${CONFIG_PATH} ] +then + echo "${CONFIG_PATH} doesn't exist. Please give me a valid file." + exit 1 +fi + +OPTS="${OPTS} -r ${CONFIG_PATH}" + +$YARA $OPTS $@ \ No newline at end of file -- cgit v1.3