Add capture diagnostics and replay fixtures

Add privacy-safe capture diagnostics and sanitized replay fixtures without changing the existing export format, record order, or UID generation.
This commit is contained in:
Golumpa 2026-07-16 00:12:02 +01:00
parent 73bb100cd6
commit 2b33ea63af
11 changed files with 445 additions and 13 deletions

View file

@ -60,6 +60,34 @@ def load_network_fixture():
return json.load(f)
def load_capture_diagnostics_fixture():
path = FIXTURES / "synthetic_capture_diagnostics.json"
with path.open(encoding="utf-8") as f:
return json.load(f)
def diagnostic_fixture_session():
fixture = load_capture_diagnostics_fixture()
session = LiveHistorySession(fixture["local_ip"])
for packet in fixture["packets"]:
if "payload_hex" in packet:
payload = bytes.fromhex(packet["payload_hex"])
else:
payload = bytes.fromhex(packet["payload_byte"]) * packet["payload_length"]
session.process_packet(
UdpPacket(
timestamp=packet["timestamp"],
src_ip=packet["src_ip"],
dst_ip=packet["dst_ip"],
src_port=packet["src_port"],
dst_port=packet["dst_port"],
payload=payload,
protocol=packet["protocol"],
)
)
return session
def fixture_packets(scenario=None):
fixture = load_network_fixture()
packets = fixture["packets"]