a little experiment with honey

2025-11-03

This blog probably has little to no organic traffic as of today. When I launched the blog and linked it to my github profile I quickly saw a spike in traffic from all over the world. This made me curious about the activity and remembered a post from Herman of Bear. He's posted a few times about aggressive botting.

So I added a tiny experiment called a honeypot. This is not an attempt to thwart serious threats but rather my curiosity on the subject. On each page in this blog is a hidden link called /nectar. Humans wouldn't click on this link because it's hidden... but robots would. The link simply logs the request IP and then responds with "hello you filthy robot". There is no consequence to having this IP logged right now but if I wanted to add a way to interact with a post, perhaps I could use this list to prevent them from a successful modification of backend data.

Looking forward to seeing how many robots fall into the pot with almost no reference to this blog. Also maybe don't visit /nectar unless you really want to get logged and maybe insulted? If you're a robot that is.

Here's the implementation if you're curious:

# server.py
from db import Honeypot

...

honey = Honeypot()

@app.route("/nectar")
def nectar():
    if request.remote_addr:
        honey.add_ip(request.remote_addr)
    return "hello you filthy robot"

# db.py
import shelve
from datetime import datetime

DB_NAME = "honeypot.shelf"

class Honeypot:
    def __init__(self):
        shelf = shelve.open(DB_NAME, "c")
        shelf.close()

    def add_ip(self, ip: str):
        if ip in WHITELIST:
            return
        with shelve.open(DB_NAME, "c") as shelf:
            shelf[ip] = datetime.now().isoformat()

Shelve is a simple built-in key value store that persists to disk. I was tempted to reach for sqlite but this works perfectly fine for my silly experiment.

edited on 2025-11-12 10:03:00