This Python script monitors SSH login activities on a system by parsing the authentication logs (/var/log/auth.log
). It sends notifications for both successful and failed login attempts and logs these activities to a file for future reference.
-
Clone the repository:
git clone https://github.com/whitedevil1710/ssh-monitor.git
-
Navigate to the directory:
cd ssh-login-monitor
-
Run the setup file:
bash setup.sh
- Python 3.x
- Linux environment (tested on Ubuntu)
The script runs indefinitely, continuously monitoring the SSH login activities. Notifications are sent for both successful and failed login attempts. Successful logins are logged as "Successful login" and failed attempts as "Failed login attempt" in the .ssh_login.log
file in the user's home directory.
You can customize the following parameters in the script:
- Log file path: Modify the
logfile
attribute in theMonitor
class to specify a different log file path if needed. - Notification settings: Adjust the notification settings in the
send_notification
method to customize the appearance or behavior of notifications.
Contributions are welcome! Please feel free to open issues or submit pull requests with any improvements, bug fixes, or feature enhancements.
This project is licensed under the MIT License - see the LICENSE file for details.