From 1255fc9a34609803e11eadbd37d3bea5cac931ca Mon Sep 17 00:00:00 2001 From: "Christopher K. Hoadley" Date: Mon, 7 Dec 2020 18:26:44 -0600 Subject: [PATCH] Save csv file to output directory (if specified). --- sherlock/sherlock.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sherlock/sherlock.py b/sherlock/sherlock.py index cd779322..73b8f8b6 100644 --- a/sherlock/sherlock.py +++ b/sherlock/sherlock.py @@ -637,7 +637,14 @@ def main(): file.write(f"Total Websites Username Detected On : {exists_counter}\n") if args.csv: - with open(username + ".csv", "w", newline='', encoding="utf-8") as csv_report: + result_file = f"{username}.csv" + if args.folderoutput: + # The usernames results should be stored in a targeted folder. + # If the folder doesn't exist, create it first + os.makedirs(args.folderoutput, exist_ok=True) + result_file = os.path.join(args.folderoutput, result_file) + + with open(result_file, "w", newline='', encoding="utf-8") as csv_report: writer = csv.writer(csv_report) writer.writerow(['username', 'name',