#!/usr/bin/perl # # Configure variables $email = "you\@yourserver.net"; $notifyme = 1; $righteousness = 1000; srand(time|$$); @candidate_list = ( 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', ); $listlength = 64; @top = ( '.com', '.net', '.edu', '.com', '.org'); @collectors = ('EmailSiphon', 'CherryPicker', 'EmailCollector', 'EmailWolf', 'Extractor', 'Mozilla'); # not necessary, but makes things less uniform for an extraction robot. @strings = ("Please send me junk email. I love it!", "There are few things I like better than uce. I'm a sucker for spam.", "I'd love to hear from you. Here is my email address. ", "Send me email.", "To contact me: "); $argc = @ARGV; # how many args are there? c styly foreach (@collectors) { if ($ENV{'HTTP_USER_AGENT'} =~ /$_/i ) { ¬ify(); &spamChoker($righteousness); print ""; exit; } } if( $argc == 0 ){ &returnAddress("", $email, "\n"); }elsif( $argc == 1 ){ if( $ARGV[0] eq "address" ){ &returnAddress($email); }elsif( $ARGV[0] eq "spamcheck" ){ exit; }else{ &returnAddress("", $ARGV[0], "\n"); } }elsif( $argc > 1 ){ if( $ARGV[1] ne "address" ){ $tag = $ARGV[1]; $email = $ARGV[0]; &returnAddress("", $ARGV[1], "\n"); }else{ &returnAddress($ARGV[0]); } } sub spamChoker { local($howmany) = @_; for( $k=0; $k<$howmany; ++$k ){ $address = &fake_address; print "

$strings[$topper] "; print "$address"; print "\n"; } } sub fake_address { local($address, $i); $namel = int rand(7); $doms = int rand(3); $topper = int rand(5); $name = &random_string($namel); $namel = int rand(8); $thorax = &random_string($namel); for( $i=0; $i < $doms; ++$i ){ $namel = int rand(8); $thorax = $thorax.".".&random_string($namel); } $address = $name."@".$thorax.$top[$topper]; return $address; } sub random_string { local($length) = @_; local($i, $name) = (0,0); if( !defined($length) ){ $length = 0; } $name = ""; for($i=0; $i < $length+2; ++$i){ $list = int rand(2); $char = substr($candidate_list[$list], int rand(64), 1); $name .= $char; } return $name; } sub returnAddress { foreach $thing (@_){ print "$thing"; } exit; } sub notify { unless( $notifyme ){ return; } $date = localtime; $from = "Spam Choker"; $to = $email; $subject = "Spam Choker"; $reply = $email; $ip = $ENV{'REMOTE_ADDR'}; # who is the scumbag? @numbers = split(/\./,$ip); $ip_number = pack("C4", @numbers); ($name) = (gethostbyaddr($ip_number, 2))[0]; if($name) { $hostname = $name; } else { $hostname = "No name available.\n"; } &SendMail ($to, $from, $reply, $subject); } sub SendMail { my ($to, $from, $reply, $subject, $body) = @_; ########################### #If active, really sends mail. Comment out to feed a phony mail to $debug_output. $active = 1; $debug_output = "spam.debug"; ########################### # Path to sendmail and its flags. # # sendmail options: # -n no aliasing # -t read message for "To:" # -oi don't terminate message on line containing '.' alone $sendmail = "/usr/lib/sendmail -t -n -oi"; # fork over the mail to sendmail and be done with it if ($active == 1) { open(MAIL,"| $sendmail"); } else { open(MAIL, ">>$debug_output"); } print MAIL <