Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2006

    Using Perl To Grep Apache Logs for Spammers

    My PERL skills are rather limited, so I'm not sure the best way to do this. I'd like to do some GREPS out of an Apache log file to extract IPs that are spamming blogs.

    So I need to do something like this

    1. open the file.
    2. POST for all post requests being done to blog comment files being spammed, wp-comments-post.php and mt-comments.cgi
    3. Pull the IPs out of that list
    4. Pass those IPs into something that'll firewall them.

    Can anyone help me get started on this?

  2. #2
    Join Date
    Mar 2003
    California USA
    can do it in bash.

    for i in `grep wp-comments-post.php | awk '{print $1}'`;do iptables -I INPUT -s $i -j DROP;done
    Steven Ciaburri | Proactive Linux Server Management -
    Managed Servers (AS62710), Server Management, and Security Auditing.

  3. #3
    Join Date
    Jun 2004
    You should look at using grep and regular expressions to do this, searching google for help with regular expressions would be a good start.
    System Administrator

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts