Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.

Commit

Permalink
fix minor warts in blockchain extract scripts
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
gurnec committed Oct 13, 2017
1 parent 1b03755 commit 7e5c735
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions extract-scripts/extract-blockchain-main-data.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@
# The number of pbkdf2 iterations, or 0 for v0.0 wallet files which don't specify this
iter_count = 0

class MayBeBlockchainV0: pass; # an exception which jumps to the end of the try block below
class MayBeBlockchainV0(BaseException): pass; # an exception which jumps to the end of the try block below
try:

# Most blockchain files (except v0.0 wallets) are JSON encoded; try to parse it as such
try:
data = json.loads(data)
except ValueError:
raise MayBeBlockchainV0();
raise MayBeBlockchainV0()

# Config files have no version attribute; they encapsulate the wallet file plus some detrius
if u"version" not in data:
Expand All @@ -58,14 +58,14 @@ class MayBeBlockchainV0: pass; # an exception which jumps to the end of the try
try:
data = json.loads(data) # try again to parse a v2.0/v3.0 JSON-encoded wallet file
except ValueError:
raise MayBeBlockchainV0();
raise MayBeBlockchainV0()

# Extract what's needed from a v2.0/3.0 wallet file
if data[u"version"] > 3:
raise NotImplementedError("Unsupported Blockchain wallet version " + tstr(data[u"version"]))
raise NotImplementedError("Unsupported Blockchain wallet version " + str(data[u"version"]))
iter_count = data[u"pbkdf2_iterations"]
if not isinstance(iter_count, int) or iter_count < 1:
raise ValueError("Invalid Blockchain pbkdf2_iterations " + tstr(iter_count))
raise ValueError("Invalid Blockchain pbkdf2_iterations " + str(iter_count))
data = data[u"payload"]

except MayBeBlockchainV0:
Expand Down
10 changes: 5 additions & 5 deletions extract-scripts/extract-blockchain-second-hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ def aes256_decrypt(key, iv, ciphertext):
iter_count = 0

try:
class MayBeBlockchainV0: pass; # an exception which jumps to the end of the try block below
class MayBeBlockchainV0(BaseException): pass; # an exception which jumps to the end of the try block below
try:

# Most blockchain files (except v0.0 wallets) are JSON encoded; try to parse it as such
try:
data = json.loads(data)
except ValueError:
raise MayBeBlockchainV0();
raise MayBeBlockchainV0()

# Config files have no version attribute; they encapsulate the wallet file plus some detrius
if u"version" not in data:
Expand All @@ -107,14 +107,14 @@ class MayBeBlockchainV0: pass; # an exception which jumps to the end of the try
try:
data = json.loads(data) # try again to parse a v2.0/v3.0 JSON-encoded wallet file
except ValueError:
raise MayBeBlockchainV0();
raise MayBeBlockchainV0()

# Extract what's needed from a v2.0/3.0 wallet file
if data[u"version"] > 3:
raise NotImplementedError("Unsupported Blockchain wallet version " + tstr(data[u"version"]))
raise NotImplementedError("Unsupported Blockchain wallet version " + str(data[u"version"]))
iter_count = data[u"pbkdf2_iterations"]
if not isinstance(iter_count, int) or iter_count < 1:
raise ValueError("Invalid Blockchain pbkdf2_iterations " + tstr(iter_count))
raise ValueError("Invalid Blockchain pbkdf2_iterations " + str(iter_count))
data = data[u"payload"]

except MayBeBlockchainV0:
Expand Down

0 comments on commit 7e5c735

Please sign in to comment.