A simple Minecraft IP logger honeypot in C.
Find a file
2025-08-23 10:31:31 +02:00
.gitignore modify gitignore 2024-10-19 00:35:28 +02:00
LICENSE.txt first commit 2024-06-27 11:42:38 +02:00
main.c POSIX + typo 2025-06-21 02:50:25 +02:00
README.md Update README.md 2025-08-23 10:31:31 +02:00

Minecraft Honeypot

A simple POSIX-compliant Minecraft honeypot (IP logger) written in C.

How to Build & Run 🛠️

  1. Clone the repository (or download main.c).
git clone https://github.com/Urpagin/MinecraftHoneypot.git
  1. Build the source file.
gcc -O2 -Wall -Wextra -o honeypot main.c
  1. 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 🖼️

minecraft multiplayer servers tab

ip logs

(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