Files
OSINT-with-LLM/utils/format.py
2025-11-20 10:49:44 +01:00

20 lines
610 B
Python

import os
import re
def save_report(text, path="reports/report.md"):
os.makedirs(os.path.dirname(path), exist_ok=True)
with open(path, "w", encoding="utf-8") as f:
f.write(text)
#print(f"[+] Report saved to {path}")
# Helper to detect input type
def is_email(target):
return re.match(r"[^@]+@[^@]+\.[^@]+", target)
def is_ip(target):
return re.match(r"\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b", target)
def is_domain(target):
# domain regex (RFC 1035 simplified)
domain_regex = r"^(?!-)([a-zA-Z0-9-]{1,63}\.)+[A-Za-z]{2,}$"
return re.match(domain_regex, target) is not None