#!/usr/bin/perl -- -*-Perl-*- # # Generate HTML containing bogus addresses # The idea is to keep SPAMers and junkmailers who search web pages # for addresses too busy with bogus addresses to flood valid ones. # No good web site should be without a few thousand bogus addresses # that are changed often. # # The code that generates the random addresses was written by someone else # I don't remember where I found it. I don't know why they chose the # algorithms they did, as they seem rather bizarre. I modified it to run # on the command line, or as a cgi script and to generate html pages # with addresses. Chris Seidel 1997 $verbose=0; $body_only=0; $title='SPAM bait'; $n_low=900; $n_high=1100; $thisdir = "/home/userdir/public_html/MailFriends"; #your directory path $thisbaseurl = "http://www.mydomain.com/MailFriends"; #your base url to this script @candidate_list = ( 'abcdefghijklmnopqrstuvwxyz', 'abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz0123456789', 'abcdefghijklmnopqrstuvwxyz0123456789', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', ); @candidate_list_p = ( 844, 125, 25, 5, 1, ); @name_length_p = ( 1, 49, 100, 150, 150, 125, 100, 75, ); @parts_p = ( 7, 2, 1, ); @ending_list = ( 'com', 'edu', 'org', 'gov', 'us', 'fi', ); @ending_list_p = ( 40, 30, 10, 1, 1, 1, ); srand(time|$$); print "Content-type: text/html\n\n"; print < my junk mail friends \n

All my friends who love to receive commercial e-mail

I have so many that they change with each reload.

EOM # postmaster@localhost local($n_mailto) = 50; for(local($i)=0;$i<$n_mailto;$i++) { $address = &fake_address; print "$address
\n"; } print "


\n"; &AllPages(); print "

\n"; print ""; exit 0; sub AllPages { opendir(THISDIR,"$thisdir") || return; foreach $file (sort grep(/\.html$/, readdir(THISDIR)) ) { print "$thisbaseurl/$file
\n"; } } sub integer_from_to { local($from,$to) = @_; # $verbose && print "integer_from_to $from,$to\n"; if( $from == $to ) { return $from; } if( $from > $to ) { return &integer_from_to($to,$from); } local($diff) = ($to-$from)+1; local($rv)=$from+int(rand($diff)); # $verbose && print "rv=[$rv]\n"; return $rv; } sub integer_p_function { local(@p) = @_; local($total_volume) = 0; local($v); foreach $v ( @p ) { $total_volume += $v; } local($volume) = int(rand($total_volume)); local($rv) = 0; local($sum) = 0; foreach $v ( @p ) { $sum += $v; if( $volume < $sum ) { return $rv; } $rv++; } # this should never be reached return ($rv-1); } sub fake_address { local($parts) = &integer_p_function(@parts_p) + 1; local($index)=&integer_p_function(@candidate_list_p); local($candidates) = $candidate_list[$index]; #local($rv) = &random_name($candidates,1,8) . '@' . &random_name($candidates,1,8) . '.com'; local($rv) = &random_name_p($candidates) . '@' . &random_name_p($candidates); for(local($i)=1;$i<$parts;$i++) { $rv .= '.' . &random_name_p($candidates); } $index=&integer_p_function(@ending_list_p); $rv .= '.' . $ending_list[$index]; return $rv; } sub random_name { local($candidates,$from,$to) = @_; local($rv) = ''; local($a,$b) = split(/ /,$candidates); if( ! defined($b) ) { $b = $a; } local($length) = &integer_from_to($from,$to); if( $length < 1 ) { return $rv; } $rv .= &random_letter($a); for(local($i)=1;$i<$length;$i++) { $rv .= &random_letter($b); } return $rv; } sub random_name_p { local($candidates) = @_; local($rv) = ''; local($a,$b) = split(/ /,$candidates); if( ! defined($b) ) { $b = $a; } local($length)= &integer_p_function(@name_length_p) + 1; if( $length < 1 ) { return $rv; } $rv .= &random_letter($a); for(local($i)=1;$i<$length;$i++) { $rv .= &random_letter($b); } return $rv; } sub random_letter { local($candidates) = @_; return substr($candidates,&integer_from_to(0,length($candidates)-1),1); }