summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien (jvoisin) Voisin2016-02-24 17:29:00 +0100
committerJulien (jvoisin) Voisin2016-02-24 17:29:00 +0100
commit5d7838f2b779a0369fd8c98c1abd1a6299d6dfc7 (patch)
treee3c86ecc72d57df3a2f05cee18b47c251d5ec2af
parentf9aa99e430bc6eff893fe7abedcd47866d0f7fa8 (diff)
Fix some smelly code
Thanks to http://www.shellcheck.net
-rwxr-xr-xphp-malware-finder/phpmalwarefinder14
1 files changed, 7 insertions, 7 deletions
diff --git a/php-malware-finder/phpmalwarefinder b/php-malware-finder/phpmalwarefinder
index 99d9033..acad8a7 100755
--- a/php-malware-finder/phpmalwarefinder
+++ b/php-malware-finder/phpmalwarefinder
@@ -31,13 +31,13 @@ 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 -iname '*.ph*' -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 read lines words chars name <<< $(wc "$file") 35 read -r lines _ chars _ <<< $(wc "$file")
36 36
37 if [ "$lines" -le "2" ]; then 37 if [ "$lines" -le "2" ]; then
38 # humm, 2 lines long file ? 38 # humm, 2 lines long file ?
39 if [ "$chars" -ge "300" ]; then 39 if [ "$chars" -ge "300" ]; then
40 echo TooShort $file 40 echo "TooShort $file"
41 fi; 41 fi;
42 fi; 42 fi;
43 done; 43 done;
@@ -88,7 +88,7 @@ then
88 exit 1 88 exit 1
89fi 89fi
90 90
91if [ ! -e ${CONFIG_PATH} ] 91if [ ! -e "${CONFIG_PATH}" ]
92then 92then
93 echo "${CONFIG_PATH} doesn't exist. Please give me a valid file." 93 echo "${CONFIG_PATH} doesn't exist. Please give me a valid file."
94 exit 1 94 exit 1
@@ -100,7 +100,7 @@ then
100 exit 1 100 exit 1
101fi 101fi
102 102
103if [ ! -e ${NICE} ] 103if [ ! -e "${NICE}" ]
104then 104then
105 echo "No nice program available. Please install ionice or nice." 105 echo "No nice program available. Please install ionice or nice."
106 exit 1 106 exit 1
@@ -108,6 +108,6 @@ fi
108 108
109OPTS="${OPTS} -r ${CONFIG_PATH}" 109OPTS="${OPTS} -r ${CONFIG_PATH}"
110 110
111one_line_trick $@ 111one_line_trick "$@"
112 112
113${NICE} ${NICE_OPTS} $YARA $OPTS $@ 113${NICE} ${NICE_OPTS} $YARA $OPTS "$@"