import asyncio
import aiohttp

IPS = ["107.1.159.8", "192.153.31.25", "158.123.195.9"]
CAND = ["", "?f=backup", "?f=restore", "?f=import", "?f=config", "?f=backup_restore",
        "?form=backup", "?form=restore", "?form=import", "?action=restore", "?action=import",
        "?f=sys_backup", "?f=backup_restore&action=restore", "?&form=backup&action=restore"]
UA = {"User-Agent": "Mozilla/5.0"}


async def main():
    tout = aiohttp.ClientTimeout(total=15, connect=6, sock_read=10)
    async with aiohttp.ClientSession(timeout=tout, headers=UA) as s:
        for ip in IPS:
            print("=====", ip, flush=True)
            base_sizes = {}
            for q in CAND:
                url = f"https://{ip}/cgi-mod/index.cgi{q}"
                try:
                    async with s.get(url, ssl=False, allow_redirects=False) as r:
                        body = await r.content.read(20000)
                        txt = body.decode("utf-8", "replace")
                    low = txt.lower()
                    marks = [k for k in ("upload", "restore", "backup", "import", "file") if k in low]
                    print(f"  {q or '(none)':34s} st={r.status} len={len(body):6d} marks={marks}", flush=True)
                except Exception as e:
                    print(f"  {q or '(none)':34s} ERR {type(e).__name__}", flush=True)

asyncio.run(main())
