func getPass(user string) { scanner := bufio.NewScanner(os.Stdin) cipher_pass := []byte(users.GetPassword(user)) fmt.Println("\nSitios almacenados:") passwords.ListSites(user) fmt.Print("\nIntroduce el site que quieres consultar: ") scanner.Scan() site := scanner.Text() entry := passwords.GetPassword(user, site) if entry.Pass == nil { fmt.Println("El sitio no existe") } else { pass := passcipher.Decipher(entry.Pass, cipher_pass) notes := passcipher.Decipher(entry.Notes, cipher_pass) fmt.Printf("Sitio %s\n", site) fmt.Printf("Login: %s\n", entry.Login) fmt.Printf("Password: %s\n", string(pass)) fmt.Printf("Notas: %s\n", string(notes)) } }
func addPass(user string) { scanner := bufio.NewScanner(os.Stdin) cipher_pass := []byte(users.GetPassword(user)) fmt.Print("Nombre del sitio web: ") scanner.Scan() site := scanner.Text() fmt.Print("Nombre de usuario del sitio web: ") scanner.Scan() login := scanner.Text() fmt.Print("Contraseña del sitio web: ") scanner.Scan() pass := passcipher.Cipher(scanner.Bytes(), cipher_pass) fmt.Print("Alguna nota o pista: ") scanner.Scan() notes := passcipher.Cipher(scanner.Bytes(), cipher_pass) entry := passwords.CreatePasswordEntry(login, pass, notes) passwords.StorePassword(user, site, entry) }