diff options
author | Andinus <andinus@nand.sh> | 2020-04-11 16:28:16 +0530 |
---|---|---|
committer | Andinus <andinus@nand.sh> | 2020-04-11 16:28:16 +0530 |
commit | a9de3eef47cac76791574444380d3cd993d34e1e (patch) | |
tree | 0127c2a3897543f2fbe6f918d8f807659bd94fe4 /cmd | |
parent | 6fe535caf174eab6c90e5e6b5129e7f4a3949b86 (diff) | |
download | orion-a9de3eef47cac76791574444380d3cd993d34e1e.tar.gz |
Reinitialize project
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/orion/orion.go | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/cmd/orion/orion.go b/cmd/orion/orion.go deleted file mode 100644 index e3ce011..0000000 --- a/cmd/orion/orion.go +++ /dev/null @@ -1,55 +0,0 @@ -package main - -import ( - "os" - "time" - - "framagit.org/andinus/orion/hibp" - - "github.com/AlecAivazis/survey/v2" - "github.com/AlecAivazis/survey/v2/terminal" - "github.com/briandowns/spinner" - "github.com/fatih/color" -) - -func main() { - var pass string - - prompt := &survey.Password{ - Message: "Password:", - Help: "Enter password to be checked against HIBP's Database", - } - err := survey.AskOne(prompt, &pass, survey.WithValidator(survey.Required)) - if err == terminal.InterruptErr { - color.Yellow("Interrupt Received") - os.Exit(0) - } else if err != nil { - panic(err) - } - - s := spinner.New(spinner.CharSets[12], 32*time.Millisecond) - s.Start() - s.Color("cyan") - - // get password hash - hsh := hibp.GetHsh(pass) - - // get list of pwned passwords - list, err := hibp.GetPwned(hsh) - if err != nil { - color.Yellow(err.Error()) - os.Exit(1) - } - - // check if pass is pwned - pwn, fq := hibp.ChkPwn(list, hsh) - s.Stop() - - if pwn { - color.New(color.FgRed).Add(color.Bold).Println("\nPwned!") - color.Yellow("This password has been seen %s times before.", fq) - return - } - - color.Green("\nPassword wasn't found in Have I Been Pwned's Database") -} |