| 12345678910111213141516171819202122232425262728 |
- from datetime import datetime, timezone
- def health_check():
- return {"status": "ok", "timestamp": datetime.now(timezone.utc).isoformat()}, 200
- def echo_body(body):
- return {"received": body, "length": len(str(body))}, 200
- def lookup_ioc(value, ioc_type="auto"):
- normalized = value.strip().lower()
- verdict = "unknown"
- if "." in normalized and " " not in normalized:
- verdict = "domain-like"
- if normalized.count(".") == 3 and all(part.isdigit() for part in normalized.split(".")):
- verdict = "ipv4-like"
- if len(normalized) in {32, 40, 64} and all(c in "0123456789abcdef" for c in normalized):
- verdict = "hash-like"
- return {
- "input": value,
- "type": ioc_type,
- "verdict": verdict,
- "source": "demo-local",
- }, 200
|