Evil|Clan HOME EVIL|ARCHIVE Evil|Clan
HOME EVIL|ARCHIVE PASTEBIN PRIVACY CONTACT

Pastebin

show all

PaniC posted at 2018-04-09 20:16:06 | hide line numbers

TOTP-Script v1.1

  1. #!/bin/bash
  2. #Small bashscript to get a TAN from oathtool, copy TAN to clipboard and output a small window with TAN-lifetime
  3. #requirements: gxmessage, oathtool and xclip; apt-get install xclip oathtool gxmessage
  4. #(C) 2018 ThEPaniC/Evil|Pan!C -> mail (at) thepanic.eu
  5. #Version 1.1
  6. #Released under GPL v2 or later
  7. #http://www.gnu.org/licenses/gpl-2.0.html
  8.  
  9. secret="secret here" #your base32 encoded secret
  10. oldtan="5" #Time in Seconds to specify a old TAN, set this value higher if you need more time to paste your TAN
  11. windowname="TOTP-Script"
  12. windowsize="350x100"
  13. windowtimeout="5"
  14. windowoparam="-borderless -wrap"
  15.  
  16.  
  17. #tanlifetime only supports the default 30 seconds lifetime
  18. function tanlifetime {
  19. DATE=`date +%S`
  20. if [ "$DATE" -le "30" ]
  21. then
  22. timeleft=$(( 30-$DATE ))
  23. elif  [ "$DATE" -le "60" ]
  24. then
  25. timeleft=$(( 60-$DATE ))
  26. fi
  27. }
  28. function gettan {
  29. TAN="`oathtool --base32 --totp $secret`" &&
  30. echo $TAN | xclip -selection clipboard
  31. }
  32. tanlifetime &&
  33. if [ "$timeleft" -le "$oldtan" ]
  34. then
  35. sleeptime=$(( $timeleft+1 ))
  36. gxmessage -geometry $windowsize $windowoparam -timeout $sleeptime -center -title $windowname "short TAN lifetime please wait $sleeptime seconds for a new TAN" &
  37. sleep $sleeptime
  38. tanlifetime &&
  39. gettan &&
  40. gxmessage -geometry $windowsize $windowoparam -timeout $windowtimeout -center -title $windowname "TAN in clipboard lifetime: $timeleft seconds"
  41. else
  42. gettan &&
  43. gxmessage -geometry $windowsize $windowoparam -timeout $windowtimeout -center -title $windowname "TAN in clipboard lifetime: $timeleft seconds"
  44. fi
  45. exit 0