Skip to content

cxinu/ddos-detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DDoS Detection System

Overview

This project implements a basic DDoS detection system in Go. It monitors incoming traffic, detects potential DDoS attacks, and sends alerts.

Setup

  1. Clone the repository.
  2. Update config/config.go with your SMTP server details and alert recipient.
  3. Run go run main.go to start the server.

Files

  • main.go: Entry point of the application.
  • config/config.go: Configuration settings.
  • alert/email.go: Functions for sending email alerts.
  • monitor/traffic.go: Request monitoring and detection logic.
  • mitigation/actions.go: Mitigation strategies.
  • Python/: Python scripts for analyzing network traffic.
  • Docker/: Dockerfiles for backend servers and load balancer.

Directory Structure

ddos-prototype/
├── Docker/
│   ├── backend/
│   │   ├── Dockerfile
│   │   └── index.html
│   └── loadbalancer/
│       ├── Dockerfile
│       └── nginx.conf
├── Python
│   ├── analyze.py
│   ├── ip_detect.py
│   ├── ip_syndetect.py
│   ├── ip_testing.py
│   ├── network_logs.pcap
│   └── traffic_log.txt
├── alert
│   └── email.go
├── config
│   └── config.go
├── mitigation
│   └── actions.go
├── monitor
│   └── traffic.go
├── go.mod
├── main.go
└── README.md

Docker Instructions to Run Load Balancers and Servers

Create a Docker network

docker network create ddos-net

Build the backend server image

# Build the Docker image
docker build -t nginx-backend Docker/backend

# Run the Docker container
docker run -d --name backend1 --network ddos-net nginx-backend
docker run -d --name backend2 --network ddos-net nginx-backend

Build the load balancer image

# Build the Docker image
docker build -t nginx-lb Docker/loadbalancer

# Run the Docker container
docker run -d --name loadbalancer --network ddos-net -p 8080:80 nginx-lb

Access the load balancer

curl http://localhost:8080

Or visit http://localhost:8080 in your browser.

About

DDoS detection system in Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published