Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.
/ psgen Public archive

A CLI tool for local passwords management

License

Notifications You must be signed in to change notification settings

Wa4h1h/psgen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PSGEN

psgen is CLI tool for local password management. You can generate passwords and optionally store them in a local SQLite database. The password db can be exported to a CSV file. Additionally a CSV file with passwords can be imported to the db. Stored passwords are encrypted using AES encryption.

Config

psgen configuration and the sqlite db are both stored within ~/.psgen folder.
Configuration example:

{
    "enc_key":"82sdnT0W1axo7GdhhmeFYwLsMkLXhoqKJRamkenWHRU=",
    "execution_timeout":5,
    "db_path":"/home_path/.psgen/psgen.db",
    "logs_path":"/home_path/.psgen/logs"
}

enc_key: a base64 string representing a sequence of 32 bytes
execution_timeout: max number of second, that a db operation can take
db_path: path of the sqlite db
logs_path: errors are stored in log files, that resides in /home_path/.psgen/logs folder\

To display errors within the current shell, PSGEN_ERR_LOGS environment variable must be exported

$ export PSGEN_ERR_LOGS=true

Example

$ go run main.go gen -s  -d -ln=25
password:  w0+,@,+i>29-f34^y^810wuq`
Store password? Y[yes] yes
Give password key: password-key
Password successfully generated%

Usage

$ go run main.go --help 
Usage: psgen <command> -[-]<flags>
Commands:
gen             generates a password
get             retrieves a password from the local sqlite db and prints it out
export          exports the stored passwords from the local sqlite db to an csv file
import          imports passwords from a csv file into the local sqlite db
help            show help

Use psgen <command> -h or --help for more information about a command.

install

go install github.com/Wa4h1h/psgen@latest

Run

Execute

psgen <command> -[-]<flags>

Execute using go command

$ go run main.go <command> -[-]<flags>

Execute binary:

  1. Build the binaries for darwin and linux OS
$ make
Building binary....
GOARCH=arm64 GOOS=darwin go build -o ./builds/darwin/psgen main.go
GOARCH=amd64 GOOS=linux go build -o ./builds/linux/psgen main.go
  1. run the binary
$ cd builds/darwin
$ ./psgen <command> -[-]<flags>
$ cd builds/linux
$ ./psgen <command> -[-]<flags>

NOTE

I was only interested in the concepts of CLI applications, flag parsing in Go and how to implement them, so I skipped the tests implementation and code clean-up.

About

A CLI tool for local passwords management

Resources

License

Stars

Watchers

Forks

Packages

No packages published