From 2376dc784b2ec4dce07f235cc16981b582b58114 Mon Sep 17 00:00:00 2001 From: Dwerg <35254268+Dwerg@users.noreply.github.com> Date: Wed, 21 Feb 2018 15:39:57 +0100 Subject: [PATCH] Checks if wallet.dat and config.ini is in folder Checks if wallet.dat and config.ini is in same folder as the script. Small update to the bat file that tries 3 ways of running the script. --- Extract keys.bat | 10 +++++++--- walletaid.py | 15 ++++++++++----- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Extract keys.bat b/Extract keys.bat index 59c7c31..1047cee 100644 --- a/Extract keys.bat +++ b/Extract keys.bat @@ -1,11 +1,15 @@ @echo off -python walletaid.py +walletaid.py +IF ERRORLEVEL 1 ( + CLS + python walletaid.py +) IF ERRORLEVEL 1 ( CLS "C:\python27\python.exe" walletaid.py ) -if ERRORLEVEL 1 ( +IF ERRORLEVEL 1 ( CLS ECHO Check Python install ) -@pause +@pause \ No newline at end of file diff --git a/walletaid.py b/walletaid.py index 422dff6..e5647bb 100644 --- a/walletaid.py +++ b/walletaid.py @@ -7,10 +7,19 @@ is borrowed from pywallet. import hashlib import binascii +from os import path from ConfigParser import SafeConfigParser -#Opens config.ini and gets settings +#Opens config.ini and gets settings, checks if wallet.dat is in folder config = SafeConfigParser() + +if not path.exists("config.ini"): + print "The config.ini file was not found" + exit(0) +if not path.exists("wallet.dat"): + print "The wallet.dat file is not in folder or has different name" + exit(0) + config.read("config.ini") pubprefix = config.get("settings", "pubkeyprefix") privprefix = config.get("settings", "privkeyprefix") @@ -115,10 +124,6 @@ def hashtowif(b): def address(c): pubkey = str(g * c) pubkey = ("0" * (64 - pubkey.index(" "))) + pubkey - #if pubkey[63] == " ": - # pubkey = "0" + pubkey - #if pubkey[62] == " ": - # pubkey = "00" + pubkey if compressed: if int(pubkey[-1], base=16) % 2 == 0: pref = "02"