mirror of
https://github.com/BigBodyCobain/Shadowbroker.git
synced 2026-08-21 18:07:46 +02:00
Gate messages now propagate via the Infonet hashchain as encrypted blobs — every node syncs them through normal chain sync while only Gate members with MLS keys can decrypt. Added mesh reputation system, peer push workers, voluntary Wormhole opt-in for node participation, fork recovery, killwormhole scripts, obfuscated terminology, and hardened the self-updater to protect encryption keys and chain state during updates. New features: Shodan search, train tracking, Sentinel Hub imagery, 8 new intelligence layers, CCTV expansion to 11,000+ cameras across 6 countries, Mesh Terminal CLI, prediction markets, desktop-shell scaffold, and comprehensive mesh test suite (215 frontend + backend tests passing). Community contributors: @wa1id, @AlborzNazari, @adust09, @Xpirix, @imqdcr, @csysp, @suranyami, @chr0n1x, @johan-martensson, @singularfailure, @smithbh, @OrfeoTerkuci, @deuza, @tm-const, @Elhard1, @ttulttul
65 lines
2.1 KiB
Python
65 lines
2.1 KiB
Python
"""Yacht-Alert DB — load and enrich AIS vessels with tracked yacht metadata."""
|
|
|
|
import os
|
|
import json
|
|
import logging
|
|
|
|
logger = logging.getLogger("services.data_fetcher")
|
|
|
|
# Category -> color mapping
|
|
_CATEGORY_COLOR: dict[str, str] = {
|
|
"Tech Billionaire": "#FF69B4",
|
|
"Celebrity / Mogul": "#FF69B4",
|
|
"Oligarch Watch": "#FF2020",
|
|
}
|
|
|
|
|
|
def _category_to_color(cat: str) -> str:
|
|
"""Map category to display color. Defaults to hot pink."""
|
|
return _CATEGORY_COLOR.get(cat, "#FF69B4")
|
|
|
|
|
|
_YACHT_ALERT_DB: dict = {}
|
|
|
|
|
|
def _load_yacht_alert_db():
|
|
"""Load yacht_alert_db.json into memory at import time."""
|
|
global _YACHT_ALERT_DB
|
|
json_path = os.path.join(
|
|
os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))),
|
|
"data",
|
|
"yacht_alert_db.json",
|
|
)
|
|
if not os.path.exists(json_path):
|
|
logger.warning(f"Yacht-Alert DB not found at {json_path}")
|
|
return
|
|
try:
|
|
with open(json_path, "r", encoding="utf-8") as fh:
|
|
raw = json.load(fh)
|
|
for mmsi_str, info in raw.items():
|
|
info["color"] = _category_to_color(info.get("category", ""))
|
|
_YACHT_ALERT_DB[mmsi_str] = info
|
|
logger.info(f"Yacht-Alert DB loaded: {len(_YACHT_ALERT_DB)} vessels")
|
|
except (IOError, OSError, json.JSONDecodeError, ValueError, KeyError) as e:
|
|
logger.error(f"Failed to load Yacht-Alert DB: {e}")
|
|
|
|
|
|
_load_yacht_alert_db()
|
|
|
|
|
|
def enrich_with_yacht_alert(ship: dict) -> dict:
|
|
"""If ship's MMSI is in the Yacht-Alert DB, attach owner/alert metadata."""
|
|
mmsi = str(ship.get("mmsi", "")).strip()
|
|
if mmsi and mmsi in _YACHT_ALERT_DB:
|
|
info = _YACHT_ALERT_DB[mmsi]
|
|
ship["yacht_alert"] = True
|
|
ship["yacht_owner"] = info["owner"]
|
|
ship["yacht_name"] = info["name"]
|
|
ship["yacht_category"] = info["category"]
|
|
ship["yacht_color"] = info["color"]
|
|
ship["yacht_builder"] = info.get("builder", "")
|
|
ship["yacht_length"] = info.get("length_m", 0)
|
|
ship["yacht_year"] = info.get("year", 0)
|
|
ship["yacht_link"] = info.get("link", "")
|
|
return ship
|