- Install Dependencies
sudo apt-get install libpcap-dev libnftables-dev
- Compile
g++ -Wall -Wextra sniffer.cpp syn_attack.cpp -o sniffer -lpcap -lpthread
- Build Docker Image
docker build -t nft-blocker:0.1.0 .
- Create Docker Network
docker network create nft-block
- Run
docker run --privileged -d --name nft-blocker --network nft-block nft-blocker:0.1.0
- Attack
docker run -it --rm --network nft-block busybox:1.34.1-musl ping nft-blocker
- Watch Logs
docker logs -f nft-blocker
- Stop
docker stop -t 0 nft-blocker
- Remove Container
docker rm -f nft-blocker
- Rinse and Repeat :)
The program doesn't respond to SIGINT. That's why it has to terminated forcefully.