import asyncio, ssl, traceback

import aiohttp

UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/148.0.0.0 Safari/537.36"


async def main():
    ctx = ssl.create_default_context()
    ctx.check_hostname = False
    ctx.verify_mode = ssl.CERT_NONE
    ctx.set_ciphers("DEFAULT@SECLEVEL=1")
    conn = aiohttp.TCPConnector(limit=0, ssl=ctx, force_close=True)
    to = aiohttp.ClientTimeout(total=10)
    async with aiohttp.ClientSession(timeout=to, connector=conn) as sess:
        for ip in ("63.187.232.85", "3.165.148.1", "34.160.18.98"):
            try:
                async with sess.get("https://%s/" % ip, allow_redirects=False, headers={"User-Agent": UA}) as r:
                    b = await r.read(2000)
                    print(ip, r.status, (r.headers.get("Location") or "")[:40], len(b))
            except Exception:
                print(ip, "ERR")
                traceback.print_exc()


asyncio.run(main())
