From 9a7819ba4c8a097765b662ae172f855fb95f1423 Mon Sep 17 00:00:00 2001 From: kenjoe41 Date: Sun, 6 Feb 2022 21:11:44 +0300 Subject: [PATCH] Load hashes.json properly. Got an error running Bolt from somewhere else than the Bolt folder due to this. With this, we can load the file by concatenating script base dir with path to `hashes.json` file. Hence be able to run the script from anywhere on the file system. --- bolt.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bolt.py b/bolt.py index 93338a8..b80337c 100644 --- a/bolt.py +++ b/bolt.py @@ -13,6 +13,7 @@ banner() try: import concurrent.futures + from pathlib import Path except: print ('%s Bolt is not compatible with python 2. Please run it with python 3.' % bad) @@ -122,7 +123,8 @@ if len(uniqueTokens) < len(allTokens): if not replay: print ('%s Further investigation shows that it was a false positive.') -with open('./db/hashes.json') as f: +p = Path(__file__).parent.joinpath('db/hashes.json') +with p.open('r') as f: hashPatterns = json.load(f) if not allTokens: