|
27 | 27 |
|
28 | 28 | import compatibility_check
|
29 | 29 |
|
| 30 | +from btcrecover import btcrpass |
30 | 31 | from btcrecover import btcrseed
|
31 | 32 | import sys, multiprocessing
|
32 | 33 |
|
33 | 34 | if __name__ == "__main__":
|
34 | 35 | print()
|
35 |
| - print("Starting", btcrseed.full_version()) |
| 36 | + print("Starting", btcrpass.full_version()) |
36 | 37 |
|
37 |
| - btcrseed.register_autodetecting_wallets() |
38 |
| - mnemonic_sentence, path_coin = btcrseed.main(sys.argv[1:]) |
| 38 | + context = btcrpass.RecoveryContext() |
| 39 | + btcrpass.parse_arguments(context, sys.argv[1:]) |
| 40 | + (password_found, not_found_msg) = btcrpass.main(context) |
39 | 41 |
|
40 |
| - if mnemonic_sentence: |
| 42 | + if isinstance(password_found, str): |
41 | 43 | if not btcrseed.tk_root: # if the GUI is not being used
|
42 | 44 | print()
|
43 | 45 | print(
|
|
49 | 51 |
|
50 | 52 | # Selective Donation Addressess depending on path being recovered... (To avoid spamming the dialogue with shitcoins...)
|
51 | 53 | # TODO: Implement this better with a dictionary mapping in seperate PY file with BTCRecover specific donation addys... (Seperate from YY Channel)
|
52 |
| - if path_coin == 28: |
| 54 | + if context.loaded_wallet.btcrseed_wallet.path_coin == 28: |
53 | 55 | print("VTC: vtc1qxauv20r2ux2vttrjmm9eylshl508q04uju936n ")
|
54 | 56 |
|
55 |
| - if path_coin == 22: |
| 57 | + if context.loaded_wallet.btcrseed_wallet.path_coin == 22: |
56 | 58 | print("MONA: mona1q504vpcuyrrgr87l4cjnal74a4qazes2g9qy8mv ")
|
57 | 59 |
|
58 |
| - if path_coin == 5: |
| 60 | + if context.loaded_wallet.btcrseed_wallet.path_coin == 5: |
59 | 61 | print("DASH: Xx2umk6tx25uCWp6XeaD5f7CyARkbemsZG ")
|
60 | 62 |
|
61 |
| - if path_coin == 121: |
| 63 | + if context.loaded_wallet.btcrseed_wallet.path_coin == 121: |
62 | 64 | print("ZEN: znUihTHfwm5UJS1ywo911mdNEzd9WY9vBP7 ")
|
63 | 65 |
|
64 |
| - if path_coin == 3: |
| 66 | + if context.loaded_wallet.btcrseed_wallet.path_coin == 3: |
65 | 67 | print("DOGE: DMQ6uuLAtNoe5y6DCpxk2Hy83nYSPDwb5T ")
|
66 | 68 |
|
67 | 69 | print()
|
|
70 | 72 | print(
|
71 | 73 | "You may also consider donating to Gurnec, who created and maintained this tool until late 2017 @ 3Au8ZodNHPei7MQiSVAWb7NB2yqsb48GW4")
|
72 | 74 | print()
|
73 |
| - print("Seed found:", mnemonic_sentence) # never dies from printing Unicode |
74 |
| - if isinstance(btcrseed.loaded_wallet, btcrseed.WalletSLIP39Seed): |
| 75 | + print("Seed found:", password_found) # never dies from printing Unicode |
| 76 | + if isinstance(context.loaded_wallet, btcrseed.WalletSLIP39Seed): |
75 | 77 | print(
|
76 | 78 | "NOTE: SLIP39 seed recovery matches checksums, so needs to be manually verified"
|
77 | 79 | )
|
78 | 80 |
|
79 | 81 | # print this if there's any chance of Unicode-related display issues
|
80 |
| - if any(ord(c) > 126 for c in mnemonic_sentence): |
81 |
| - print("HTML Encoded Seed:", mnemonic_sentence.encode("ascii", "xmlcharrefreplace").decode()) |
| 82 | + if any(ord(c) > 126 for c in password_found): |
| 83 | + print("HTML Encoded Seed:", password_found.encode("ascii", "xmlcharrefreplace").decode()) |
82 | 84 |
|
83 | 85 | if btcrseed.tk_root: # if the GUI is being used
|
84 |
| - btcrseed.show_mnemonic_gui(mnemonic_sentence, path_coin) |
| 86 | + btcrseed.show_mnemonic_gui(password_found, context.loaded_wallet.btcrseed_wallet.path_coin) |
85 | 87 |
|
86 | 88 | retval = 0
|
87 | 89 |
|
88 |
| - elif mnemonic_sentence is None: |
89 |
| - retval = 1 # An error occurred or Ctrl-C was pressed inside btcrseed.main() |
| 90 | + elif not_found_msg: |
| 91 | + print(not_found_msg, file=sys.stderr if context.args.listpass else sys.stdout) |
| 92 | + retval = 0 |
90 | 93 |
|
91 | 94 | else:
|
92 |
| - retval = 0 # "Seed not found" has already been printed to the console in btcrseed.main() |
| 95 | + retval = 1 # An error occurred or Ctrl-C was pressed |
93 | 96 |
|
94 | 97 | # Wait for any remaining child processes to exit cleanly (to avoid error messages from gc)
|
95 | 98 | for process in multiprocessing.active_children():
|
|
0 commit comments