From 28cf1c090197b590b94e70d97016194d9b4b9cc9 Mon Sep 17 00:00:00 2001 From: Julien "shaddai" Reveret Date: Thu, 14 Apr 2016 16:04:47 +0200 Subject: adding -u option to update rules files --- php-malware-finder/phpmalwarefinder | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/php-malware-finder/phpmalwarefinder b/php-malware-finder/phpmalwarefinder index 501ce47..db87349 100755 --- a/php-malware-finder/phpmalwarefinder +++ b/php-malware-finder/phpmalwarefinder @@ -40,6 +40,26 @@ else fi fi +update_rules() { + SITE="https://raw.githubusercontent.com/nbs-system/php-malware-finder/master/php-malware-finder/" + RULES_FILES=('asp.yara' 'common.yara' 'bad_php.yara' 'php.yara' + 'whitelist.yara') + CONFIG_DIR="/etc/phpmalwarefinder/" + + if [ ! -d $CONFIG_DIR ]; then + if [ ! -f ./common.yara ]; then + echo "no rules in $CONFIG_DIR or ./, exiting" + exit 1 + else + CONFIG_DIR="./" + fi; + fi; + + for FILE in ${RULES_FILES[@]}; do + wget $SITE/$FILE -O $CONFIG_DIR/$FILE + done +} + # Determines the format of the target # Check only the file extension and it's not even accurate determine_format() { @@ -95,11 +115,12 @@ Usage ${0##*/} [-cfhtvl] ... -t Specify the number of threads to use (8 by default) -v Verbose mode -l Set language ('asp', 'php') + -u update rules EOF } OPTIND=1 -while getopts "c:fht:vl:" opt; do +while getopts "c:fht:vl:u" opt; do case "$opt" in h) show_help @@ -120,6 +141,10 @@ while getopts "c:fht:vl:" opt; do l) FORMAT=${OPTARG} ;; + u) + update_rules + exit 0 + ;; '?') show_help exit 1 -- cgit v1.3