Browse Source

Captcha : instructions are now thin, text is bold

master
Adrien Bourmault 11 months ago
committed by root
parent
commit
1b9052bdc4
  1. 24
      captcha/captcha.sh
  2. 26
      captcha/experimental.sh

24
captcha/captcha.sh

@ -50,7 +50,7 @@ INTRUS()
# Worst case
if [[ $INTRUS -eq "-1" ]]
then
echo Tapez "$INPUT \n sans changement"
echo Tapez "$INPUT |sans changement"
return
fi
@ -70,9 +70,9 @@ INTRUS()
R=$(($R % 100))
if [[ $R -lt 50 ]]; then
echo "Tapez | $NEWINPUT | en supprimant les ${DIGIT[$INTRUS]}"
echo "Tapez | $NEWINPUT |en supprimant les ${DIGIT[$INTRUS]}"
else
echo "Saisissez | $NEWINPUT | en enlevant les ${DIGIT[$INTRUS]}"
echo "Saisissez | $NEWINPUT |en enlevant les ${DIGIT[$INTRUS]}"
fi
}
@ -105,8 +105,6 @@ SOMME()
fi
}
get_random
RAND_ANGLE=$(($R % 3))
get_random
RAND_INDEX=$(($R % ${#TRANSFORMATIONS[@]}))
@ -114,23 +112,23 @@ INSTRUCTIONS=$(echo "$(${TRANSFORMATIONS[$RAND_INDEX]})" | cut -d "|" -f 1)
INSTRUCTIONS2=$(echo "$(${TRANSFORMATIONS[$RAND_INDEX]})" | cut -d "|" -f 3)
TEXT=$(echo "$(${TRANSFORMATIONS[$RAND_INDEX]})" | cut -d "|" -f 2)
convert -size 300x70 xc:none -pointsize 20 \
convert -size 300x60 xc:none -pointsize 20 \
\( -clone 0 -fill black \
-stroke black -strokewidth 1 \
-annotate "${RAND_ANGLE}x25+0+0" "\n $INSTRUCTIONS" \
-annotate "${RAND_ANGLE}x0+0+20" "\n $TEXT" \
-annotate "${RAND_ANGLE}x25+0+40" "\n $INSTRUCTIONS2" \
-font Helvetica-Narrow -weight Thin -annotate "0x0+0+0" "\n $INSTRUCTIONS" \
-font Helvetica-Bold -weight Light -annotate "0x0+0+18" "\n $TEXT" \
-font Helvetica-Narrow -weight Thin -annotate "0x0+0+35" "\n $INSTRUCTIONS2" \
-roll +$ROLL_X+0 \
-wave "$WAVE1_AMPLITUDE"x"$WAVE1_LENGTH" \
-roll -$ROLL_X+0 \) \
-flatten -crop 300x60 +repage -quality 500 -depth 11 png:"/var/lib/ejabberd/chapril_captchas/$(date "+%Y-%m-%d-%H%M%S")_${INPUT}.png"
convert -size 300x70 xc:none -pointsize 20 \
convert -size 300x60 xc:none -pointsize 20 \
\( -clone 0 -fill black \
-stroke black -strokewidth 1 \
-annotate "${RAND_ANGLE}x25+0+0" "\n $INSTRUCTIONS" \
-annotate "${RAND_ANGLE}x0+0+20" "\n $TEXT" \
-annotate "${RAND_ANGLE}x25+0+40" "\n $INSTRUCTIONS2" \
-font Helvetica-Narrow -weight Thin -annotate "0x0+0+0" "\n $INSTRUCTIONS" \
-font Helvetica-Bold -annotate "0x0+0+18" "\n $TEXT" \
-font Helvetica-Narrow -weight Thin -annotate "0x0+0+36" "\n $INSTRUCTIONS2" \
-roll +$ROLL_X+0 \
-wave "$WAVE1_AMPLITUDE"x"$WAVE1_LENGTH" \
-roll -$ROLL_X+0 \) \

26
captcha/experimental.sh

@ -50,7 +50,7 @@ INTRUS()
# Worst case
if [[ $INTRUS -eq "-1" ]]
then
echo Tapez "$INPUT \n sans changement"
echo Tapez "$INPUT |sans changement"
return
fi
@ -70,9 +70,9 @@ INTRUS()
R=$(($R % 100))
if [[ $R -lt 50 ]]; then
echo "Tapez | $NEWINPUT | en supprimant les ${DIGIT[$INTRUS]}"
echo "Tapez | $NEWINPUT |en supprimant les ${DIGIT[$INTRUS]}"
else
echo "Saisissez | $NEWINPUT | en enlevant les ${DIGIT[$INTRUS]}"
echo "Saisissez | $NEWINPUT |en enlevant les ${DIGIT[$INTRUS]}"
fi
}
@ -105,8 +105,6 @@ SOMME()
fi
}
get_random
RAND_ANGLE=$(($R % 3))
get_random
RAND_INDEX=$(($R % ${#TRANSFORMATIONS[@]}))
@ -114,23 +112,23 @@ INSTRUCTIONS=$(echo "$(${TRANSFORMATIONS[$RAND_INDEX]})" | cut -d "|" -f 1)
INSTRUCTIONS2=$(echo "$(${TRANSFORMATIONS[$RAND_INDEX]})" | cut -d "|" -f 3)
TEXT=$(echo "$(${TRANSFORMATIONS[$RAND_INDEX]})" | cut -d "|" -f 2)
convert -size 300x70 xc:none -pointsize 20 \
convert -size 300x60 xc:none -pointsize 20 \
\( -clone 0 -fill black \
-stroke black -strokewidth 1 \
-annotate "${RAND_ANGLE}x25+0+0" "\n $INSTRUCTIONS" \
-annotate "${RAND_ANGLE}x0+0+20" "\n $TEXT" \
-annotate "${RAND_ANGLE}x25+0+40" "\n $INSTRUCTIONS2" \
-font Helvetica-Narrow -weight Thin -annotate "0x0+0+0" "\n $INSTRUCTIONS" \
-font Helvetica-Bold -weight Light -annotate "0x0+0+18" "\n $TEXT" \
-font Helvetica-Narrow -weight Thin -annotate "0x0+0+35" "\n $INSTRUCTIONS2" \
-roll +$ROLL_X+0 \
-wave "$WAVE1_AMPLITUDE"x"$WAVE1_LENGTH" \
-roll -$ROLL_X+0 \) \
-flatten -crop 300x70 +repage -quality 500 -depth 11 png:"/var/lib/ejabberd/chapril_captchas/EXPERIMENTAL_$(date "+%Y-%m-%d-%H%M%S")_${INPUT}.png"
-flatten -crop 300x60 +repage -quality 500 -depth 11 png:"/var/lib/ejabberd/chapril_captchas/EXPERIMENTAL_$(date "+%Y-%m-%d-%H%M%S")_${INPUT}.png"
convert -size 300x70 xc:none -pointsize 20 \
convert -size 300x60 xc:none -pointsize 20 \
\( -clone 0 -fill black \
-stroke black -strokewidth 1 \
-annotate "${RAND_ANGLE}x25+0+0" "\n $INSTRUCTIONS" \
-annotate "${RAND_ANGLE}x0+0+20" "\n $TEXT" \
-annotate "${RAND_ANGLE}x25+0+40" "\n $INSTRUCTIONS2" \
-font Helvetica-Narrow -weight Thin -annotate "0x0+0+0" "\n $INSTRUCTIONS" \
-font Helvetica-Bold -annotate "0x0+0+18" "\n $TEXT" \
-font Helvetica-Narrow -weight Thin -annotate "0x0+0+36" "\n $INSTRUCTIONS2" \
-roll +$ROLL_X+0 \
-wave "$WAVE1_AMPLITUDE"x"$WAVE1_LENGTH" \
-roll -$ROLL_X+0 \) \

Loading…
Cancel
Save