|
|
@ -16,7 +16,7 @@ |
|
|
|
# You should have received a copy of the GNU General Public License |
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
|
|
|
|
|
|
import re, sys, getpass |
|
|
|
import re, sys |
|
|
|
|
|
|
|
try: |
|
|
|
import ecdsa |
|
|
@ -31,9 +31,9 @@ except: |
|
|
|
sys.exit(1) |
|
|
|
|
|
|
|
try: |
|
|
|
from lib import Wallet, WalletSynchronizer, format_satoshis, mnemonic |
|
|
|
from lib import Wallet, WalletSynchronizer, format_satoshis, mnemonic, prompt_password |
|
|
|
except ImportError: |
|
|
|
from electrum import Wallet, WalletSynchronizer, format_satoshis, mnemonic |
|
|
|
from electrum import Wallet, WalletSynchronizer, format_satoshis, mnemonic, prompt_password |
|
|
|
|
|
|
|
from optparse import OptionParser |
|
|
|
from decimal import Decimal |
|
|
@ -178,14 +178,7 @@ if __name__ == '__main__': |
|
|
|
if wallet.file_exists: |
|
|
|
print "remove the existing wallet first!" |
|
|
|
sys.exit(0) |
|
|
|
password = getpass.getpass("Password (hit return if you do not wish to encrypt your wallet):") |
|
|
|
if password: |
|
|
|
password2 = getpass.getpass("Confirm password:") |
|
|
|
if password != password2: |
|
|
|
print "error" |
|
|
|
sys.exit(1) |
|
|
|
else: |
|
|
|
password = None |
|
|
|
password = prompt_password("Password (hit return if you do not wish to encrypt your wallet):") |
|
|
|
|
|
|
|
w_host, w_port, w_protocol = wallet.server.split(':') |
|
|
|
host = raw_input("server (default:%s):"%w_host) |
|
|
@ -269,12 +262,12 @@ if __name__ == '__main__': |
|
|
|
|
|
|
|
# commands needing password |
|
|
|
if cmd in protected_commands or ( cmd=='addresses' and options.show_keys): |
|
|
|
password = getpass.getpass('Password:') if wallet.use_encryption and not is_temporary else None |
|
|
|
password = prompt_password('Password:') if wallet.use_encryption and not is_temporary else None |
|
|
|
# check password |
|
|
|
try: |
|
|
|
wallet.pw_decode( wallet.seed, password) |
|
|
|
except: |
|
|
|
print "invalid password" |
|
|
|
print "Error: This password does not decode this wallet." |
|
|
|
exit(1) |
|
|
|
|
|
|
|
if cmd == 'import': |
|
|
@ -435,7 +428,7 @@ if __name__ == '__main__': |
|
|
|
elif cmd in ['payto', 'mktx']: |
|
|
|
if from_addr and is_temporary: |
|
|
|
if from_addr.find(":") == -1: |
|
|
|
keypair = from_addr + ":" + getpass.getpass('Private key:') |
|
|
|
keypair = from_addr + ":" + prompt_password('Private key:', False) |
|
|
|
else: |
|
|
|
keypair = from_addr |
|
|
|
from_addr = keypair.split(':')[0] |
|
|
@ -484,13 +477,11 @@ if __name__ == '__main__': |
|
|
|
try: |
|
|
|
seed = wallet.pw_decode( wallet.seed, password) |
|
|
|
except: |
|
|
|
print "sorry" |
|
|
|
print "Error: Password does not decrypt this wallet." |
|
|
|
sys.exit(1) |
|
|
|
new_password = getpass.getpass('New password:') |
|
|
|
if new_password == getpass.getpass('Confirm new password:'): |
|
|
|
wallet.update_password(seed, password, new_password) |
|
|
|
else: |
|
|
|
print "error: mismatch" |
|
|
|
|
|
|
|
new_password = prompt_password('New password:') |
|
|
|
wallet.update_password(seed, password, new_password) |
|
|
|
|
|
|
|
elif cmd == 'signmessage': |
|
|
|
address = args[1] |
|
|
|