summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorblotus2015-07-17 13:13:12 +0200
committerblotus2015-07-17 13:13:12 +0200
commiteb3523a2e71f818b03db160b85c6dbd3b5cc271c (patch)
tree858e2c445f693da4cdfc21e8963b47f0af06d3b9
parentc634f714bc82b46db84c700354841c0b5810a962 (diff)
parent7af3ba89aa11eee89e6b22a9db43074c4c1bd12b (diff)
Merge pull request #4 from ahpnils/ahpnils-patch-1
added usage of nice when ionice is not available
-rwxr-xr-xphpmalwarefinder22
1 files changed, 21 insertions, 1 deletions
diff --git a/phpmalwarefinder b/phpmalwarefinder
index 0a85d85..1fbe4cf 100755
--- a/phpmalwarefinder
+++ b/phpmalwarefinder
@@ -2,6 +2,8 @@
2 2
3YARA=$(which yara) 3YARA=$(which yara)
4CONFIG_PATH='/etc/phpmalwarefinder/malwares.yara' 4CONFIG_PATH='/etc/phpmalwarefinder/malwares.yara'
5IONICE_BIN=$(which ionice)
6NICE_BIN=$(which nice)
5 7
6if [ ! -f "$YARA" ] 8if [ ! -f "$YARA" ]
7then 9then
@@ -13,6 +15,18 @@ then
13 CONFIG_PATH='./malwares.yara' 15 CONFIG_PATH='./malwares.yara'
14fi 16fi
15 17
18if [ -f "${IONICE_BIN}" ]
19then
20 NICE=${IONICE_BIN}
21 NICE_OPTS="-c 3"
22else
23 if [ -f "${NICE_BIN}" ]
24 then
25 NICE=${NICE_BIN}
26 NICE_OPTS="-n 20"
27 fi
28fi
29
16show_help() { 30show_help() {
17 cat << EOF 31 cat << EOF
18Usage ${0##*/} [-cfhw] <file|folder> ... 32Usage ${0##*/} [-cfhw] <file|folder> ...
@@ -65,6 +79,12 @@ then
65 exit 1 79 exit 1
66fi 80fi
67 81
82if [ ! -e ${NICE} ]
83then
84 echo "no nice program available. Please install ionice or nice."
85 exit 1
86fi
87
68OPTS="${OPTS} -r ${CONFIG_PATH}" 88OPTS="${OPTS} -r ${CONFIG_PATH}"
69 89
70ionice -c3 $YARA $OPTS $@ 90${NICE} ${NICE_OPTS} $YARA $OPTS $@