#!/bin/csh -f #(ie run the cshell on this but don't read the .cshrc) # version = 1.07 of mkspamtrap 2004 Apr 19 # 2004 Apr 19, 1.07: seed uses letters instead of numbers sometimes # 2002 Mar 6, 1.06: hold the morenames, make mailto # 2001 Nov 27, 1.05: allow more names in 'morenames' file # 2001 Sep 18, 1.04: time based seed: a different page created each time! # 2001 Jan 19, 1.03: multiple name sets # origin 2000Apr19.00:50:44 # create a spam trap web page. Example: # http://www.lecb.ncifcrf.gov/~toms/spam/trap.html # source of words, one per line: set dict = /usr/share/lib/dict/words # set seed = `+%Y%b%d.%H:%M:%S` # set seed = `date +%S%M%H%d%m%Y` # short version set seed = `date +%S%M%H%d` # if the time in seconds is # then substitute letters for numbers in the seed set dswitch = 1 set dswitch = 0 # dswitch is the last digit of the seconds set dswitch = `date +%S|cut -c2,2` # echo `date "+%S"` # echo --${dswitch}-- # ******************************************* # /home/strawberry/toms/script/example.switch switch ($dswitch) case 1: set dswitch = 1 breaksw case 3: set dswitch = 1 breaksw case 5: set dswitch = 1 breaksw case 7: set dswitch = 1 breaksw case 9: set dswitch = 1 breaksw default: set dswitch = 0 breaksw endsw # ******************************************* if ($dswitch == 0) then set seed = `echo $seed|tr '0123456789' 'abcdefghij'` endif echo using seed: $seed while (0) echo test mode head -5 $dict > /tmp/dct set dict = /tmp/dct head -30 $dict end # name of output trap file: set trap = trap.html set spamhead = spamhead.html set spammid = spammid.html set spamtail = spamtail.html # set morenames = morenames # additional names straight: set additional = additional # location - the part of email address following the @ sign: # set location = the.spamtrap.com # new name 2001 jan 19 # set location = new.spamtrap.com echo "" > $spammid # put multiple name sets here: foreach location (`echo ncifcrf.gov fred.net`) # go through the dictionary and make it into the list: set address = $seed@$location # cat $dict |\ paste $dict $dict|\ sed -e "s/^/\,' |\ sed -e 's,$,LOCATION,' |\ sed -e "s/LOCATION/$address/g" |\ sed -e 's/Q/"/g' |\ cat >> $spammid end cat $spamhead $spammid $additional $spamtail > $trap rm -f $spammid chmod a+r $trap $spamhead $spamtail # make a beep sound to indicate we are done: echo "" # head -50 $trap # echo ... # tail -20 $trap grep @ $trap | head echo ... grep @ $trap | tail exit old method: sed -e "s/^/\ LOCATION/' |\ sed -e "s/LOCATION/$address/g" |\ sed -e 's/Q/"/g' |\ sed -e 's,$,,' |\ if (-f $morenames) then echo adding names in $morenames and sorting them in cat $morenames |\ sed -e "s/^/\ /" |\ cat >> $spammid # cat $morenames >> $spammid mv $spammid $spammid.hold sort $spammid.hold > $spammid rm $spammid.hold endif