From 9071720431f2f901c57b2e5e070efbc7f6afbacc Mon Sep 17 00:00:00 2001 From: William Ballenthin Date: Tue, 14 Jul 2020 14:36:11 -0600 Subject: [PATCH] main: detect when embedded rules not found related to #132 --- capa/main.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/capa/main.py b/capa/main.py index b62994a3..7e52c1a1 100644 --- a/capa/main.py +++ b/capa/main.py @@ -491,6 +491,11 @@ def main(argv=None): logger.debug("detected running from source") rules_path = os.path.join(os.path.dirname(__file__), "..", "rules") logger.debug("default rule path (source method): %s", rules_path) + + if not os.path.exists(rules_path): + logger.error("default embedded rules not found! (maybe you installed capa as a library?)") + logger.error("provide your own rule set via the `-r` option.") + return -1 else: rules_path = args.rules logger.debug("using rules path: %s", rules_path)