Skip to content

Instantly share code, notes, and snippets.

@levrik

levrik/main.go Secret

Created November 21, 2017 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save levrik/99210259065679da20c3c66ef383eea9 to your computer and use it in GitHub Desktop.
Save levrik/99210259065679da20c3c66ef383eea9 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"os"
"golang.org/x/crypto/ssh/terminal"
)
func main() {
fmt.Print("Enter password for test-user: ")
res, err := terminal.ReadPassword(int(os.Stdin.Fd()))
if err != nil {
fmt.Fprintf(os.Stderr, "\nFailed to read password: %s\n", err)
os.Exit(1)
}
fmt.Println(string(res))
fmt.Println()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment