summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxarkes2016-04-21 11:37:43 +0200
committerjvoisin2016-04-21 11:37:43 +0200
commitb2fc542557d08570faa0dd077d07277c626ddc1b (patch)
tree5cc3fc94c16bc04c8127257f3109e41680af8b86
parentd3008b7639c24cf71a2b07b29b58b48533fdfa49 (diff)
Renaming .yara files to .yar (#24)
-rw-r--r--Makefile8
-rw-r--r--README.md8
-rw-r--r--debian/nbs-phpmalwarefinder.install8
-rw-r--r--php-malware-finder/asp.yar (renamed from php-malware-finder/asp.yara)4
-rw-r--r--php-malware-finder/bad_php.yar (renamed from php-malware-finder/bad_php.yara)0
-rw-r--r--php-malware-finder/common.yar (renamed from php-malware-finder/common.yara)0
-rw-r--r--php-malware-finder/docroot-check.sh2
-rw-r--r--php-malware-finder/generate_whitelist.py2
-rw-r--r--php-malware-finder/php.yar (renamed from php-malware-finder/php.yara)4
-rwxr-xr-xphp-malware-finder/phpmalwarefinder14
-rw-r--r--php-malware-finder/whitelist.yar (renamed from php-malware-finder/whitelist.yara)0
11 files changed, 25 insertions, 25 deletions
diff --git a/Makefile b/Makefile
index ddf79b7..b66e1db 100644
--- a/Makefile
+++ b/Makefile
@@ -10,16 +10,16 @@ clean:
10 10
11extract: 11extract:
12 cp -r debian php-malware-finder 12 cp -r debian php-malware-finder
13 git checkout php-malware-finder/common.yara 13 git checkout php-malware-finder/common.yar
14 git checkout php-malware-finder/php.yara 14 git checkout php-malware-finder/php.yar
15 git checkout php-malware-finder/asp.yara 15 git checkout php-malware-finder/asp.yar
16 16
17set_distribution: 17set_distribution:
18 sed -e "s/##version/${DEBVER}/" -i php-malware-finder/debian/control php-malware-finder/debian/changelog 18 sed -e "s/##version/${DEBVER}/" -i php-malware-finder/debian/control php-malware-finder/debian/changelog
19 19
20check_distribution: 20check_distribution:
21ifeq ($(DEBVER),6) 21ifeq ($(DEBVER),6)
22 sed -e '/too_many_chr/d' -e '/b64_concat/d' -e 's/^import.*//g' -e 's/^include.*//g' -e 's/and\ not\ IsWhitelisted//g' -i php-malware-finder/common.yara 22 sed -e '/too_many_chr/d' -e '/b64_concat/d' -e 's/^import.*//g' -e 's/^include.*//g' -e 's/and\ not\ IsWhitelisted//g' -i php-malware-finder/common.yar
23endif 23endif
24 24
25package: clean extract set_distribution check_distribution 25package: clean extract set_distribution check_distribution
diff --git a/README.md b/README.md
index 7ed97d3..0cb901a 100644
--- a/README.md
+++ b/README.md
@@ -47,7 +47,7 @@ both) category, and should re-read the previous sentence.
47## How does it work? 47## How does it work?
48 48
49Detection is performed by crawling the filesystem and testing files against a 49Detection is performed by crawling the filesystem and testing files against a
50[set]( https://github.com/nbs-system/php-malware-finder/blob/master/php.yara ) 50[set]( https://github.com/nbs-system/php-malware-finder/blob/master/php.yar )
51of [YARA](https://plusvic.github.io/yara/) rules. Yes, it's that simple! 51of [YARA](https://plusvic.github.io/yara/) rules. Yes, it's that simple!
52 52
53 53
@@ -67,8 +67,8 @@ Usage phpmalwarefinder [-cfhtv] [-l (php|asp)] <file|folder> ...
67Or if you prefer to use `yara`: 67Or if you prefer to use `yara`:
68 68
69``` 69```
70$ yara -r ./php.yara /var/www 70$ yara -r ./php.yar /var/www
71$ yara -r ./asp.yara /var/www 71$ yara -r ./asp.yar /var/www
72``` 72```
73 73
74Please keep in mind that you should use at least YARA 3.4 because we're using 74Please keep in mind that you should use at least YARA 3.4 because we're using
@@ -79,7 +79,7 @@ Ho, and by the way, you can run the comprehensive testsuite with `make test`.
79 79
80## Whitelisting 80## Whitelisting
81 81
82Check the [whitelist.yara]( https://github.com/nbs-system/php-malware-finder/blob/master/whitelist.yara ) file. 82Check the [whitelist.yar]( https://github.com/nbs-system/php-malware-finder/blob/master/whitelist.yar ) file.
83If you're lazy, you can generate whitelists for entire folders with the 83If you're lazy, you can generate whitelists for entire folders with the
84[generate_whitelist.py]( https://github.com/nbs-system/php-malware-finder/blob/master/generate_whitelist.py ) script. 84[generate_whitelist.py]( https://github.com/nbs-system/php-malware-finder/blob/master/generate_whitelist.py ) script.
85 85
diff --git a/debian/nbs-phpmalwarefinder.install b/debian/nbs-phpmalwarefinder.install
index 676b4aa..fb5e89a 100644
--- a/debian/nbs-phpmalwarefinder.install
+++ b/debian/nbs-phpmalwarefinder.install
@@ -1,6 +1,6 @@
1common.yara etc/phpmalwarefinder 1common.yar etc/phpmalwarefinder
2php.yara etc/phpmalwarefinder 2php.yar etc/phpmalwarefinder
3asp.yara etc/phpmalwarefinder 3asp.yar etc/phpmalwarefinder
4whitelist.yara etc/phpmalwarefinder 4whitelist.yar etc/phpmalwarefinder
5phpmalwarefinder usr/bin/ 5phpmalwarefinder usr/bin/
6docroot-check.sh usr/bin/ 6docroot-check.sh usr/bin/
diff --git a/php-malware-finder/asp.yara b/php-malware-finder/asp.yar
index 26483a1..6af74fb 100644
--- a/php-malware-finder/asp.yara
+++ b/php-malware-finder/asp.yar
@@ -1,6 +1,6 @@
1import "hash" 1import "hash"
2include "whitelist.yara" 2include "whitelist.yar"
3include "common.yara" 3include "common.yar"
4 4
5global private rule IsAsp 5global private rule IsAsp
6{ 6{
diff --git a/php-malware-finder/bad_php.yara b/php-malware-finder/bad_php.yar
index 1fb185f..1fb185f 100644
--- a/php-malware-finder/bad_php.yara
+++ b/php-malware-finder/bad_php.yar
diff --git a/php-malware-finder/common.yara b/php-malware-finder/common.yar
index 38b6726..38b6726 100644
--- a/php-malware-finder/common.yara
+++ b/php-malware-finder/common.yar
diff --git a/php-malware-finder/docroot-check.sh b/php-malware-finder/docroot-check.sh
index fa67a11..11aa4f9 100644
--- a/php-malware-finder/docroot-check.sh
+++ b/php-malware-finder/docroot-check.sh
@@ -2,7 +2,7 @@
2 2
3PATH=/usr/bin:/bin:/sbin:/usr/sbin 3PATH=/usr/bin:/bin:/sbin:/usr/sbin
4apache_confdir="/etc/apache2/sites-available" 4apache_confdir="/etc/apache2/sites-available"
5pmf_conf="/etc/phpmalwarefinder/php.yara" 5pmf_conf="/etc/phpmalwarefinder/php.yar"
6pmf_cachedir="/tmp" 6pmf_cachedir="/tmp"
7 7
8# grab the different document roots to scan each and everyone of them 8# grab the different document roots to scan each and everyone of them
diff --git a/php-malware-finder/generate_whitelist.py b/php-malware-finder/generate_whitelist.py
index ca9fa2d..4a8a6c5 100644
--- a/php-malware-finder/generate_whitelist.py
+++ b/php-malware-finder/generate_whitelist.py
@@ -19,7 +19,7 @@ if not os.path.isdir(sys.argv[2]):
19 print '%s is not a folder !' % sys.argv[2] 19 print '%s is not a folder !' % sys.argv[2]
20 sys.exit(1) 20 sys.exit(1)
21 21
22rules = yara.compile('./php.yara', includes=True, error_on_warning=True) 22rules = yara.compile('./php.yar', includes=True, error_on_warning=True)
23 23
24output_list = list() 24output_list = list()
25 25
diff --git a/php-malware-finder/php.yara b/php-malware-finder/php.yar
index 1370543..06e1827 100644
--- a/php-malware-finder/php.yara
+++ b/php-malware-finder/php.yar
@@ -1,6 +1,6 @@
1import "hash" 1import "hash"
2include "whitelist.yara" 2include "whitelist.yar"
3include "common.yara" 3include "common.yar"
4 4
5/* 5/*
6 Detect: 6 Detect:
diff --git a/php-malware-finder/phpmalwarefinder b/php-malware-finder/phpmalwarefinder
index db87349..1f8073f 100755
--- a/php-malware-finder/phpmalwarefinder
+++ b/php-malware-finder/phpmalwarefinder
@@ -2,7 +2,7 @@
2 2
3 3
4YARA=$(type -P yara) 4YARA=$(type -P yara)
5CONFIG_PATH='/etc/phpmalwarefinder/common.yara' 5CONFIG_PATH='/etc/phpmalwarefinder/common.yar'
6IONICE_BIN=$(type -P ionice) 6IONICE_BIN=$(type -P ionice)
7NICE_BIN=$(type -P nice) 7NICE_BIN=$(type -P nice)
8FORMAT="php" 8FORMAT="php"
@@ -20,10 +20,10 @@ fi
20if [ ! -f "$CONFIG_PATH" ] 20if [ ! -f "$CONFIG_PATH" ]
21then 21then
22 OLD_PATH=$CONFIG_PATH 22 OLD_PATH=$CONFIG_PATH
23 CONFIG_PATH='./common.yara' 23 CONFIG_PATH='./common.yar'
24 if [ ! -f "$CONFIG_PATH" ] 24 if [ ! -f "$CONFIG_PATH" ]
25 then 25 then
26 echo "Unable to find 'common.yara' in $OLD_PATH, and in the current directory." 26 echo "Unable to find 'common.yar' in $OLD_PATH, and in the current directory."
27 exit 0 27 exit 0
28 fi 28 fi
29fi 29fi
@@ -42,12 +42,12 @@ fi
42 42
43update_rules() { 43update_rules() {
44 SITE="https://raw.githubusercontent.com/nbs-system/php-malware-finder/master/php-malware-finder/" 44 SITE="https://raw.githubusercontent.com/nbs-system/php-malware-finder/master/php-malware-finder/"
45 RULES_FILES=('asp.yara' 'common.yara' 'bad_php.yara' 'php.yara' 45 RULES_FILES=('asp.yar' 'common.yar' 'bad_php.yar' 'php.yar'
46 'whitelist.yara') 46 'whitelist.yar')
47 CONFIG_DIR="/etc/phpmalwarefinder/" 47 CONFIG_DIR="/etc/phpmalwarefinder/"
48 48
49 if [ ! -d $CONFIG_DIR ]; then 49 if [ ! -d $CONFIG_DIR ]; then
50 if [ ! -f ./common.yara ]; then 50 if [ ! -f ./common.yar ]; then
51 echo "no rules in $CONFIG_DIR or ./, exiting" 51 echo "no rules in $CONFIG_DIR or ./, exiting"
52 exit 1 52 exit 1
53 else 53 else
@@ -182,7 +182,7 @@ one_line_trick "$@"
182 182
183# Include correct yara rule 183# Include correct yara rule
184CONFIG_PATH=${CONFIG_PATH%/*}/ 184CONFIG_PATH=${CONFIG_PATH%/*}/
185OPTS="${OPTS} -r ${CONFIG_PATH}${FORMAT}.yara" 185OPTS="${OPTS} -r ${CONFIG_PATH}${FORMAT}.yar"
186 186
187# Execute rules 187# Execute rules
188${NICE} ${NICE_OPTS} $YARA $OPTS "$@" 188${NICE} ${NICE_OPTS} $YARA $OPTS "$@"
diff --git a/php-malware-finder/whitelist.yara b/php-malware-finder/whitelist.yar
index 3aab9c5..3aab9c5 100644
--- a/php-malware-finder/whitelist.yara
+++ b/php-malware-finder/whitelist.yar