25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00
xmpp.chapril.org-ejabberd/tools/captcha.sh
Evgeniy Khramtsov 9aadefa5b0 * tools/captcha.sh: sample CAPTCHA script.
SVN Revision: 1993
2009-03-13 16:38:28 +00:00

22 lines
456 B
Bash
Executable File

#!/bin/sh
SIGN=$(($RANDOM % 2))
R1=$(($RANDOM % 20))
R2=$(($RANDOM % 10 + 40))
if [ $SIGN -eq "0" ]; then
S1=$(( -1*($RANDOM % 20 + 50) ))
S2=$(( $RANDOM % 20 + 50 ))
else
S2=$(( -1*($RANDOM % 20 + 50) ))
S1=$(( $RANDOM % 20 + 50 ))
fi
convert -size 140x60 xc:white \
-pointsize 30 -draw "text 20,30 '$1'" \
-roll -$R2+$R1 -swirl $S1 \
-roll +$R2-$R1 -swirl $S2 \
+repage -resize 120x60 \
-quality 90 -depth 8 png:-