Simple Minecraft honeypot (IP logger) written in C.
-
Clone the repo (or download
main.c
) -
gcc main.c -o honeypot
-
./honeypot
- Linux: Working
- macOS: Not Tested (but should work)
- Windows: Not Working (as we are using
sys/socket.h
, a POSIX-specific header not available on Windows)
According to the Minecraft protocol wiki, this implementation is compatible from and including Java Edition 1.7 to the latest versions.
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, by changing the name
and protocol
fields.
First, the program mimics the Minecraft Server List Ping (SLP) protocol, to only implement the part that accepts a TCP connection and sends back the bare minimum.
But then, by accepting a connection the client gives out its IP address, after that we just log it into a file.
For more detail, please read the blog post in the "Why" section.
(Note: I only used the honeypot locally, which is why all the addresses are 127.0.0.1.)
I have never properly learnt C, nor made any project in that language. That said, the code works, but I doubt the quality of it.
Written for : https://blog.urpagin.net/coding-a-minecraft-honeypot/
I wrote this blog post because experimenting with sockets and Minecraft is genuinely enjoyable!