All pastes #25892 Raw Edit

Something

public text v1 · immutable
#25892 ·published 2005-10-18 21:35 UTC
rendered paste body
# *****************************************************************************
#!/bin/perl -w
# Duzan, Tyler		Created 10/18/05	Modified 10/18/05
# 
# Licensed under the GPL v2 or later, see license.txt or http://gnu.org/ for
# more information.
# 
# Simple log analyzer that will compare an array of regex against an Apache log
# file to find any referral spammers that you haven't banned yet, and report
# their IP addresses to you.
#
# Thanks to Kaos Havoc for explaining how to do most of this.
# *****************************************************************************
use warnings;
use strict;
print ("\n");

#declare my variables
my @loglines;
my @testlines;
my $logline;
my $testline;

#populate my arrays
open (FILE, "blacklist.txt");
while (<FILE>) {
	chomp ($_);
	push(@testlines,$_);
}
close (FILE);
open (FILE, "access.log");
while (<FILE>) {
	chomp ($_);
	push(@loglines,$_);
}
close (FILE);
open (FILE, "output.txt");
#do my comparison
foreach $logline (@loglines) {
	foreach $testline (@testlines) {
		if ($logline =~ $testline) {
			print FILE ("$logline\n");
		}
        print "testline mark\n";
	}
print FILE "logline mark\n";
}