From bed2eb36d382ff37ef20f5cd1ddea5f2530a4e4b Mon Sep 17 00:00:00 2001 From: Richard Barrell Date: Wed, 3 Sep 2014 12:33:54 +0100 Subject: [PATCH] Issue 8872: use getpass.getpass() to read password. This avoids passing the plaintext raw password into the script as a command-line argument, which shells such as bash and zsh will typically log into a file like ~/bash_history. As a small bonus, this works a LOT more smoothly if the user's password has characters in it that either the shell or Python syntax might like to interpret as metacharacters, like '\' or '"'. getpass.getpass() is part of Python's standard library in all versions between 2.4 and 3.3 at least. --- docsite/rst/faq.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docsite/rst/faq.rst b/docsite/rst/faq.rst index 6c0287ae51cdaf..1d755686a23093 100644 --- a/docsite/rst/faq.rst +++ b/docsite/rst/faq.rst @@ -217,7 +217,7 @@ password hashing library is installed. Once the library is ready, SHA512 password values can then be generated as follows:: - python -c "from passlib.hash import sha512_crypt; print sha512_crypt.encrypt('')" + python -c "from passlib.hash import sha512_crypt; import getpass; print sha512_crypt.encrypt(getpass.getpass())" .. _commercial_support: