import time import sqlite3 from prometheus_client import start_http_server, Counter WEAK_ENCRYPTION_COUNTER = Counter( 'orbital_weak_encryption_streams_total', 'Total number of weak or plaintext orbital telemetry streams', ['file_name', 'encryption_status'] ) def poll_database(): conn = sqlite3.connect("orbital_forensics.db") cursor = conn.cursor() cursor.execute("SELECT file_name, encryption_status FROM itar_file_transfers WHERE encryption_status = 'Plaintext'") rows = cursor.fetchall() for file_name, encryption_status in rows: WEAK_ENCRYPTION_COUNTER.labels(file_name=file_name, encryption_status=encryption_status).inc() conn.close() if __name__ == "__main__": start_http_server(9101) while True: try: poll_database() except Exception as e: pass time.sleep(2)