19 print(
"WebIOPi passwd file generator")
20 if len(sys.argv) == 2:
22 if file ==
"--help" or file ==
"-h":
23 print(
"Usage: webiopi-passwd [--help|file]")
24 print(
"Compute and display hash used by WebIOPi for Authentication")
25 print(
"Login and Password are prompted")
26 print(
"\t--help\tDisplay this help")
28 print(
"\tfile\tSave hash to file")
31 file =
"/etc/webiopi/passwd"
34 _LOGIN =
"Enter Login: "
35 _PASSWORD =
"Enter Password: "
36 _CONFIRM =
"Confirm password: "
37 _DONTMATCH =
"Passwords don't match !"
41 login = raw_input(_LOGIN)
44 password = getpass.getpass(_PASSWORD)
45 password2 = getpass.getpass(_CONFIRM)
46 while password != password2:
48 password = getpass.getpass(_PASSWORD)
49 password2 = getpass.getpass(_CONFIRM)
53 print(
"\nHash: %s" % auth)
57 print(
"Saved to %s" % file)