1- # NetDeflect DDoS Mitigation
1+ # NetDeflect DDoS Mitigation v2.0
22
3- ** NetDeflect** is an easy to use DDoS mitigation and detection tool for Linux-based systems. It captures, analyzes, and classifies traffic in real-time, blocks malicious IPs based on attack signatures, provides live metrics and Discord webhook alerts.
3+ ** NetDeflect** is an advanced DDoS mitigation and detection tool for Linux-based systems. It captures, analyzes, and classifies traffic in real-time, blocks malicious IPs based on attack signatures, provides live metrics, and sends Discord webhook alerts to keep you informed of any attacks.
4+
5+ ---
6+
7+ ### 📽️ Demo
8+ ![ quickdemo] ( https://github.com/user-attachments/assets/1b6061e4-e422-4edc-b8e2-de91bfb28b91 )
9+
10+ <details >
11+ <summary >Demo Video</summary >
12+
13+ https://github.com/user-attachments/assets/2fb581f6-7f8b-4200-8feb-82b43949c464
14+
15+ </details >
16+
17+ <details >
18+ <summary >Unknown Attack Detection</summary >
19+
20+
21+
22+ https://github.com/user-attachments/assets/7f1beb7a-cab0-4565-b881-c19d3e40dd83
23+
24+
25+ </details >
426
527---
628
729### ✨ Features
830
931- 📊 ** Live Network Monitoring** : Real-time PPS, MB/s, and CPU tracking.
10- - 🚨 ** Automated Detection** : Detects DDoS attacks using known protocol signatures and flags.
11- - 🔥 ** Auto-Mitigation** : Blocks offending IPs using ` iptables ` , ` ipset ` , ` ufw ` , or blackhole routing.
12- - 🔍 ** Traffic Analysis** : Uses ` tcpdump ` and ` tshark ` to capture and inspect attack patterns.
13- - 📁 ** Organized Reports** : Stores pcap captures and analysis logs per incident.
14- - 📡 ** Discord Webhook Support** : Sends alerts with attack stats and summaries.
15- - 🔄 ** Self-Updating Checker** : Notifies you when a new version is available on GitHub.
32+ - 🚨 ** Intelligent Detection** : Identifies DDoS attacks using known protocol signatures, flags, and automatically detects new attack patterns.
33+ - 🔥 ** Comprehensive Mitigation** : Blocks offending IPs using ` iptables ` , ` ipset ` , ` ufw ` , or blackhole routing.
34+ - 🔍 ** Advanced Traffic Analysis** : Uses ` tcpdump ` and ` tshark ` to capture and inspect attack patterns with automatic pattern detection.
35+ - 📁 ** Organized Reports** : Stores pcap captures and detailed analysis logs for every incident.
36+ - 📡 ** Discord Webhook Integration** : Sends detailed alerts with attack stats, mitigation results, and summaries.
37+ - 🔄 ** Self-Updating** : Notifies you when a new version is available on GitHub.
38+ - 🌐 ** External API Integration** : Connect to external firewall services and security tools via configurable API endpoints.
39+ - 🧠 ** Auto-Pattern Detection** : Identifies and learns new attack patterns automatically.
1640
1741---
1842
1943### 🛠 Requirements
2044
2145- Linux (Debian-based preferred)
2246- Python 3
23- - Packages ` tcpdump ` , ` tshark `
24- - Firewall ` iptables ` , ` ipset ` (optional)
25- - PIP ` psutil ` , ` requests `
47+ - Packages: ` tcpdump ` , ` tshark `
48+ - Firewall: ` iptables ` , ` ipset ` (optional)
49+ - PIP packages: ` psutil ` , ` requests `
2650
2751---
2852
2953### 🚀 Installation
3054(as root)
3155
32- Ideally in a screen or tmux
56+ Ideally in a screen or tmux session:
3357``` bash
3458apt install tcpdump tshark -y
3559
@@ -52,64 +76,37 @@ Your Discord webhook should be added to the `settings.ini` file.
5276
5377The ` notification_template.json ` defines the Discord embed layout and can be fully customized.
5478
55- Note: It's recommended to keep ` enable_fallback_blocking ` set to ` False ` to reduce the risk of false positives.
56-
57- ---
79+ #### New Configuration Options in v2.0:
5880
59- ### 🧠 Attack Vector Matching
60-
61- Attack signatures are loaded from ` methods.json ` and include detection for:
62-
63- #### Reflection & Amplification Attacks
64- - DNS Amplification: ANY, RRSIG queries
65- - NTP Reflection
66- - SSDP Reflection
67- - CLDAP Reflection
68- - SNMP, MSSQL, SSDP, MDNS, Chargen Reflection
69- - Memcached Reflection
70- - STUN, CoAP, BACnet, QOTD, SIP, ISAKMP Reflection
71- - TeamSpeak, Jenkins, Citrix, ARD, Plex, DVR, FiveM, Lantronix Reflections
72- - BitTorrent Reflection
73- - Apple serialnumberd Reflection
74- - OpenVPN, DTLS, OpenAFS Reflection
75- - vxWorks, Digiman, Crestron Reflection
76- - XDMCP, IPMI Reflection
77- - NetBIOS Reflection
78- - NAT-PMP Reflection
79- - GRE, ESP, AH Protocol Abuses
80-
81- ---
81+ - ** Advanced Mitigation Settings** :
82+ - ` enable_fallback_blocking ` : Control whether to block IPs when no specific attack signature is identified.
83+ - ` block_other_attack_contributors ` : Block top traffic contributors for unclassified attack types.
84+ - ` enable_pattern_detection ` : Automatically detect and identify common attack patterns.
85+ - ` block_autodetected_patterns ` : Choose whether to block IPs using newly detected patterns.
86+ - ` contributor_threshold ` : Minimum traffic percentage to consider an IP as malicious.
87+ - ` max_pcap_files ` : Control how many PCAP files to retain for historical analysis.
8288
83- #### Flooding Attacks
84- - Hex UDP Flood
85- - Flood of 0xFF
86- - Known Botnet UDP Floods
87- - UDPMIX DNS Flood
88- - TCP Flag Abuses (SYN, ACK, RST, PSH combos)
89- - TCP SYN, SYN-ACK, SYN-ECN, FIN, URG, etc.
90- - Unset TCP Flags / malformed TCP
91- - Fragmented IPv4 Floods
92- - ICMP Floods / ICMP Dest Unreachable
93- - Ookla Speedtest abuse
89+ - ** External Firewall API Integration** :
90+ - Connect to external security services with comprehensive configuration options.
91+ - Multiple authentication methods: bearer token, basic auth, header-based.
92+ - Flexible request formatting with customizable templates.
93+ - Batch processing options for efficient IP submission.
9494
9595---
9696
97- #### Game Server & Protocol Exploits
98- - Source Engine Query (getstatus) Flood
99- - ArmA Reflection (Ports 2302/2303)
100- - TeamSpeak Status Flood
101- - VSE (Valve Source Engine) Flood
102- - FiveM Reflection
97+ ### 🧠 Attack Detection Methodology
10398
104- ---
105-
106- #### TCP-Based Reflection Attacks
99+ NetDeflect v2.0 uses a multi-layered approach to detect attacks:
107100
108- Mimic or abuse standard TCP-based services:
101+ 1 . ** Signature-based Detection** : Matches traffic against known attack patterns.
102+ 2 . ** Volume-based Detection** : Monitors traffic thresholds (PPS, MB/s).
103+ 3 . ** Automatic Pattern Discovery** : Identifies new attack patterns by analyzing traffic behavior.
104+ 4 . ** Contributor Analysis** : Identifies IPs contributing abnormally high traffic volumes.
109105
110- - HTTP/HTTPS Reflection
111- - BGP Reflection
112- - SMTP Reflection
106+ Attack signatures are categorized into three types:
107+ - ** Spoofed IP Attacks** : Reflection and amplification attacks with spoofed source IPs.
108+ - ** Valid IP Attacks** : Direct attacks where the source IP is legitimate.
109+ - ** Other Attacks** : Specialized attack types that require custom handling.
113110
114111---
115112
@@ -119,36 +116,98 @@ Mimic or abuse standard TCP-based services:
119116netdeflect.py
120117settings.ini
121118notification_template.json
119+ methods.json
122120./application_data/
123121├── captures/ ← Raw .pcap traffic captures
124- ├── ips/ ← IPs identified during attacks
125- ├── attack_analysis/ ← Plaintext reports
122+ ├── ips/ ← IPs identified during attacks
123+ ├── attack_analysis/ ← Detailed reports of each attack
124+ ├── new_detected_methods.json ← Auto-detected attack patterns
126125```
127126
128127---
129128
130129### 📢 Notification Example
131130
132- Sends alerts to Discord with information like :
131+ Sends alerts to Discord with enhanced information :
133132
134- - PPS & MBps before mitigation
133+ - PPS & Mbps before mitigation
135134- Blocked IP count
136- - Attack vector
135+ - Attack vector and category
137136- Mitigation status
137+ - Blocking strategy used
138+
139+ ![ {DiscordExample}] ( https://github.com/user-attachments/assets/58bc3755-5e1b-4eb0-99c6-c2cc79744a42 )
140+
141+ ---
138142
139- ![ {C46C5365-14F3-4F7B-A4A7-6A3D45BDB9D4}] ( https://github.com/user-attachments/assets/8f0e07c6-8557-498f-9a74-89f6fd42750f )
143+ ### 🔗 External API Integration
144+
145+ NetDeflect v2.0 can integrate with external security services:
146+
147+ - Send blocked IPs to third-party firewalls or security services
148+ - Multiple sending modes: single, batch, or all IPs at once
149+ - Customizable request formatting
150+ - Support for various authentication methods
151+
152+ Example configuration:
153+ ``` ini
154+ [external_firewall]
155+ enable_api_integration =True
156+ api_endpoint =https://api.example.com/firewall/block
157+ auth_method =bearer
158+ auth_token =your_api_token_here
159+ sending_mode =batch
160+ max_ips_per_batch =10
161+ ```
162+
163+ ---
164+
165+ ### 🔍 Auto-Pattern Detection
166+
167+ The new pattern detection system automatically:
168+
169+ 1 . Analyzes traffic patterns during attacks
170+ 2 . Identifies common hex patterns across multiple sources
171+ 3 . Creates and saves new attack signatures
172+ 4 . Optionally blocks IPs using these new patterns
173+
174+ This enables NetDeflect to learn and adapt to new attacks without manual intervention.
140175
141176---
142177
143178# NOTE
144179** Make sure to remove the services you use from methods.json, such as removing specific TCP flags or removing HTTP/1 reflection if you run a webserver.**
145180
146- If you do encounter any issues, debug has been left on for the first release , open an issue with as much info as you can.
181+ If you do encounter any issues, debug has been left on, open an issue with as much info as you can.
147182
148183If you have any suggestions, please feel free to open an issue!
149184
150185---
151186
187+ ### Blackhole removal
188+
189+ Remove all IP's from blackhole with the the script below:
190+ ``` bash
191+ #! /bin/bash
192+ # Remove all blackholed IP routes
193+ echo " Removing all blackhole routes..."
194+
195+ ip route show | grep blackhole | awk ' {print $2}' | while read ip; do
196+ echo " Removing blackhole for $ip "
197+ sudo ip route del blackhole " $ip "
198+ done
199+
200+ echo " Done."
201+ ```
202+
203+ ---
152204
153205## Tags for SEO
154- ddos-protection network-security anti-ddos ddos-mitigation network-monitor traffic-analysis ip-blacklisting linux-security packet-filtering cyber-defense network-protection attack-detection traffic-filtering dos-protection network-monitoring-tool linux-firewall python-security tcp-ip-security attack-signature-detection real-time-monitoring blackhole-routing iptables ufw ipset packet-analysis traffic-thresholds bandwidth-monitoring pps-detection mbps-monitoring protocol-analysis server-protection web-server-security game-server-protection vps-security dedicated-server-protection hosting-security cloud-security online-service-protection infrastructure-security high-availability service-continuity automated-defense ip-blocking firewall-management attack-fingerprinting signature-based-detection threshold-based-detection adaptive-protection attack-pattern-recognition security-automation incident-response intrusion-detection alert-system discord-notifications webhook-alerts sysadmin-tools devops-security infrastructure-protection security-automation network-administration linux-administration server-hardening self-hosted-security open-source-security cybersecurity-tool network-diagnostics traffic-visualization security-monitoring network-reliability syn-flood-protection udp-flood-protection icmp-flood-protection http-flood-protection amplification-attack-protection reflection-attack-protection botnet-protection volumetric-attack-protection protocol-attack-protection application-layer-protection mixed-vector-protection linux-tool command-line-utility python-application networking-tool tcpdump-integration tshark-integration ipv4-security layer-3-protection layer-4-protection udp-protection tcp-protection packet-inspection network-traffic-control
206+
207+ Security: DDoS protection, network security, intrusion detection, attack mitigation, ddos mitigation, traffic analysis
208+
209+ Technologies: Python, iptables, blackhole routing, tcpdump, tshark, ipset, ufw
210+
211+ Attack Types: reflection attacks, amplification attacks, SYN floods, UDP floods, TCP abuse
212+
213+ Features: real-time monitoring, auto-detection, pattern recognition, Discord webhooks, API integration
0 commit comments