Skip to content

Commit 0f63504

Browse files
committed
Changed bitrpc.py's raw_input to getpass for passwords to conceal characters during command line input. Getpass is in Python stdlib so no additional dependencies required.
1 parent 85bba09 commit 0f63504

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

contrib/bitrpc/bitrpc.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from jsonrpc import ServiceProxy
22
import sys
33
import string
4+
import getpass
45

56
# ===== BEGIN USER SETTINGS =====
67
# if you do not set these you will be prompted for a password for every command
@@ -302,16 +303,16 @@
302303

303304
elif cmd == "walletpassphrase":
304305
try:
305-
pwd = raw_input("Enter wallet passphrase: ")
306+
pwd = getpass.getpass(prompt="Enter wallet passphrase: ")
306307
access.walletpassphrase(pwd, 60)
307308
print "\n---Wallet unlocked---\n"
308309
except:
309310
print "\n---An error occurred---\n"
310311

311312
elif cmd == "walletpassphrasechange":
312313
try:
313-
pwd = raw_input("Enter old wallet passphrase: ")
314-
pwd2 = raw_input("Enter new wallet passphrase: ")
314+
pwd = getpass.getpass(prompt="Enter old wallet passphrase: ")
315+
pwd2 = getpass.getpass(prompt="Enter new wallet passphrase: ")
315316
access.walletpassphrasechange(pwd, pwd2)
316317
print
317318
print "\n---Passphrase changed---\n"

0 commit comments

Comments
 (0)