-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbtc_wallet_cmd.py
37 lines (30 loc) · 956 Bytes
/
btc_wallet_cmd.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
#!/usr/bin/env python
# encoding: utf-8
import getopt
import sys
from btc_wallet import dump_private_key_from_wallet_db
def main():
try:
opts, args = getopt.getopt(sys.argv[1:], "", ["dat-file=", "pass="])
datDir = None
datPass = None
for o, a in opts:
if o == "--dat-file":
datDir = a
elif o == "--pass":
datPass = a
else:
sys.exit(2)
if datDir is not None and datPass is not None:
res_obj = dump_private_key_from_wallet_db(datDir, datPass)
if "wallet_key" in res_obj:
for k, v in res_obj.get("wallet_key").items():
print(k, v)
else:
print(res_obj.get("err_msg"))
break
except Exception as err:
print(err)
sys.exit(2)
if __name__ == "__main__":
main()