[bglug] programmatore alle prime armi e linux...

k|b|s kbs@bglug.it
Ven 9 Giu 2006 09:57:14 CEST


Paolo Asperti al scrîf:
> gestione parco macchine, calcolo busta paga, mailbombing (aka 
> phpmailer), ...) anche se spesso google ti fa risparmiare tempo e fatica.
Si può fare anche in bash... perchè scomodare php?
LOL

--8<-- CUT HERE --8<-- 
#!/bin/sh
#
# Forward the input n times to the given addresses.
# Used to send spam back to the orginator.
# Try inserting it in a procmail recipe...
# ;^)

tmp=/tmp/$$
cat >$tmp || exit $?

spamcount=100	# 100 copies by default
sleeprate=10	# sleep every 10 fws
sleeptime=120	# for 120 seconds

case $1 in
    -n)	spamcount=$2; shift; shift ;;
esac

xit=0

sleepcnt=$sleeprate
for addr
do  case $addr in
	*@*)	;;
	*)	echo "$0: bad address \"$addr\"" >&2
		xit=1
		continue
		;;
    esac

    i=0
    while [ $i -lt $spamcount ]
    do
     mailto -s "NO SPAM, THANKS!" "$addr" <$tmp
	i=`expr $i + 1`
	sleepcnt=`expr $sleepcnt - 1`
	case $sleepcnt in
	    0)	sleepcnt=$sleeprate
		sleep $sleeptime
		;;
	esac
    done
done

rm $tmp || xit=$?

exit $xit
--8<-- CUT HERE --8<-- 

Have fun.
;^)

-- 
011010110110001001110011010000000110001001100111
011011000111010101100111001011100110100101110100


Maggiori informazioni sulla lista bglug