Skip to content

Repository files navigation

AntiDDos-SA-MP

AntiDDos SA-MP Banner

SA-MP 0.3z-R4 License GitHub Platform C++

SA-MP server plugin providing protection against IP spoofing and server-full flooding attacks.

Features

  • IP Spoofing Protection: Prevents attackers from forging IP addresses
  • Server-Full Flood Protection: Blocks connection flood attacks
  • HMAC-SHA256 Authentication: Secure challenge-response authentication
  • Automatic IP Whitelisting: Tracks authenticated endpoints
  • Memory Pattern Scanning: Advanced hooking for RakNet functions
  • Cross-Platform: Works on Windows and Linux (SA-MP 0.3z-R4)

Requirements

  • SA-MP 0.3z-R4 (500p or 1000p)
  • Linux: 32-bit toolchain with multilib support
  • Windows: MinGW-w64 or MSVC

Project Structure

antiddos-samp/
├── amxplugin.cpp, plugincommon.h, plugin.h     <- SA-MP SDK
│   sampgdk.c, sampgdk.h, main.def
├── CMakeLists.txt                                    <- Build configuration
├── cmake/mingw-w64-i686.cmake                        <- Cross-compile toolchain
├── makefile                                          <- Legacy Makefile (reference)
└── src/
    ├── common.h                                      <- Platform macros & constants
    ├── plugin_globals.h/.cpp                         <- Shared global state
    ├── main.cpp                                      <- Plugin entry points
    ├── util/                                         <- Utility functions
    │   ├── fnv_hash.h/.cpp                           <- FNV-1a hash
    │   └── tick_count.h/.cpp                         <- GetTickCount() implementation
    ├── crypto/
    │   └── sha256.h/.cpp                             <- SHA-256 / HMAC-SHA256
    ├── security/
    │   ├── secure_random.h/.cpp                      <- CSPRNG implementation
    │   └── security_code.h/.cpp                      <- HMAC key rotation & challenge
    ├── whitelist/
    │   └── ip_whitelist.h/.cpp                       <- Authenticated endpoint tracking
    ├── hooking/
    │   ├── detour.h/.cpp                             <- x86 inline hook / trampoline
    │   └── pattern_scan.h/.cpp                       <- Memory pattern scanning
    └── net/
        └── packet_filter.h/.cpp                      <- RakNet packet filtering

Building

Linux (.so)

# Install dependencies (Debian/Ubuntu)
sudo apt-get install gcc-multilib g++-multilib cmake

# Build
cmake -S . -B build-linux -DCMAKE_BUILD_TYPE=Release
cmake --build build-linux

# Output: build-linux/antiddos-samp.so

Windows (.dll) - Cross-compile from Linux

# Install MinGW-w64
sudo apt-get install g++-mingw-w64-i686 gcc-mingw-w64-i686 cmake

# Build
cmake -S . -B build-windows -DCMAKE_TOOLCHAIN_FILE=cmake/mingw-w64-i686.cmake -DCMAKE_BUILD_TYPE=Release
cmake --build build-windows

# Output: build-windows/antiddos-samp.dll

Windows (.dll) - Native build

You can also build natively using MSVC or MinGW-w64 on Windows.

Installation

  1. Copy the compiled plugin to your server's plugins/ directory

  2. Add to your server.cfg:

    plugins antiddos-samp
    
  3. Restart your SA-MP server

Configuration

The plugin requires no configuration file. All settings are compile-time constants:

  • IP_WHITELIST_ENTRY_LIFETIME_SECONDS: 60 seconds (configurable in whitelist/ip_whitelist.cpp)
  • HMAC key rotation: Every 15 seconds
  • Whitelist cleanup: Every 30 seconds

Security

The plugin uses multiple security layers:

  1. HMAC-SHA256 for challenge-response authentication
  2. Cryptographically secure random numbers (BCryptGenRandom on Windows, /dev/urandom on Linux)
  3. Memory protection with anti-tampering mechanisms
  4. Pattern scanning for reliable function hooking

Supported Platforms

  • SA-MP 0.3z-R4
  • Windows (x86)
  • Linux (x86, 500p & 1000p)

About

AntiDDos SAMP | SA-MP plugin protecting against IP spoofing and server-full flooding attacks. Supports 0.3z-R4 (Win/Linux).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages