diff options
Diffstat (limited to 'phpmalwarefinder')
| -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 | ||
