diff options
| author | Julien Voisin | 2015-03-24 10:59:18 +0100 |
|---|---|---|
| committer | Julien Voisin | 2015-03-24 10:59:18 +0100 |
| commit | 155add4d398ae8a4a610d78b8284a0ccd3eb86cf (patch) | |
| tree | ed4cb52775c01d985cb077b4584673a8a8711d80 | |
| parent | a113aa63fa45497b6393ed3cc87f6f1ef35c8e6e (diff) | |
Add a script to run the thingy
| -rwxr-xr-x | phpmalwarefinder | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/phpmalwarefinder b/phpmalwarefinder new file mode 100755 index 0000000..66cdb92 --- /dev/null +++ b/phpmalwarefinder | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | YARA=$(which yara) | ||
| 4 | CONFIG_PATH='/etc/phpmalwarefinder/malwares.yara' | ||
| 5 | |||
| 6 | show_help() { | ||
| 7 | cat << EOF | ||
| 8 | Usage ${0##*/} [-dhw] | ||
| 9 | -c Optional path to a configuration file | ||
| 10 | -f Fast mode | ||
| 11 | -h Show this help message | ||
| 12 | -v Verbose mode | ||
| 13 | EOF | ||
| 14 | } | ||
| 15 | |||
| 16 | OPTIND=1 | ||
| 17 | while getopts "c:fhv" opt; do | ||
| 18 | case "$opt" in | ||
| 19 | h) | ||
| 20 | show_help | ||
| 21 | exit 0 | ||
| 22 | ;; | ||
| 23 | f) | ||
| 24 | OPTS="${OPTS} -f" | ||
| 25 | ;; | ||
| 26 | c) | ||
| 27 | CONFIG_PATH=${OPTARG} | ||
| 28 | ;; | ||
| 29 | v) | ||
| 30 | OPTS="${OPTS} -s" | ||
| 31 | ;; | ||
| 32 | '?') | ||
| 33 | show_help | ||
| 34 | exit 1 | ||
| 35 | ;; | ||
| 36 | esac | ||
| 37 | done | ||
| 38 | shift "$((OPTIND-1))" | ||
| 39 | |||
| 40 | if [ ! -e ${YARA} ] | ||
| 41 | then | ||
| 42 | echo "Can't find yara. Did you installed it?" | ||
| 43 | exit 1 | ||
| 44 | fi | ||
| 45 | |||
| 46 | if [ ! -e ${CONFIG_PATH} ] | ||
| 47 | then | ||
| 48 | echo "${CONFIG_PATH} doesn't exist. Please give me a valid file." | ||
| 49 | exit 1 | ||
| 50 | fi | ||
| 51 | |||
| 52 | OPTS="${OPTS} -r ${CONFIG_PATH}" | ||
| 53 | |||
| 54 | $YARA $OPTS $@ \ No newline at end of file | ||
