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.
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
$ 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%
$ 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.
go install github.com/Wa4h1h/psgen@latest
Execute
psgen <command> -[-]<flags>
Execute using go command
$ go run main.go <command> -[-]<flags>
Execute binary:
- 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
- run the binary
$ cd builds/darwin
$ ./psgen <command> -[-]<flags>
$ cd builds/linux
$ ./psgen <command> -[-]<flags>
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.