#!/usr/bin/perl ######################################################## # # spamnames.cgi by greenfly # # This CGI chooses names taken by grepping my spam # Maildir with the following command: # $ egrep -ih "^FROM:" Maildir/.spam/cur/* > spamnames.txt # # The spamnames file is then processed to strip # first and last names from the file, and then # randomly display them. # ######################################################## use strict; use CGI qw(:standard); our $namefile = "spamnames.txt"; my %names; my @first_names; my @last_names; %names = grab_names(); @first_names = keys %{ $names{first} }; @last_names = keys %{ $names{last} }; print "Content-type: text/html\n\n"; print "Spam Name Generator\n"; print "\n"; print "
\n"; print "\n"; if(param()) { print "

Your name is $first_names[rand($#first_names)] $last_names[rand($#last_names)]\n"; print "

\n"; } print "

"; print ""; sub grab_names { my $full_name; my $first_name; my $last_name; my %names; open INFILE, "$namefile"; while() { /From: \"?([^"]*)\"?\s?\