diff options
| -rwxr-xr-x | phpmalwarefinder | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/phpmalwarefinder b/phpmalwarefinder index 0a85d85..15354d4 100755 --- a/phpmalwarefinder +++ b/phpmalwarefinder | |||
| @@ -2,15 +2,29 @@ | |||
| 2 | 2 | ||
| 3 | YARA=$(which yara) | 3 | YARA=$(which yara) |
| 4 | CONFIG_PATH='/etc/phpmalwarefinder/malwares.yara' | 4 | CONFIG_PATH='/etc/phpmalwarefinder/malwares.yara' |
| 5 | IONICE_BIN=$(which ionice) | ||
| 6 | NICE_BIN=$(which nice) | ||
| 5 | 7 | ||
| 6 | if [ ! -f "$YARA" ] | 8 | if [ ! -f "$YARA" ] |
| 7 | then | 9 | then |
| 8 | YARA='./yara' | 10 | YARA='./yara' |
| 9 | fi | 11 | fi |
| 10 | 12 | ||
| 11 | if [ ! -f "$CONFIG_PATH" ] | 13 | if [ ! -f "$CONFIG_PATH" ] |
| 12 | then | 14 | then |
| 13 | CONFIG_PATH='./malwares.yara' | 15 | CONFIG_PATH='./malwares.yara' |
| 16 | fi | ||
| 17 | |||
| 18 | if [ -f "${IONICE_BIN}" ] | ||
| 19 | then | ||
| 20 | NICE=${IONICE_BIN} | ||
| 21 | NICE_OPTS="-c 3" | ||
| 22 | else | ||
| 23 | if [ -f "${NICE_BIN}" ] | ||
| 24 | then | ||
| 25 | NICE=${NICE_BIN} | ||
| 26 | NICE_OPTS="-n 20" | ||
| 27 | fi | ||
| 14 | fi | 28 | fi |
| 15 | 29 | ||
| 16 | show_help() { | 30 | show_help() { |
| @@ -59,12 +73,19 @@ then | |||
| 59 | exit 1 | 73 | exit 1 |
| 60 | fi | 74 | fi |
| 61 | 75 | ||
| 76 | if [ ! -e ${NICE} ] | ||
| 77 | then | ||
| 78 | echo "no nice programe available. PLease install ionice or nice." | ||
| 79 | exit 1 | ||
| 80 | fi | ||
| 81 | |||
| 62 | if [ -z $@ ] | 82 | if [ -z $@ ] |
| 63 | then | 83 | then |
| 64 | show_help | 84 | show_help |
| 65 | exit 1 | 85 | exit 1 |
| 66 | fi | 86 | fi |
| 67 | 87 | ||
| 68 | OPTS="${OPTS} -r ${CONFIG_PATH}" | 88 | OPTS="${OPTS} -r ${CONFIG_PATH}" |
| 69 | 89 | ||
| 70 | ionice -c3 $YARA $OPTS $@ | 90 | ${NICE} ${NICE_OPTS} $YARA $OPTS $@ |
| 91 | |||
