#!/usr/bin/env python3
"""
Enumerate available endpoints on the target
"""

import requests
import urllib3
urllib3.disable_warnings()

BASE_URL = "https://vulnerability-research-dbfd88d4dab49dc2.chals.uoftctf.org"

endpoints = [
    "/welcome/default/index",
    "/welcome/default/user",
    "/welcome/default/download",
    "/welcome/default/wiki",
    "/welcome/default/grid",
    "/welcome/default/api_get_user_email",
    "/welcome/appadmin",
    "/admin",
    "/welcome",
    "/",
]

print("Enumerating endpoints...")
for endpoint in endpoints:
    try:
        r = requests.get(BASE_URL + endpoint, verify=False, timeout=5, allow_redirects=False)
        print(f"{endpoint:50} Status: {r.status_code:3}  Length: {len(r.text):6}")
        
        if r.status_code ==  200 and len(r.text) < 1000:
            print(f"  Content: {r.text[:200]}")
    except Exception as e:
        print(f"{endpoint:50} Error: {e}")
