Skip to content

Instantly share code, notes, and snippets.

@minesh1291
Last active March 14, 2025 14:22
Show Gist options
  • Select an option

  • Save minesh1291/43e70fbb8849e7b44f884d3f181851e5 to your computer and use it in GitHub Desktop.

Select an option

Save minesh1291/43e70fbb8849e7b44f884d3f181851e5 to your computer and use it in GitHub Desktop.
Failed login attempts Linux
#!/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}'
@minesh1291
Copy link
Author

usage:
curl -s -I bit.ly/mj_fla | grep Location | awk '{print $2}' | tr -d '\r\n' | xargs curl | sudo bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment