Giter Site home page Giter Site logo

imandromeda / autotcpdump-discord Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 2.0 22 KB

This is a Shell and Python script that captures network traffic on a given network interface that exceeds a max packet count threshold, stores it in a file, sends the capture data to a Discord channel, and terminates the capture after a certain number of packets have been captured.

License: MIT License

Shell 56.15% Python 43.85%
firewall-rules linux pcap tcpdump tcpdump-capture networking python3 security shell

autotcpdump-discord's Introduction

Packet Capture and DDoS Analyzer Script

This is a shell script that captures network traffic on a given network interface and stores it in a file. The script is designed to detect network attacks and analyze network traffic. It integrates with a Python script that processes the packet captures, detects potential DDoS attacks, and generates iptables rules to block the malicious traffic. For the script to run successfully, tcpdump should be installed on your Linux machine along with the necessary Python packages.

Please note, this project is Beta and may include bugs/issues.

For any problem, please create an issue

Requirements

  • Python 3.x
  • tcpdump
  • scikit-learn
  • scapy

Installation

  1. Install the required Python packages: pip install scikit-learn scapy

  2. Install tcpdump:

On Debian/Ubuntu:

sudo apt-get install tcpdump

On CentOS/RHEL:

sudo yum install tcpdump

Usage

  1. Copy the script to a Linux machine.
  2. Edit the configurable parameters at the beginning of the script to match your needs.
  3. Run the script with sudo or as root.

sudo ./capture.sh

Configuration

The following configurable parameters can be edited at the beginning of the script:

  • interface: The network interface to capture traffic on.
  • dumpdir: The directory to store the captured packet files.
  • max_packets: The maximum number of packets to capture before stopping.
  • attack_threshold: The threshold for detecting a network attack. If the number of packets per second exceeds this threshold, the script will capture packets.
  • capture_duration: The duration of the packet capture in seconds.
  • webhook_url: The URL of the Discord webhook to send messages and packet captures to. This should ideally be moved to a configuration file for security purposes.

Customization

The script can be customized in various ways:

  • Change the interface parameter to capture traffic on a different network interface.
  • Modify the dumpdir parameter to store captured packet files in a different directory.
  • Adjust the max_packets and capture_duration parameters to capture more or less traffic.
  • Modify the attack_threshold parameter to detect attacks with a different packet rate threshold.
  • Customize the log() function to send notifications to different channels or services.
  • Extend the script by adding more functionalities, like deeper packet analysis or integration with other security tools.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.