forked from gurnec/btcrecover
-
Notifications
You must be signed in to change notification settings - Fork 0
/
seedrecover.py
executable file
·52 lines (40 loc) · 1.99 KB
/
seedrecover.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/python
# seedrecover.py -- Bitcoin mnemonic sentence recovery tool
# Copyright (C) 2014-2016 Christopher Gurnee
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version
# 2 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/
# If you find this program helpful, please consider a small
# donation to the developer at the following Bitcoin address:
#
# 17LGpN2z62zp7RS825jXwYtE7zZ19Mxxu8
#
# Thank You!
# PYTHON_ARGCOMPLETE_OK - enables optional bash tab completion
from __future__ import print_function
from btcrecover import btcrseed
import sys
if __name__ == "__main__":
btcrseed.register_autodetecting_wallets()
mnemonic_sentence = btcrseed.main(sys.argv[1:])
if mnemonic_sentence:
if not btcrseed.tk_root: # if the GUI is not being used
btcrseed.print("Seed found:", mnemonic_sentence) # never dies from printing Unicode
# print this if there's any chance of Unicode-related display issues
if any(ord(c) > 126 for c in mnemonic_sentence):
print("HTML encoded seed:", mnemonic_sentence.encode("ascii", "xmlcharrefreplace"))
if btcrseed.tk_root: # if the GUI is being used
btcrseed.show_mnemonic_gui(mnemonic_sentence)
elif mnemonic_sentence is None:
sys.exit(1) # An error occurred or Ctrl-C was pressed inside btcrseed.main()
# else "Seed not found" has already been printed to the console in btcrseed.main()