Skip to content

Commit 23ea061

Browse files
authored
Update seedrecover.py
1 parent 85d16ca commit 23ea061

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

seedrecover.py

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,19 @@
2727

2828
import compatibility_check
2929

30+
from btcrecover import btcrpass
3031
from btcrecover import btcrseed
3132
import sys, multiprocessing
3233

3334
if __name__ == "__main__":
3435
print()
35-
print("Starting", btcrseed.full_version())
36+
print("Starting", btcrpass.full_version())
3637

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)
3941

40-
if mnemonic_sentence:
42+
if isinstance(password_found, str):
4143
if not btcrseed.tk_root: # if the GUI is not being used
4244
print()
4345
print(
@@ -49,19 +51,19 @@
4951

5052
# Selective Donation Addressess depending on path being recovered... (To avoid spamming the dialogue with shitcoins...)
5153
# 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:
5355
print("VTC: vtc1qxauv20r2ux2vttrjmm9eylshl508q04uju936n ")
5456

55-
if path_coin == 22:
57+
if context.loaded_wallet.btcrseed_wallet.path_coin == 22:
5658
print("MONA: mona1q504vpcuyrrgr87l4cjnal74a4qazes2g9qy8mv ")
5759

58-
if path_coin == 5:
60+
if context.loaded_wallet.btcrseed_wallet.path_coin == 5:
5961
print("DASH: Xx2umk6tx25uCWp6XeaD5f7CyARkbemsZG ")
6062

61-
if path_coin == 121:
63+
if context.loaded_wallet.btcrseed_wallet.path_coin == 121:
6264
print("ZEN: znUihTHfwm5UJS1ywo911mdNEzd9WY9vBP7 ")
6365

64-
if path_coin == 3:
66+
if context.loaded_wallet.btcrseed_wallet.path_coin == 3:
6567
print("DOGE: DMQ6uuLAtNoe5y6DCpxk2Hy83nYSPDwb5T ")
6668

6769
print()
@@ -70,26 +72,27 @@
7072
print(
7173
"You may also consider donating to Gurnec, who created and maintained this tool until late 2017 @ 3Au8ZodNHPei7MQiSVAWb7NB2yqsb48GW4")
7274
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):
7577
print(
7678
"NOTE: SLIP39 seed recovery matches checksums, so needs to be manually verified"
7779
)
7880

7981
# 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())
8284

8385
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)
8587

8688
retval = 0
8789

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
9093

9194
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
9396

9497
# Wait for any remaining child processes to exit cleanly (to avoid error messages from gc)
9598
for process in multiprocessing.active_children():

0 commit comments

Comments
 (0)