30/10/2026
Bots guessing your passwords? My login got cracked at guess #734 in 5.5 seconds. Then I built a shield with AI: 992 of 1,000 guesses blocked 🛡️
The story: my own local login page vs one bot with 1,000 passwords. Save this:
1️⃣ No limit (every guess checked): the server tried all of them. The bot found "sunshine42" at guess #734 in 5.5 s
2️⃣ Fixed window (5 tries per 2 seconds): looked fine, until the window edge. 5 tries just before the reset + 5 right after = 10 of 10 allowed in 0.1 s, double the limit
3️⃣ Token bucket (limiter.py, 0 libraries): 5 tokens, refills 1 every 2 s, each guess spends one. allow() uses time.monotonic() to add tokens since the last request. Same bot: 992 blocked, 8 checked
4️⃣ Say when (HTTP 429 + Retry-After: 2): blocked requests get "429 Too Many Requests" and a Retry-After header, so real apps know when to try again
5️⃣ Where it breaks (it slows, it doesn't stop): at 1 guess every 2 s the bot still reaches #734 in about 24 minutes
Too many guesses? Rate-limit them.
Bursts at the edge? Use a token bucket.
Patient bot? Add lockout or 2FA.
Where to start: put a token bucket per IP in front of your /login route, return 429 with Retry-After, and test it with your own script against localhost.
Verdict: 7/10. Huge win for 20 lines of Python, but it's a speed bump, not a wall.
Does your login have a rate limit? Yes or no? 👇
Save this 💡 and follow for real AI builds
🌐 seeb4coding.in