mirror of
https://github.com/MattKeeley/Spoofy.git
synced 2026-02-03 13:33:24 +00:00
Add Json output to spoofy
This commit is contained in:
@@ -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."""
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user