37 lines
584 B
Go
37 lines
584 B
Go
|
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:])
|
||
|
}
|