Last active
March 14, 2025 14:22
-
-
Save minesh1291/43e70fbb8849e7b44f884d3f181851e5 to your computer and use it in GitHub Desktop.
Failed login attempts Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Check if the script is run with root privileges | |
| if [ "$EUID" -ne 0 ]; then | |
| echo "Please run as root" | |
| exit | |
| fi | |
| # Determine the log file based on the distribution | |
| if [ -f /var/log/auth.log ]; then | |
| LOG_FILE="/var/log/auth.log" | |
| elif [ -f /var/log/secure ]; then | |
| LOG_FILE="/var/log/secure" | |
| else | |
| echo "Log file not found!" | |
| exit | |
| fi | |
| # Extract and display failed login attempts | |
| echo "Failed login attempts:" | |
| grep -i "fail" $LOG_FILE | awk '{print $1, $2, $3, $8, $9, $10, $11, $12}' |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
usage:
curl -s -I bit.ly/mj_fla | grep Location | awk '{print $2}' | tr -d '\r\n' | xargs curl | sudo bash