This commit is contained in:
ilyastar9999
2025-12-04 14:36:23 +03:00
parent 1841c66600
commit 42aecacced
4 changed files with 51 additions and 10 deletions

View File

@@ -131,18 +131,26 @@ async def socketio_listener():
print(f" Sending alert: points {attacker_delta:.2f} >= threshold {ALERT_THRESHOLD_POINTS}")
alert_message = f"🚨 ATTACK DETECTED!\nTeam {attacker_id} stole flag from {service_name}\nPoints lost: {attacker_delta:.2f} FP"
# Get service_id from controller if available
# Get service_id from controller by checking name first, then alias
service_id = None
try:
# Try to find service by exact name match
service_row = await conn.fetchrow(
"SELECT id FROM services WHERE name = $1 LIMIT 1",
service_name
)
if not service_row:
# Try to find service by alias
service_row = await conn.fetchrow(
"SELECT id FROM services WHERE alias = $1 LIMIT 1",
service_name
)
if service_row:
service_id = service_row['id']
print(f" Found service_id: {service_id} for service: {service_name}")
else:
print(f" Service {service_name} not found in services table, buttons will use service_name only")
print(f" Service {service_name} not found by name or alias in services table, buttons will use service_name only")
except Exception as e:
print(f" Error looking up service_id: {e}")