Code: Select all
#!/bin/bash
# this is the log file with the messy poo poo in it
FILE="/var/log/httpd/access_log"
# not sure this is the best way to find the bad lines, could be aggressive, I think not
grep '(chr(' $FILE > /tmp/sanity
#Get just the IP from the file
cat /tmp/sanity | awk '{ print $2}' > /tmp/sanity_ip
# get just the unique list
sort -u /tmp/sanity_ip > ~/sanity_unique.txt
# wipe after done
rm /tmp/sanity /tmp/sanity_ip