Posts

Showing posts from March, 2010

Script to ban hosts from connecting to your server by searching apache logs for keywords and odd browsers.

#I noticed several entires from a browser script obviously used by hackers. ## Lets block the bastards for hackerhost in `cat /var/log/httpd/access_log | grep XXSOMEWORDXX | awk '{ print $1 }' | uniq ` do `iptables -A INPUT -s $hackerhost -j DROP` done

Get all the host names of people who visited your web server

typographo@jpnyc:~ #cat /var/log/httpd/access_log* | awk '{print $1 }' | sort | uniq | nslookup | grep name > 144.205.50.70.in-addr.arpa name = 92.f5.344af.static.theplanet.com. > 164.233.101.75.in-addr.arpa name = ec2-75-101-233-167.compute-1.amaffzonaws.com. > 13.254.75.75.in-addr.arpa name = sithe.megaglobexghf.net. > 125.123.15.76.in-addr.arpa name = user-160v6bs.cable.minddspring.com. > 34.113.125.79.in-addr.arpa name = ec2-79-125-118-35.eu-west-1.cofmpudte.amazfhonaws.com. > 114.44.102.94.in-addr.arpa name = client-112-8-102-94.revgffgerse.nif.nget.tfr. > 113.251.179.94.in-addr.arpa name = 94.179.211.110.povol.3g.uftel.uga. > 83.41.239.96.in-addr.arpa name = pool-96-239-51-89.nycvmdny.eastf.verizon.net.