Coder Social home page Coder Social logo

rogerkeays / shotput Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 0.0 37 KB

A portable shell script to generate TOTPs from the command line.

Home Page: https://rogerkeays.com

License: GNU General Public License v3.0

Shell 100.00%
bash oath oathtool openssl otp scripts security sh totp

shotput's Introduction

shotput: shell otp utopia

A portable shell script to generate TOTPs from the command line.

Usage

shotput service [reveal]

Generates an OTP for the given service. If the service is not found, you will be prompted to provide a new secret key and an encryption password. New secrets are added to the config file in $HOME/.config/shotput.keys. Each secret is encrypted seperately and may use a different password.

If reveal is specified, the secret key for the given service will be displayed, rather than generating an OTP.

Examples

Add a new TOTP secret:

$ ./shotput example
Enter a new base32 secret key for example:GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ
Enter TOTP algorithm (default SHA1):SHA512
Enter TOTP timeout (default 30s):60
enter aes-256-cbc encryption password:
Verifying - enter aes-256-cbc encryption password:
Encrypted secret key for example and added to /home/username/.config/shotput.keys

enter aes-256-cbc decryption password:
166313

Check your secrets are encrypted:

$ cat ~/.config/shotput.keys
example="U2FsdGVkX19jANPjexyaiXOsTgZvdwKyWfDm4yWGh9rZ3G1iqfd5RyNX/hyGKmJOeeZYPF7FKrfD/dgRswb72Q== SHA512 60"

Generate an OTP:

$ ./shotput example
enter aes-256-cbc decryption password:
358094

Recover your secret key:

$ ./shotput example reveal
enter aes-256-cbc decryption password:
GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ
SHA512
60

Installation

shotput requires oathtool >=2.6.6 and openssl:

sudo apt install oathtool openssl

Place the shotput script on your path:

cd $HOME/bin
wget https://raw.githubusercontent.com/rogerkeays/shotput/main/shotput

Or clone with github:

git clone https://github.com/rogerkeays/shotput.git

Extracting Secret Keys From QR Codes

zbarimg can be used to decode QR codes. Save the QR code as an image file, and run:

sudo apt install zbar-tools
zbarimg $file

This should produce an otpauth:// URL which contains your secret key, and TOTP parameters.

Legacy Systems (Debian 10)

shotput can be made to work with older versions of oathtool that do not read from stdin. Replace oathtool - with oathtool $(cat /dev/stdin). This is not recommended on multi-user systems, because the plain text secret key will be visible to ps and other tools while oathtool is running.

Related Resources

shotput's People

Contributors

rogerkeays avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.