Add Json output to spoofy

This commit is contained in:
richs3c
2025-09-02 18:46:49 +01:00
parent 184abe29ca
commit 8329e3d64f
2 changed files with 9 additions and 1 deletions

View File

@@ -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."""

View File

@@ -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)