import sys import pybip38 # pip install pybip38 # Note: The pybip38 is limited to Bitcoin (only) BIP38 encoded keys, NOT other alt-coins that use BIP38. Probably based on validation performed by that library. # Example BIP38 Key. Password = test BIP38 = '6PnTPCDoztgePLK3bqmaVwc7MvcyKchc1ksabMuRiPeUemULFpsDd9eouD' dic = open("pw.txt", "r") for line in dic: pwd = line.strip() print(pwd) if pybip38.bip38decrypt(pwd, BIP38) != False: print("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") print("XXXXXXXXXX KEY FOUND XXXXXXXXXXXXX") print(pwd) print("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") print("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") pwd_file = open("winner", "w") pwd_file.write(pwd) pwd_file.close() sys.exit(0) print("Key Not Found :(") pwd_file2 = open("loser", "w") pwd_file2.write(":)") pwd_file2.close() sys.exit(0)
while True: # generate key secret_key = guess(guess_length) print secret_key # how many uppercase characters? count = 0 for i in secret_key: if i == str.upper(i): count += 1 if min_upper <= count <= max_upper: # decrypt bip38 encrypted key wif = pybip38.bip38decrypt(secret_key, encpriv) if wif: # convert from wif to regular private key privkey = base58.b58decode(wif).encode('hex')[2:-8] addr = pub_from_priv(privkey) # if this matches, we have our bitcoin! if addr == target_addr: results = ( 'secret_key: ' + secret_key + '\n' + 'addr: ' + addr + '\n' + 'wif: ' + wif + '\n' + 'privkey: ' + privkey )
def pubtoaddy(puk): #converts uncompressed public key to public address version = chr(0) h = hashlib.new("SHA256") h.update(puk) s = h.digest() h = hashlib.new("RIPEMD160") h.update(s) kh = version + h.digest() h = hashlib.new("SHA256") h.update(kh) cs = h.digest() h = hashlib.new("SHA256") h.update(cs) cs = h.digest()[:4] adr = b58encode(kh + cs) return adr if __name__ == "__main__": bip38 = raw_input('Enter BIP38 Private Key: ') passwd = raw_input('Enter Password: '******'Bitcoin Private Key (WIF): %s' % numtowif(privKey)) PublicKey = EccMultiply(GPoint, privKey) ucpuk = "04" + "%064x" % PublicKey[0] + "%064x" % PublicKey[1] PubAd = pubtoaddy(Hex2Byte(ucpuk)) print('Bitcoin Address: %s' % PubAd)
manpw = raw_input("Enter password segment: ") def inner(pw1): dicp2 = open("pw2.txt", "r") for line in dicp2: pw2 = line.strip() pw1c = pw1 passwords.append(str(pw1c) + str(pw2)) passwords.append(str(pw1c) + str(manpw) + str(pw2)) passwords.append(str(pw2) + str(pw1c)) passwords.append(str(pw2) + str(manpw) + str(pw1c)) dicp2.close() for line in dicp1: password1 = line.strip() inner(password1) for item in passwords: print(item) if pybip38.bip38decrypt(item, BIP38) != False: print("XXXXXXXXXXXXXXXXXXXX") print("KEY FOUND: ") print(item) print("XXXXXXXXXXXXXXXXXXXX") sys.exit(0) print("\n## Password NOT found :-(\n")
if 'y' in compresscoinbase.lower(): assert 'n' not in compresscoinbase.lower() compresscoinbase = False elif 'n' in compresscoinbase.lower(): compresscoinbase = True assert compresscoinbase is True or compresscoinbase is False except: print('\nPlease enter only yes or no.') else: break while True: password = getpass("\nPlease enter your vault password: "******"\nThe password entered does not decrypt the key properly. Perhaps you mis-typed? Please try again.") else: break while True: index = input("\nPlease enter the index number for the vault address (0 for first address): ") try: index = int(index) except: print("\nYou must enter only a number.")
while True: # generate key secret_key = guess(guess_length) print secret_key # how many uppercase characters? count = 0 for i in secret_key: if i == str.upper(i): count += 1 if min_upper <= count <= max_upper: # decrypt bip38 encrypted key wif = pybip38.bip38decrypt(secret_key, encpriv) if wif: # convert from wif to regular private key privkey = base58.b58decode(wif).encode('hex')[2:-8] addr = pub_from_priv(privkey) # if this matches, we have our bitcoin! if addr == target_addr: results = ('secret_key: ' + secret_key + '\n' + 'addr: ' + addr + '\n' + 'wif: ' + wif + '\n' + 'privkey: ' + privkey) print(results) resultfile.write(results) sys.exit()