What this miniature lab demonstrates
Count distinct failed usernames from the same synthetic source during a small sample window.
Set up a harmless offline test
Requires Python 3. Run only on your own computer in a text console. No packages, accounts, network connections, malware, production logs or cloud credentials are required. Copy the example into a file or download the runnable script. The script includes assertions that fail if the expected behaviour changes.
from collections import defaultdict
events = [
("198.51.100.10", "alice", "failed"),
("198.51.100.10", "bob", "failed"),
("198.51.100.10", "cora", "failed"),
("192.0.2.25", "alice", "failed"),
("192.0.2.25", "alice", "failed"),
]
failed_users = defaultdict(set)
for source, user, result in events:
if result == "failed":
failed_users[source].add(user)
flagged = sorted(source for source, names in failed_users.items() if len(names) >= 3)
assert flagged == ["198.51.100.10"]
for source in sorted(failed_users):
print(source, "distinct failed users:", len(failed_users[source]))
Output from the bundled script
The following text was generated by running this exact script in an offline Python environment during package validation. It is not a product or attacker simulation result.
192.0.2.25 distinct failed users: 1
198.51.100.10 distinct failed users: 3
Interpretation and limits
The rule only illustrates one signal; a real SOC would use event identity, time windows, NAT/VPN context, successful sign-ins and observed baselines. It is not an operational detection signature.
Questions to discuss
What other fields would you need to avoid confusing a shared proxy with the origin of abuse?
To practise further, open the soc labs learning track and download a three-case CSV from any individual guide. Those records are fictional and deliberately contain an ambiguous case for analysis.
Primary sources
Scope: An illustrative educational model tested for deterministic output; no real-world security effectiveness or deployed vulnerability assessment is claimed. If a command, API or framework changes, follow the current official documentation and obtain approval before changes to real systems.