Example #1
0
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))
	}

}
Example #2
0
func deletePass(user string) {
	scanner := bufio.NewScanner(os.Stdin)

	fmt.Println("\nSitios almacenados:")
	passwords.ListSites(user)

	fmt.Print("\nIntroduce el site que quieres eliminar: ")
	scanner.Scan()
	site := scanner.Text()

	entry := passwords.GetPassword(user, site)
	if entry.Pass == nil {
		fmt.Println("El sitio no existe")
	} else {
		passwords.DeletePassword(user, site, entry)
	}
}