Skip to content

arshad1312/log_analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔐 Log Analyzer (C Project)

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.


📌 Features

  • 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

📁 Project Structure

log_analyzer/
├── src/
│   └── main.c
├── logs/
│   └── log.txt
├── Makefile
└── README.md

⚙️ Requirements

  • GCC compiler
  • Linux / Unix terminal (Kali, Ubuntu, etc.)

🛠️ Build Instructions

🔨 Compile the project

make

▶️ Run

./analyzer

🧹 Clean Build Files

make clean

👉 Removes compiled binary (analyzer)


📄 Sample Log File

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

📊 Sample Output

===== 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)

===============================

🧠 How It Works

  • 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

🔐 Use Case

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

🚀 Future Improvements

  • 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

📌 Author

Arshad S


⭐ Note

This is a beginner-friendly cybersecurity project to understand log analysis and basic threat detection concepts.

About

A command-line log analyzer written in C that detects brute-force login attempts by analyzing failed authentication logs.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors