[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [OATH-Toolkit-help] OATH token time drift / synchronisation turnarou
From: |
Simon Josefsson |
Subject: |
Re: [OATH-Toolkit-help] OATH token time drift / synchronisation turnaround |
Date: |
Tue, 19 May 2015 12:19:40 +0200 |
User-agent: |
Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.4 (gnu/linux) |
Andrew McGlashan <address@hidden> writes:
> 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
Nice snippet. Note that since you used HTTP a man-in-the-middle may
replace the time value fetched from the server to make this script
return OATH codes for other than the current time.
/Simon
signature.asc
Description: PGP signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [OATH-Toolkit-help] OATH token time drift / synchronisation turnaround,
Simon Josefsson <=