PYTHON / AUTHENTICATION LOGS

LogSentry

Make repeated failed logins easier to see.

LogSentry is a lightweight Python command-line tool for reviewing authentication logs. It extracts failed login attempts, groups them by IP address and highlights addresses that reach a configurable detection threshold. The result is a focused terminal report for defensive monitoring and learning.

Runs on
Python 3.10+
Repository created
View source on GitHub
README example
$ python3 main.py auth.log --threshold 3
Threshold: 3

Failed Login Counts:
192.168.1.20 -> 5
10.0.0.7 -> 1

Suspicious IPs:
192.168.1.20 -> SUSPICIOUS -> 5
Documented README example. These addresses and counts are sample data, not a live report. Read the original example on GitHub, opens in a new tab.

What it does

  • Parse authentication log lines and identify failed login events.
  • Count failed attempts for each source IP address.
  • Choose a detection threshold through the command-line interface.
  • Display counts and suspicious addresses in a readable terminal report.

Run the documented example

Run the command from the repository root, replacing auth.log with the authentication log file you want to examine. The example sets the threshold to three. In the README sample, one address has five failed attempts and is flagged; another has one attempt and is listed only in the counts. Running python3 main.py auth.log uses the default threshold.

Read a flag in context

A suspicious label identifies a repeated pattern in the supplied logs; it does not establish who made the attempts or whether an account was compromised. Compare the findings with the full log entries and the system context. LogSentry is intended for defensive analysis, education and systems you own or are authorized to monitor. It uses the Python standard library and requires no external Python dependencies.

Inside the code

The code separates parsing, detection and reporting. parser.py turns log lines into records, detector.py counts failed attempts and applies the threshold, and report.py formats the output. The repository includes unit tests for the parser and detector, making those responsibilities straightforward to inspect.