|
#!/usr/bin/perl -w # # fnames from ficnames --crb3 10oct03/01nov03/30mar07 # # complete-process version for cron # # Getting tired of having to invent new names for your fictional # characters, especially the throwaways, the 'Redshirts' (to use a # Trekkie term)? Thanks to those lovely people, the spammers, help # is at hand. # # If you've got spam filtered out into its own Maildir (/qrt, in # my case, where all spams end up after they've been bitched), # you can run this script (which in turn runs allmailscan), to # harvest all those lovely normal-sounding names which the # spammers invent to make you believe that their spew actually # comes from a real person and not from a life form lower than # pond-scum. # # Those invented names were sent to you unsolicited and under # false pretenses, so you don't have to send them back (as if you # could), so you're free to do with them what you will instead. # This script harvests them from the emitted output of allmailscan. # Once in hand, you can have endless fun devising new cruel and # unusual punishments for the spammers they represent. # # ficnames | sort | dedupe > /home/edk/edk/names/ficnames.$date.txt # $chatty=0; $ams="/usr/local/bin/allmailscan"; $qrmdir="qrt"; $today=&get_date; $outfile="/home/edk/edk/names/fnames.$today.txt"; # put it where? $outfile=$ARGV[0] if defined $ARGV[0]; $cmd="$ams -m $qrmdir"; open(A,"$cmd |") or die "can't open pipe to $ams\n"; # # scan em, building a quick-check hash. then sort and flush the # hash to disk. # while(defined($ln=<A>)){ chomp $ln; $ln =~ s/\s*\:\s{2}.+$//; next unless $ln =~ /^\s\d+\s+\"\w+\s+\w+\"\s+\</; # " joe syntax $ln =~ s/^\s\d+\s+\"(\w+)\s+(\w+)\".+$/$2, $1/; # " balancing $names{$ln}=1; print "$ln\n" if $chatty; } close(A); if($outfile eq '-'){ $oH = \*STDOUT; }else{ open(T,">$outfile") or die "can't open outfile $outfile\n"; $oH = \*T; } foreach $key (sort keys(%names)){ print $oH "$key\n"; } close(T) if defined(T); # # get_date. # # shave off all but the date in get_datime's output and pass it on. # sub get_date { my $today=&get_datime; substr($today,0,9)=""; return($today); } # # get_datime. # # return a date-time stamp with MILformed date. # sub get_datime{ my $rightnow; ($sec,$min,$hour,$mday,$mon,$yr,,,,) = localtime(); $yr %= 100; $amon = (qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec))[$mon]; $rightnow = ($hour<10?"0":"")."$hour:".($min<10?"0":"")."$min:".($sec<10?"0":"")."$sec "; $rightnow .= ($mday<10?"0":"")."$mday$amon".($yr<10?"0":"")."$yr"; return $rightnow; } |
Grab the tarball here |
| Syntax highlighting using Syntax::Highlight::Engine::Kate |