diff options
author | Determinant <ted.sybil@gmail.com> | 2019-08-07 22:46:46 -0400 |
---|---|---|
committer | Determinant <ted.sybil@gmail.com> | 2019-08-07 22:46:46 -0400 |
commit | 9e17dcd97a78371458595b122aa15d553737e215 (patch) | |
tree | 54992af83dea8a0a6edbdc915381bce2c08a0e44 | |
parent | 9a5861f5dec631eb7ec2524af347487aa3594520 (diff) |
add a useful script
-rw-r--r-- | ethy.py | 14 | ||||
-rwxr-xr-x | verify_batch.sh | 8 |
2 files changed, 15 insertions, 7 deletions
@@ -248,25 +248,25 @@ if __name__ == '__main__': priv_key, mac = decrypt(passwd=passwd, iv=iv, enc_pk=enc_pk, salt=salt, n=n, r=r, p=p, dklen=dklen) if c['mac'] == mac.hex(): - print("-- password is correct --") + err.write("-- password is correct --\n") else: - print("!! possibly WRONG password !!") + err.write("!! possibly WRONG password !!\n") if not args.force: sys.exit(1) if args.show_key: - print("> private key: {}".format(priv_key.hex())) + err.write("> private key: {}\n".format(priv_key.hex())) if args.verify_key: # derive public key and address from the decrypted private key sk = SigningKey.from_string(priv_key, curve=SECP256k1) pub_key = sk.get_verifying_key().to_string() - print("> public key: {}".format(pub_key.hex())) + err.write("> public key: {}\n".format(pub_key.hex())) addr = generate_addr(pub_key) - print("> address: {}".format(addr)) + err.write("> address: {}\n".format(addr)) if parsed['address'] == addr: - print("-- private key matches address --") + err.write("-- private key matches address --\n") else: - print("!! private key does NOT match the address !!") + err.write("!! private key does NOT match the address !!\n") if not args.force: sys.exit(1) # generate a new encrypted wallet diff --git a/verify_batch.sh b/verify_batch.sh new file mode 100755 index 0000000..cba359a --- /dev/null +++ b/verify_batch.sh @@ -0,0 +1,8 @@ +#!/bin/bash -e +prefix=${1:-wallet-b0b54476db350aa80aa8404d09ad2d2e} # the prefix for all wallets +n=${2:-5} # the number of wallets in the batch +passfile=${3:-all_passwords} +for i in $(seq -f "%03g" 0 $((n - 1))); do + ii=$((10#$i)) + head -n "$((ii + 1))" "$passfile" | tail -n 1 | sed 's/.* = \(.*\)$/\1/g' | ethy.py --pass-stdin $prefix-$i.json > /dev/null +done |