A simple cybersecurity tool written in C to analyze log files and detect failed login attempts. This project helps identify brute-force attacks by counting and summarizing user-based login failures.
- Detects failed login attempts
- Extracts usernames from logs
- Counts number of attacks per user
- Displays most targeted user
- Simple and lightweight CLI tool
- Built using C + Makefile
log_analyzer/
├── src/
│ └── main.c
├── logs/
│ └── log.txt
├── Makefile
└── README.md
- GCC compiler
- Linux / Unix terminal (Kali, Ubuntu, etc.)
make./analyzermake clean👉 Removes compiled binary (analyzer)
User admin login success
User root failed login
User guest failed login
User root failed login
User admin failed login
User user1 login success
User user2 failed login
User user1 failed login
User guest login success
User root failed login
User admin failed login
User test failed login
User test login success
User root login success
User guest failed login
User admin failed login
User admin failed login
User user2 failed login
User user3 failed login
User user3 failed login
User user3 login success
===== Log Analysis Report =====
Total Failed Attempts: 15
User Attack Summary:
----------------------
root -> 3 times
guest -> 2 times
admin -> 4 times
user2 -> 2 times
user1 -> 1 times
test -> 1 times
user3 -> 2 times
Most Targeted User: admin (4 times)
===============================
- Reads log file line by line
- Searches for
"failed login"entries - Extracts username using string parsing
- Stores counts using a simple data structure
- Prints a summary report
This tool simulates a basic Security Operations Center (SOC) task:
- Detecting brute-force login attempts
- Monitoring suspicious activity in system logs
- Identifying targeted user accounts
- Accept log file as CLI argument (
./analyzer file.txt) - Add IP address extraction
- Support real Linux logs (
/var/log/auth.log) - Colored output (alerts)
- Sorting results
Arshad S
This is a beginner-friendly cybersecurity project to understand log analysis and basic threat detection concepts.