This is a beginner-friendly cybersecurity project built using Python. It analyzes sample security logs to identify failed login attempts, successful logins, and potentially suspicious login activity.
- Reads log entries from a text file.
- Counts successful logins by IP address.
- Counts failed login attempts by IP address.
- Calculates total failed attempts and unique IP addresses.
- Sorts failed login attempts from highest to lowest.
- Generates security alerts based on configurable thresholds.
- Identifies IP addresses with both failed and successful logins.
- Warns when failed login attempts are followed by a successful login from the same IP.
- Writes security report information to security_report.txt.
- Uses append mode to preserve existing report content when adding new information.
- Accurate IP address extraction from failed and successful logs.
- Improved log parsing to prevent incorrect IP identificatio.
- Python
- File Handling
- Dictionaries and Loops
- Conditional Statements
- Sorting
- Basic Log Analysis
first_program.py— Main Python program.security_logs.txt— Sample security log data.security_report.txt— File used to store security report information.README.md— Project documentation.
-
Install Python.
-
Download or clone this repository.
-
Open the project folder in VS Code.
-
Run the following command in the terminal:
python first_program.py
This project uses sample log data for educational purposes. Security alerts indicate activity that may require investigation; they do not prove that an account has been compromised.
This project helped me practise Python programming, file handling, dictionaries, loops, sorting, and basic cybersecurity log analysis.