summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshaddai2016-02-15 15:16:27 +0100
committershaddai2016-02-15 15:16:27 +0100
commita2b70e76b1238f19bcd5d39a681d128733146846 (patch)
tree4e2af0bfbf179ec4dc6b28cb4decbee48efd4345
parent291a93a623ca1895f5fec010dba75783bfa1fb5d (diff)
Reduce FP triggered by the TooShort rule
The TooShort rule is now used against *.ph* files in order to reduce the number of false positives triggered by pictures and JS files. Using the wc command ionly once should reduce I/O load too.
-rwxr-xr-xphp-malware-finder/phpmalwarefinder11
1 files changed, 5 insertions, 6 deletions
diff --git a/php-malware-finder/phpmalwarefinder b/php-malware-finder/phpmalwarefinder
index 98c578d..99d9033 100755
--- a/php-malware-finder/phpmalwarefinder
+++ b/php-malware-finder/phpmalwarefinder
@@ -31,13 +31,12 @@ fi
31# before starting yara, check if the file 31# before starting yara, check if the file
32one_line_trick() { 32one_line_trick() {
33 33
34 find $@ -type f -print0 | while IFS= read -r -d '' -r file; do 34 find $@ -type f -iname '*.ph*' -print0 | while IFS= read -r -d '' -r file; do
35 line_num=$(wc -l "$file" | cut -d' ' -f1) 35 read lines words chars name <<< $(wc "$file")
36 char_num=$(wc -c "$file" | cut -d' ' -f1) 36
37 37 if [ "$lines" -le "2" ]; then
38 if [ "$line_num" -le "2" ]; then
39 # humm, 2 lines long file ? 38 # humm, 2 lines long file ?
40 if [ "$char_num" -ge "300" ]; then 39 if [ "$chars" -ge "300" ]; then
41 echo TooShort $file 40 echo TooShort $file
42 fi; 41 fi;
43 fi; 42 fi;