diff options
| author | Julien (jvoisin) Voisin | 2016-02-24 17:29:00 +0100 |
|---|---|---|
| committer | Julien (jvoisin) Voisin | 2016-02-24 17:29:00 +0100 |
| commit | 5d7838f2b779a0369fd8c98c1abd1a6299d6dfc7 (patch) | |
| tree | e3c86ecc72d57df3a2f05cee18b47c251d5ec2af | |
| parent | f9aa99e430bc6eff893fe7abedcd47866d0f7fa8 (diff) | |
Fix some smelly code
Thanks to http://www.shellcheck.net
| -rwxr-xr-x | php-malware-finder/phpmalwarefinder | 14 |
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 |
| 32 | one_line_trick() { | 32 | one_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 |
| 89 | fi | 89 | fi |
| 90 | 90 | ||
| 91 | if [ ! -e ${CONFIG_PATH} ] | 91 | if [ ! -e "${CONFIG_PATH}" ] |
| 92 | then | 92 | then |
| 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 |
| 101 | fi | 101 | fi |
| 102 | 102 | ||
| 103 | if [ ! -e ${NICE} ] | 103 | if [ ! -e "${NICE}" ] |
| 104 | then | 104 | then |
| 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 | ||
| 109 | OPTS="${OPTS} -r ${CONFIG_PATH}" | 109 | OPTS="${OPTS} -r ${CONFIG_PATH}" |
| 110 | 110 | ||
| 111 | one_line_trick $@ | 111 | one_line_trick "$@" |
| 112 | 112 | ||
| 113 | ${NICE} ${NICE_OPTS} $YARA $OPTS $@ | 113 | ${NICE} ${NICE_OPTS} $YARA $OPTS "$@" |
