44 lines
752 B
Go
44 lines
752 B
Go
package main
|
|
|
|
import (
|
|
"create/password"
|
|
"create/web"
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
var input string // Users inputted password
|
|
|
|
fmt.Println("Welcome to Password Checker")
|
|
|
|
// Fetch common words
|
|
commonWords, err := web.FetchCommonWords()
|
|
if err != nil {
|
|
fmt.Printf("ERROR: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
// Fetch common passwords
|
|
commonPasswords, err := web.FetchCommonPasswords()
|
|
if err != nil {
|
|
fmt.Printf("ERROR: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
for {
|
|
|
|
// Fetch user input
|
|
fmt.Print("Enter your password: ")
|
|
fmt.Scanf("%s", &input)
|
|
fmt.Println(input)
|
|
|
|
// Check users password
|
|
message, err := password.Check(input, commonWords, commonPasswords)
|
|
if err != nil {
|
|
fmt.Printf("ERROR: %v\n", err)
|
|
}
|
|
fmt.Println(message)
|
|
}
|
|
}
|