shelldoor/cmd/shutil/main.go

37 lines
584 B
Go
Raw Permalink Normal View History

2024-09-28 19:26:08 +03:00
package main
import (
"log"
"os"
"surdeus.su/core/cli/mtool"
"surdeus.su/util/shelldoor/servers"
)
var HashTool = mtool.T("hash").
Func(func(flags *mtool.Flags) {
passwords := flags.Parse()
if len(passwords) < 1 {
flags.Usage()
os.Exit(1)
}
for _, password := range passwords {
hash, err := servers.HashPassword(
servers.Password(password),
)
if err != nil {
log.Printf("HashPassword(...): %s\n", err)
continue
}
log.Printf("%s\n", hash)
}
})
var Tool = mtool.T("shutil").Subs(
HashTool,
)
func main() {
Tool.Run(os.Args[1:])
}