summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xphpmalwarefinder54
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
3YARA=$(which yara)
4CONFIG_PATH='/etc/phpmalwarefinder/malwares.yara'
5
6show_help() {
7 cat << EOF
8Usage ${0##*/} [-dhw]
9 -c Optional path to a configuration file
10 -f Fast mode
11 -h Show this help message
12 -v Verbose mode
13EOF
14}
15
16OPTIND=1
17while 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
37done
38shift "$((OPTIND-1))"
39
40if [ ! -e ${YARA} ]
41then
42 echo "Can't find yara. Did you installed it?"
43 exit 1
44fi
45
46if [ ! -e ${CONFIG_PATH} ]
47then
48 echo "${CONFIG_PATH} doesn't exist. Please give me a valid file."
49 exit 1
50fi
51
52OPTS="${OPTS} -r ${CONFIG_PATH}"
53
54$YARA $OPTS $@ \ No newline at end of file