ICEYOU/test_email.py

32 lines
920 B
Python

"""Quick email pipeline check - sends a synthetic 'failed unlock attempt' alert.
Run: python test_email.py
"""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent / "src"))
from iceyou.config import Config
from iceyou.actions import Actions
cfg = Config()
a = Actions(cfg)
print("Sending plain test email...")
a._send_email(
subject="Wiring test - plain",
body="If you see this, SMTP works end-to-end.",
snapshot_path=None,
)
print("Sending simulated failed-password alert...")
a._send_email(
subject="FAILED unlock attempt (password) [TEST]",
body=(
"ICEYOU recorded a FAILED password unlock attempt.\n\n"
"Entered: 'hunter2'\n"
"Time: now\n\n"
"Snapshot of the person at the keyboard is attached."
),
snapshot_path=None,
)
print("Done. Check inbox / spam folder at:", cfg.get("email.to_addr"))