Skip to content

jormin/gacode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google Authenticator Code

Build Status Codecov Go Report Card

This is a tool to manage accounts and codes of Google Authenticator.

Support

Account
  • Add an existing account
  • Generate a new account
  • Print or Export the QR code image
  • List all accounts configured
  • Remove specified or all accounts
Code
  • Show codes of specified or all accounts

Install

There are two ways to install gacode:

  1. Download the binary file of the corresponding system and corresponding architecture from the release page,then rename and move it to your bin path such as /usr/local/bin.

  2. Clone source code then install it by yourself

    # clone source code
    git clone https://github.com/jormin/gacode.git
    
    # download module
    go mod download
    
    # install
    go install
    

Command

NAME:
   gacode - The tool to manage accounts and codes of Google Authenticator.

USAGE:
   gacode [global options] command [command options] [arguments...]

VERSION:
   v1.0.0

COMMANDS:
   account  Manage accounts of Google Authenticator
   code     Show codes of Google Authenticator
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h     show help (default: false)
   --version, -v  print the version (default: false)

Example

Account
  • Add an existing account
~ gacode account add test HIUKS7E5ZDQXM2HLQH5USZ7HZUQASSDQ
add account success.
name: test
secret: HIUKS7E5ZDQXM2HLQH5USZ7HZUQASSDQ
qrcode: otpauth://totp/test?secret=HIUKS7E5ZDQXM2HLQH5USZ7HZUQASSDQ
  • Generate a new account
~ gacode account gen test2                                
generate account success.
name: test2
secret: KR2OSN2GXPQL2FARNUHTFHZWLUSSGEZ4
qrcode:otpauth://totp/test2?secret=KR2OSN2GXPQL2FARNUHTFHZWLUSSGEZ4
  • Print the QR code image
image-20210904005423753
  • Export the QR code image with flag -o
~ gacode account qr -o ~/Desktop test
export the QR code success: /Users/Jormin/Desktop/c4p583l948169o90rrhg.png
  • List all accounts configured
~ gacode account ls
Name      Secret                               QRCode
test      HIUKS7E5ZDQXM2HLQH5USZ7HZUQASSDQ     otpauth://totp/test?secret=HIUKS7E5ZDQXM2HLQH5USZ7HZUQASSDQ
test2     KR2OSN2GXPQL2FARNUHTFHZWLUSSGEZ4     otpauth://totp/test2?secret=KR2OSN2GXPQL2FARNUHTFHZWLUSSGEZ4
  • Remove specified accounts
~ gacode account rm test test2
remove account test success
remove account test2 success
  • remove all accounts with tag -a
~ gacode account rm -a
remove all accounts success 
Code
  • Show codes of specified accounts
~ gacode code test1 test2
Account     Code       Remain Time
test1       649669     05 Seconds
test2       660560     05 Seconds
  • Show codes of all accounts with tag -a
~ gacode code -a
Account     Code       Remain Time
test1       649669     05 Seconds
test2       660560     05 Seconds
test3       387946     05 Seconds
  • Cycle show codes every second with tag -t
~ gacode code -a -t
Account     Code       Remain Time
test1       649669     05 Seconds
test2       660560     05 Seconds
test3       387946     05 Seconds

License

under the MIT License