From 8329e3d64fb307f17d84c32e3c1356fbda0e787b Mon Sep 17 00:00:00 2001 From: richs3c <123593627+richs3c@users.noreply.github.com> Date: Tue, 2 Sep 2025 18:46:49 +0100 Subject: [PATCH 1/3] Add Json output to spoofy --- modules/report.py | 4 ++++ spoofy.py | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/report.py b/modules/report.py index 4116fa5..750f253 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,9 @@ def write_to_excel(data, file_name="output.xlsx"): else: pd.DataFrame(data).to_excel(file_name, index=False) +def output_json(data): + jsonout = json.dumps(data) + return jsonout 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..9636f83 100755 --- a/spoofy.py +++ b/spoofy.py @@ -3,6 +3,7 @@ # spoofy.py import argparse import threading +import json from queue import Queue from modules.dns import DNS from modules.spf import SPF @@ -107,7 +108,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 +116,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 +144,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: + print(report.output_json(results)) for _ in range(len(threads)): domain_queue.put(None) From e423d8d8d18164fa96c99300217282c10daa2980 Mon Sep 17 00:00:00 2001 From: richs3c <123593627+richs3c@users.noreply.github.com> Date: Tue, 2 Sep 2025 18:56:21 +0100 Subject: [PATCH 2/3] adding json output - removed unused json import --- spoofy.py | 1 - 1 file changed, 1 deletion(-) diff --git a/spoofy.py b/spoofy.py index 9636f83..bbaf516 100755 --- a/spoofy.py +++ b/spoofy.py @@ -3,7 +3,6 @@ # spoofy.py import argparse import threading -import json from queue import Queue from modules.dns import DNS from modules.spf import SPF From c5e4670480cd77fe24c3599f8e2ea6bbede7114d Mon Sep 17 00:00:00 2001 From: richs3c <123593627+richs3c@users.noreply.github.com> Date: Tue, 2 Sep 2025 18:56:21 +0100 Subject: [PATCH 3/3] adding json output - removed unused json import --- modules/report.py | 11 ++++++++--- spoofy.py | 3 +-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/report.py b/modules/report.py index 750f253..12a318c 100644 --- a/modules/report.py +++ b/modules/report.py @@ -33,9 +33,14 @@ def write_to_excel(data, file_name="output.xlsx"): else: pd.DataFrame(data).to_excel(file_name, index=False) -def output_json(data): - jsonout = json.dumps(data) - return jsonout +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 9636f83..14ee76b 100755 --- a/spoofy.py +++ b/spoofy.py @@ -3,7 +3,6 @@ # spoofy.py import argparse import threading -import json from queue import Queue from modules.dns import DNS from modules.spf import SPF @@ -145,7 +144,7 @@ def main(): report.write_to_excel(results) print("Results written to output.xlsx") elif args.o == "json" and results: - print(report.output_json(results)) + report.output_json(results) for _ in range(len(threads)): domain_queue.put(None)