From 9b900d877925b94e0b638965f59a932860469810 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 18 Jul 2023 08:17:15 +0200 Subject: [PATCH 1/2] Use Python os.makedirs() instead of os.makedir() Fixes #384 [`os.makedir()`](https://docs.python.org/3/library/os.html#os.makedir) is raising `FileNotFoundError` because a parent directory in the path does not exist so let's use [`os.makedirs()`](https://docs.python.org/3/library/os.html#os.makedirs) which will create any missing parent directories. --- hackingtool.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hackingtool.py b/hackingtool.py index 7626400..921912f 100755 --- a/hackingtool.py +++ b/hackingtool.py @@ -102,8 +102,7 @@ if __name__ == "__main__": with open(fpath) as f: archive = f.readline() - if not os.path.exists(archive): - os.mkdir(archive) + os.mkdirs(archive, exist_ok=True) os.chdir(archive) AllTools().show_options() From 84bd8407da19977c5cd8ba173dc9c77cf1adc605 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 18 Jul 2023 09:14:24 +0200 Subject: [PATCH 2/2] Ignore a FileNotFoundError if we are already in the Brute_Force directory Fixes: #356 --- tools/others/socialmedia.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/others/socialmedia.py b/tools/others/socialmedia.py index 27d6fce..3a1d0a2 100644 --- a/tools/others/socialmedia.py +++ b/tools/others/socialmedia.py @@ -1,4 +1,5 @@ # coding=utf-8 +import contextlib import os import subprocess @@ -48,7 +49,9 @@ class Faceshell(HackingTool): def run(self): name = input("Enter Username >> ") wordlist = input("Enter Wordlist >> ") - os.chdir("Brute_Force") + # Ignore a FileNotFoundError if we are already in the Brute_Force directory + with contextlib.suppress(FileNotFoundError): + os.chdir("Brute_Force") subprocess.run( ["python3", "Brute_Force.py", "-f", f"{name}", "-l", f"{wordlist}"])