Skip to content

realChriss/otpcli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

otpcli

A secure, cross-platform command-line tool to generate Time-based One-Time Passwords (TOTP). It allows you to migrate your 2FA accounts directly from Google Authenticator to your desktop (Linux, Windows, & macOS).

Features

  • Direct Import: Reads the otpauth-migration:// QR codes generated by Google Authenticator.
  • Split Export Support: Automatically stitches together multiple QR codes if you have many accounts.
  • Secure Storage: Encrypts your secrets using AES-256-GCM with a key derived via Scrypt.
  • Cross-Platform: Runs natively on Linux, Windows, and macOS (Intel & Apple Silicon).
  • Zero Dependencies: Statically linked binary, no external runtime required.

Installation

Download Latest Binary

OS Architecture Download Link
Windows 64-bit Download .exe
Linux 64-bit Download Binary
macOS Apple Silicon (M1/M2) Download Binary
macOS Intel Download Binary

Note for Linux/macOS users: After downloading, make the file executable:

chmod +x otpcli-*
mv otpcli-* otpcli

Build from Source

Requirements: Go 1.21+

git clone https://github.com/realChriss/otpcli.git
cd otpcli
go mod download
go build -o otpcli main.go

Usage

1. Export from Google Authenticator

  1. Open Google Authenticator on your phone.
  2. Tap the menu -> Transfer accounts -> Export accounts.
  3. Select the accounts you want to transfer.
  4. Important: If you have many accounts, Google splits them into multiple QR codes.
    • Swipe Left on your phone to see subsequent codes.
    • Take screenshots of ALL QR codes shown.
  5. Transfer these images to your computer.

2. Setup / Import

Run the setup command passing all the screenshot files as arguments.

Windows:

.\otpcli.exe setup part1.jpg part2.jpg

Linux / Mac:

./otpcli setup part1.png part2.png

The tool will stitch the data together, prompt for a Master Password, and save the encrypted data to ~/.otpcli.dat.

3. Generate Codes

Simply run the tool without arguments:

./otpcli

Output:

CODE    TTL  NAME
123456  28s  user@example.com (Google)
987654  28s  user (GitHub)

License

MIT

About

Generate Google Authenticator codes on your machine

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages