Skip to content

Latest commit

ย 

History

History
78 lines (45 loc) ยท 2.69 KB

File metadata and controls

78 lines (45 loc) ยท 2.69 KB

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