Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions keepkeyctl
Original file line numberDiff line numberDiff line change
Expand Up@@ -297,7 +297,7 @@ class Commands(object):
raise Exception("Must provide firmware filename or URL")

if args.file:
fp = open(args.file, 'r')
fp = open(args.file, 'rb')
elif args.url:
print("Downloading from", args.url)
resp = urllib.urlretrieve(args.url)
Expand All@@ -316,8 +316,9 @@ class Commands(object):
fp_old.close()

fp.seek(0)
if fp.read(4) != 'KPKY':
raise Exception("KeepKey firmware header expected")
magic = fp.read(4).decode("utf-8")
if magic != 'KPKY':
raise Exception("KeepKey firmware header expected. magic={}".format(magic))

print("Please confirm action on device...")

Expand Down