diff --git a/modules/report.py b/modules/report.py index 4116fa5..12a318c 100644 --- a/modules/report.py +++ b/modules/report.py @@ -2,6 +2,7 @@ import os import pandas as pd +import json from colorama import init, Fore, Style # Initialize colorama @@ -32,6 +33,14 @@ def write_to_excel(data, file_name="output.xlsx"): else: pd.DataFrame(data).to_excel(file_name, index=False) +def output_json(results): + output = [] + for result in results: + output.append(result) + print(json.dumps(output)) + + + def printer(**kwargs): """Utility function to print the results of DMARC, SPF, and BIMI checks in the original format.""" diff --git a/spoofy.py b/spoofy.py index 701a714..14ee76b 100755 --- a/spoofy.py +++ b/spoofy.py @@ -107,7 +107,7 @@ def main(): parser.add_argument( "-o", type=str, - choices=["stdout", "xls"], + choices=["stdout", "xls", "json"], default="stdout", help="Output format: stdout or xls (default: stdout).", ) @@ -115,6 +115,7 @@ def main(): "-t", type=int, default=4, help="Number of threads to use (default: 4)" ) + args = parser.parse_args() if args.d: @@ -142,6 +143,8 @@ def main(): if args.o == "xls" and results: report.write_to_excel(results) print("Results written to output.xlsx") + elif args.o == "json" and results: + report.output_json(results) for _ in range(len(threads)): domain_queue.put(None)