.gitignore | ||
LICENSE.txt | ||
main.c | ||
README.md |
Minecraft Honeypot
A simple POSIX-compliant Minecraft honeypot (IP logger) written in C.
How to Build & Run 🛠️
- Clone the repository (or download
main.c
).
git clone https://github.com/Urpagin/MinecraftHoneypot.git
- Build the source file.
gcc -O2 -Wall -Wextra -o honeypot main.c
- Run the binary.
./honeypot
Compatibility 💻
Architecture
- Linux: Working
- macOS: Not tested (but should work)
- Windows: Not working (uses
sys/socket.h
, a POSIX-specific header not available on Windows)
Minecraft Clients
This implementation is compatible with Minecraft: Java Edition versions 1.7 and newer, as documented in the Server List Ping specification. See the Minecraft protocol wiki.
You can change the reported server version by modifying the JSON in the source code (the name
and protocol
fields).
How Does It Work? 🔎
The program mimics the Minecraft Server List Ping (SLP) protocol. It implements only the minimal status exchange: accept a TCP connection, answer with a basic status payload, then close.
By accepting a connection, the client reveals its IP address. The program logs that address to a file.
Caution
Depending on your jurisdiction, logging IP addresses and operating a honeypot may be subject to legal and privacy requirements. Use this project responsibly and comply with applicable laws.
For additional background, see the blog post in the Why section.
Illustrations 🖼️
(Note: the example shows local testing, which is why the addresses are 127.0.0.1.)
Code Quality Disclaimer 🧪
I have never properly learnt C, nor have I created any notable projects in that language prior to this one. The code works, but I am not confident in its quality.
Why ❓
Written for: https://blog.urpagin.net/coding-a-minecraft-honeypot/
I wrote this blog post because experimenting with sockets and Minecraft is genuinely enjoyable.
Known Bugs 🐛
- When the Minecraft client repeatedly hits the 'Refresh' button, the honeypot entry can appear as pending.
Releases Build Command 📦
Here is the command used to build the releases (>= 1.11):
gcc -O2 -s -Wall -Wextra -D_FORTIFY_SOURCE=2 -fstack-protector-strong -o honeypot_x86_64_linux_v<version> main.c