From 80d3f7fbf75ff48f906b198313db851896ff8f8f Mon Sep 17 00:00:00 2001 From: Jeroen Vermeulen Date: Sat, 14 Jul 2018 20:08:52 +0200 Subject: Improved scripts to be callable from another directory. (#73) Improved scripts to be callable from another directory instead of only from their own working dir.--- php-malware-finder/phpmalwarefinder | 2 +- php-malware-finder/utils/generate_whitelist.py | 2 +- php-malware-finder/utils/mass_whitelist.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/php-malware-finder/phpmalwarefinder b/php-malware-finder/phpmalwarefinder index b3ce7b7..ab1d6fb 100755 --- a/php-malware-finder/phpmalwarefinder +++ b/php-malware-finder/phpmalwarefinder @@ -15,7 +15,7 @@ fi if [ ! -f "$CONFIG_PATH" ] then - CONFIG_PATH='./php.yar' + CONFIG_PATH="$(dirname "$0")/php.yar" fi needle_in_haystack() { diff --git a/php-malware-finder/utils/generate_whitelist.py b/php-malware-finder/utils/generate_whitelist.py index 231eb1f..e2aa6dc 100755 --- a/php-malware-finder/utils/generate_whitelist.py +++ b/php-malware-finder/utils/generate_whitelist.py @@ -19,7 +19,7 @@ if not os.path.isdir(sys.argv[2]): print('%s is not a folder !' % sys.argv[2]) sys.exit(1) -rules = yara.compile('../php.yar', includes=True, error_on_warning=True) +rules = yara.compile(sys.path[0]+'/../php.yar', includes=True, error_on_warning=True) output_list = list() diff --git a/php-malware-finder/utils/mass_whitelist.py b/php-malware-finder/utils/mass_whitelist.py index ef7e39d..c2cf131 100755 --- a/php-malware-finder/utils/mass_whitelist.py +++ b/php-malware-finder/utils/mass_whitelist.py @@ -39,7 +39,7 @@ Examples: class Opts: DEFAULT_MIN = 0 DEFAULT_MAX = 99 - YARA_RULES = yara.compile('../php.yar', includes=True, error_on_warning=True) + YARA_RULES = yara.compile(sys.path[0]+'/../php.yar', includes=True, error_on_warning=True) @classmethod def to_str(cls): -- cgit v1.3