From 46be1a990bbc9caaafe72815e5bcad9559704b05 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 31 Aug 2021 14:25:05 +0200 Subject: [PATCH] How to get all validated captchas ? --- captcha/get_validated_captchas.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 captcha/get_validated_captchas.sh diff --git a/captcha/get_validated_captchas.sh b/captcha/get_validated_captchas.sh new file mode 100755 index 0000000..968d497 --- /dev/null +++ b/captcha/get_validated_captchas.sh @@ -0,0 +1,23 @@ +#! /bin/bash + +dates=$(zcat /var/log/ejabberd/ejabberd* 2> /dev/null | grep "was registered" \ + | cut -d[ -f 1 | cut -c 1-16) + +SAVEIFS=$IFS # Save current IFS +IFS=$'\n' # Change IFS to new line + +dates=($dates) # Split to array +IFS=$SAVEIFS # Restore IFS + +greppattern="" + +for (( i=0; i<${#dates[@]}; i++ )) +do + greppattern="$greppattern -e \"$(echo ${dates[$i]})\"" +done + +#echo -e ${greppattern} + +grepcommand="ls -lt --full-time /var/lib/ejabberd/chapril_captchas | grep $greppattern | cut -d ' ' -f 9" + +eval $grepcommand