[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [OATH-Toolkit-help] OATH token time drift / synchronisation turnarou
From: |
Andrew McGlashan |
Subject: |
Re: [OATH-Toolkit-help] OATH token time drift / synchronisation turnaround |
Date: |
Mon, 22 Jul 2013 06:06:02 +1000 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 |
Hi,
Simpler again ;)
- no sed, no tr, no /dev/null redirection
#!/bin/bash
SECRET=my_base32_secret
SERVER_URL=http://google.com
while :
do
NOW=$(curl -Is $SERVER_URL|grep ^Date:\ )
# strip first 6 characters (Date: ) & the new line (\n)
NOW=${NOW:6:-1}
echo "$NOW -- $(date) -- $( \
/usr/bin/oathtool --totp -b -d 6 \
--now="$NOW" $SECRET \
)"
sleep 1
done
Cheers
A.