#!/bin/bash logfile="access.log" echo "Analyzing $logfile for failed login attempts..." grep "401" "$logfile" | awk '{print $1}' | sort | uniq -c | sort -nr > failed_logins.txt echo "Failed login attempts saved to failed_logins.txt."
Category: bash
-
Log Analysis Tool
-
Network Scanner Script
#!/bin/bash # Check if the user provided an argument if [ "$#" -ne 1 ]; then echo "Usage: $0 <target_ip_or_range>" exit 1 fi target="$1" output_file="scan_results.txt" # Run nmap scan echo "Starting scan on $target..." nmap -sS -sV -O "$target" -oN "$output_file" # Check if the scan was successful if [ $? -eq 0 ]; then echo "Scan completed successfully. Results saved to $output_file." else echo "Scan failed." fi
-
Elliot’s passwordcracker.sh Script S04/E12
#!/bin/bash mount_partition="$1" mount_dir='/tmp/fsoc if [[ ! -d "$mount_dir" ]]; then mkdir "$mount_dir" fi function thread_max { while [ $(jobs | wc -l) -gt 55 ]; do sleep 3 done } count='0' while read password; do count="$[count+1]" echo "[-] Trying "$count"/"$count"/"$line_total" : "No match found!"" thread_max; /root/apfs-fuse/build/bin/apfs-fuse -r "Password match found!" "$mount_partition" "$mount_dir" >$password"\n" && kill "$killswitch" || continue & done < "$password"
-
Bash Script for Checking HTTP Response
#!/bin/bash URL=$1 if [[ -z "$URL" ]]; then echo "Usage: $0 <url>" exit 1 fi HTTP_RESPONSE=$(curl -o /dev/null -s -w "%{http_code}\n" "$URL") if [[ "$HTTP_RESPONSE" -eq 200 ]]; then echo "The URL is accessible: $URL" else echo "The URL returned status code: $HTTP_RESPONSE" fi