Hello everyone ๐
I recently built a new Python CLI tool called OTP CLI Utils โ a lightweight command-line utility to generate, validate, and manage Time-based One-Time Password (TOTP) codes. If you use Google Authenticator or work with 2FA systems, this tool can make your developer workflow a lot smoother.
๐ GitHub: https://github.com/dilanka-rathnasiri/otp-cli-utils
๐ PyPI: https://pypi.org/project/otp-cli-utils
๐ What It Does
OTP CLI Utils provides a simple interface to handle everything related to TOTP (used in 2FA systems). You can:
- ๐ Generate current OTP codes from a secret
- โ Validate OTP codes against a secret
- ๐ Generate secure random OTP secrets
- ๐ฑ Create Google Authenticator compatible QR codes
- ๐งฐ All from your command line, no web tools or GUIs needed
โ๏ธ Installation
You can install it easily from PyPI:
pip install otp-cli-utils
๐ก Usage Examples
๐น Generate the Current OTP Code
otp-cli-utils get-otp <secret>
Example:
otp-cli-utils get-otp ABCDEF1234567890
๐น Validate an OTP
Check if an OTP code is valid for a given secret.
otp-cli-utils validate <secret> <otp> [--window-count <count> | --time-period <seconds>]
Examples:
otp-cli-utils validate ABCDEF1234567890 123456
otp-cli-utils validate ABCDEF1234567890 123456 --window-count 2
otp-cli-utils validate ABCDEF1234567890 123456 --time-period 120
๐น Generate a New OTP Secret
otp-cli-utils generate-secret
๐น Create a QR Code for Google Authenticator
Easily generate a QR code image to scan directly with authenticator apps.
otp-cli-utils generate-secret-qr-code "user@example.com" "GitHub" github_2fa
๐ค Contribute
Contributions, ideas, and feedback are welcome!
Check out the project on GitHub and feel free to open an issue or PR.
๐งพ License
Released under the MIT License โ completely open source.
Top comments (0)