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

Pastebin

show all

PaniC posted at 2018-04-11 14:19:33 | hide line numbers

TOTP-Script v1.2

  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. #https://www.thepanic.eu/totpscript.html
  6. #Version 1.2
  7. #Released under GPL v2 or later
  8. #http://www.gnu.org/licenses/gpl-2.0.html
  9. secret="your secret" #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" #you see this windowname if you remove -borderless below
  12. windowsize="350x100" #well, the windowsize of the gxmessage window
  13. windowtimeout="4" #time the gxmessage window waits before it closes itself
  14. windowoparam="-borderless -wrap" #-borderless removes the gxmessage window border, -wrap lets the text wrap
  15.  
  16. ###     ***If you get strange Errors from line 22 or 25, start the script with "bash totp.sh"    ***
  17.  
  18. #tanlifetime only supports the default 30 seconds lifetime
  19. function tanlifetime {
  20. DATE=`date +%S`
  21. if [ "$DATE" -le "30" ]
  22. then
  23. timeleft=$(( 30-$DATE ))
  24. elif  [ "$DATE" -le "60" ]
  25. then
  26. timeleft=$(( 60-$DATE ))
  27. fi
  28. }
  29. function gettan {
  30. TAN="`oathtool --base32 --totp $secret`" &&
  31. echo $TAN | xclip -selection clipboard
  32. }
  33. tanlifetime &&
  34. if [ "$timeleft" -le "$oldtan" ]
  35. then
  36. sleeptime=$(( $timeleft+1 ))
  37. gxmessage -geometry $windowsize $windowoparam -timeout $sleeptime -center -title $windowname "New TAN in $sleeptime seconds" &
  38. sleep $sleeptime
  39. tanlifetime &&
  40. gettan &&
  41. gxmessage -geometry $windowsize $windowoparam -timeout $windowtimeout -center -title $windowname "TAN in clipboard, EOL in $timeleft seconds"
  42. else
  43. gettan &&
  44. gxmessage -geometry $windowsize $windowoparam -timeout $windowtimeout -center -title $windowname "TAN in clipboard, EOL in $timeleft seconds"
  45. fi
  46. exit 0