import asyncio, re
import aiohttp

HOSTS = [("138.68.146.35", 8880, "https"), ("138.68.183.173", 8880, "https"), ("216.70.69.240", 8880, "http")]

async def main():
    tout = aiohttp.ClientTimeout(total=25)
    async with aiohttp.ClientSession(timeout=tout, headers={"User-Agent": "Mozilla/5.0"}) as s:
        for ip, port, sc in HOSTS:
            base = f"{sc}://{ip}:{port}"
            try:
                async with s.get(base + "/login_up.php", ssl=False) as r:
                    html = await r.text()
                fields = dict(re.findall(r'<input[^>]*name="([^"]+)"[^>]*value="([^"]*)"', html))
                fields.pop("login_name", None)
                fields.pop("passwd", None)
                fields.update({"login_name": "admin", "passwd": "zzz-wrong-123"})
                fields.setdefault("locale_id", "en-US")
                async with s.post(base + "/login_up.php", data=fields, ssl=False, allow_redirects=False) as r2:
                    body = await r2.text()
                low = body.lower()
                found = {kw: low.find(kw) for kw in ("too many failed", "brute", "captcha", "try again later", "incorrect")}
                print(f"== {ip} st={r2.status} len={len(body)} found={found}")
                for kw, idx in found.items():
                    if idx >= 0:
                        print(f"   [{kw}] ...{re.sub(chr(10),' ',body[max(0,idx-70):idx+90])}...")
            except Exception as e:
                print(f"== {ip} ERR {type(e).__name__}")

asyncio.run(main())
