SA-MP server plugin providing protection against IP spoofing and server-full flooding attacks.
- 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)
- SA-MP 0.3z-R4 (500p or 1000p)
- Linux: 32-bit toolchain with multilib support
- Windows: MinGW-w64 or MSVC
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
# 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# 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.dllYou can also build natively using MSVC or MinGW-w64 on Windows.
-
Copy the compiled plugin to your server's
plugins/directory -
Add to your
server.cfg:plugins antiddos-samp -
Restart your SA-MP server
The plugin requires no configuration file. All settings are compile-time constants:
IP_WHITELIST_ENTRY_LIFETIME_SECONDS: 60 seconds (configurable inwhitelist/ip_whitelist.cpp)- HMAC key rotation: Every 15 seconds
- Whitelist cleanup: Every 30 seconds
The plugin uses multiple security layers:
- HMAC-SHA256 for challenge-response authentication
- Cryptographically secure random numbers (BCryptGenRandom on Windows, /dev/urandom on Linux)
- Memory protection with anti-tampering mechanisms
- Pattern scanning for reliable function hooking
- SA-MP 0.3z-R4
- Windows (x86)
- Linux (x86, 500p & 1000p)
