A simple Minecraft IP logger honeypot in C.
Find a file
2025-06-21 02:58:20 +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-06-21 02:58:20 +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 per the Minecraft protocol wiki.

You can change the server version by modifying the JSON in the source code (specifically the name and protocol fields).

How Does It Work?

First, the program mimics the Minecraft Server List Ping (SLP) protocol, implementing only the part that accepts a TCP connection and sends back the bare minimum.

By accepting a connection, the client reveals its IP address. The program then logs this address to a file.

For more details, please read the blog post in the "Why" section.

Illustrations

minecraft multiplayer servers tab

ip logs

(Note: I only used the honeypot locally, which is why all 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. That said, 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 spams the 'Refresh' button, the honeypot entry shows 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