---
title: "Discussion on \"Threat Atlas Lab 01: Building a Failed Login Detection Tool with Python\" | Hashnode"
description: "Discussion on \"Threat Atlas Lab 01: Building a Failed Login Detection Tool with Python\". This lab project has been built to check and compare the failed login attempts a.k.a \"Brute force attack\" with Python. It is a beginner friendly and includes clear shown realevidence of the lab"
url: "https://hashnode.com/posts/threat-atlas-lab-01-building-a-failed-login-detection-tool-with-python/6ae30dfa77708dd380e8762e"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Threat Atlas Lab 01: Building a Failed Login Detection Tool with Python](https://threatatlas.hashnode.dev/threat-atlas-lab-01-building-a-failed-login-detection-tool-with-python?utm_source=hashnode&utm_medium=feed)

This lab project has been built to check and compare the failed login attempts a.k.a "Brute force attack" with Python. It is a beginner friendly and includes clear shown realevidence of the lab

Oct 29 · 4 min read · threatatlas.hashnode.dev  
Read the article

-   [#lab](https://hashnode.com/tag/lab)
-   [#loganalysis](https://hashnode.com/tag/loganalysis)
-   [#incident-response](https://hashnode.com/tag/incident-response)

## Written by

[Mukaddaskhon Umarova](https://hashnode.com/@hanachan)

@hanachan · Incheon, South Korea

  
[View profile](https://hashnode.com/@hanachan)

## Responses 3

Markdown supported · ⌘↵ to post

[Furqan Ashraf](https://hashnode.com/@jfreaks)

[Nov 2](https://hashnode.com/posts/threat-atlas-lab-01-building-a-failed-login-detection-tool-with-python/6ae30dfa77708dd380e8762e/comment/6ae87a63b2110c31f41e94ef)

For the time window on your next-steps list, a `collections.deque` per IP keeps it simple: append each failure's timestamp, pop from the left while the oldest is outside the window, and alert when `len()` reaches 5. Then your three tests are just 4, 5 and 6 failures inside the window, plus 6 spread across two windows that should not alert.

Small heads-up for later: 203.0.113.0/24 is a documentation range (RFC 5737), so if you add a [geolocation](https://ipgeolocation.io/) or reputation lookup in a future lab, those test IPs will come back empty. Use a few real public IPs in a separate test file for that step.

[Mukaddaskhon Umarova](https://hashnode.com/@hanachan)

[Nov 3](https://hashnode.com/posts/threat-atlas-lab-01-building-a-failed-login-detection-tool-with-python/6ae30dfa77708dd380e8762e/comment/6ae87a63b2110c31f41e94ef#reply-6ae9aaff37f25e34e1bd015f)

Hello! Thank you for the thoughtful suggestions. I really like the idea of using collection. deque to introduce a rolling time window. It would make the detection logic more practical by focusing on repeated failures within a specific period rather than simply counting all failures.

I'll work on implementing the four test scenarios (4, 5, and 6 attempts within the window, plus 6 attempts spread across separate windows) and document the results in the next version of the lab.

Also, thanks for pointing out the RFC 5737 documentation IP range. I'll keep the synthetic IPs for the current tests and consider using a separate set of public IPs if I introduce geolocation or reputation checks in a future lab.

Appreciate it buddy~

[Furqan Ashraf](https://hashnode.com/@jfreaks)

[Nov 4](https://hashnode.com/posts/threat-atlas-lab-01-building-a-failed-login-detection-tool-with-python/6ae30dfa77708dd380e8762e/comment/6ae87a63b2110c31f41e94ef#reply-6aeab10fab18386d9777a605)

Four, yes, I miscounted. A couple of things that might save you time in Lab 02:

You mentioned field names and encoding tripping you up. If the CSV was ever saved from Excel, it probably has a BOM, so the first header gets read as \\ufefftimestamp instead of timestamp. Opening the file with encoding="utf-8-sig" fixes that quietly.

Once the window is in, sort the rows by timestamp before you process them, because the deque logic assumes events arrive in order. Also keep a set of IPs you’ve already alerted on. Otherwise an IP like 203.0.113.25 with 7 failures prints three alerts (at 5, 6 and 7) instead of one.

Looking forward to the repo.
