Created
May 6, 2021 14:36
-
-
Save etherx-dev/ba0520ceaaa99965626e67e9b1ab1af2 to your computer and use it in GitHub Desktop.
dumpkeyhs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import binascii | |
import hashlib | |
import codecs | |
import mmap | |
import sys | |
import ecdsa | |
import base58 | |
# Define base58str | |
def base58str(address_hex): | |
alphabet = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' | |
b58_string = '' | |
# Get the number of leading zeros | |
leading_zeros = len(address_hex) - len(address_hex.lstrip('0')) | |
# Convert hex to decimal | |
address_int = int(address_hex, 16) | |
# Append digits to the start of string | |
while address_int > 0: | |
digit = address_int % 58 | |
digit_char = alphabet[digit] | |
b58_string = digit_char + b58_string | |
address_int //= 58 | |
# Add ‘1’ for each 2 leading zeros | |
ones = leading_zeros // 2 | |
for one in range(ones): | |
b58_string = '1' + b58_string | |
return b58_string | |
def priv_to_addr(address_hex,compressed): | |
signing_key = ecdsa.SigningKey.from_string(address_hex, curve=ecdsa.SECP256k1) | |
verifying_key = signing_key.get_verifying_key() | |
if not compressed: | |
public_key = bytes.fromhex("04") + verifying_key.to_string() | |
else: | |
public_key_x = verifying_key.to_string()[0:32] | |
public_key_y = verifying_key.to_string()[32:] | |
if int(binascii.hexlify(public_key_y),16) % 2 == 0: | |
public_key = bytes.fromhex("02") + public_key_x | |
else: | |
public_key = bytes.fromhex("03") + public_key_x | |
#hash sha256 of pubkey | |
sha256_1 = hashlib.sha256(public_key) | |
#hash ripemd of sha of pubkey | |
ripemd160 = hashlib.new("ripemd160") | |
ripemd160.update(sha256_1.digest()) | |
#checksum of doge 0x1E being 30 from chainparams for addr prefix of D | |
hashed_public_key = bytes.fromhex("0x1E") + ripemd160.digest() | |
checksum_full = hashlib.sha256(hashlib.sha256(hashed_public_key).digest()).digest() | |
checksum = checksum_full[:4] | |
bin_addr = hashed_public_key + checksum | |
#encode address to base58_check and return | |
result_addr = base58.b58encode(bin_addr).decode("utf-8") | |
return result_addr | |
def main(): | |
f = open(sys.argv[1], "rb") | |
mm = mmap.mmap(f.fileno(),0,prot=mmap.PROT_READ) | |
currindex = mm.find(b'\x02\x01\x01\x04\x20') | |
privkeyList = set() | |
while(currindex > -1): | |
mm.seek(currindex+5) | |
#print(binascii.hexlify(mm.read(32))) | |
privkeyList.add(mm.read(32)) | |
currindex = mm.find(b'\x02\x01\x01\x04\x20') | |
f.close() | |
#print(privkeyList) | |
print("Found [" + str(len(privkeyList)) + "] possible keys") | |
for key in privkeyList: | |
PKuncomp = b'80'+ binascii.hexlify(key) | |
uncomp_address = priv_to_addr(key,False) | |
PKcomp = PKuncomp + b'01' | |
comp_address = priv_to_addr(key,True) | |
PKuncomp_sha256_1 = hashlib.sha256(codecs.decode(PKuncomp, 'hex')) | |
PKuncomp_sha256_2 = hashlib.sha256(PKuncomp_sha256_1.digest()) | |
checksum_uncomp = codecs.encode(PKuncomp_sha256_2.digest(), 'hex')[0:8] | |
uncomp_PK = PKuncomp + checksum_uncomp | |
#print(uncomp_PK) | |
PKcomp_sha256_1 = hashlib.sha256(codecs.decode(PKcomp, 'hex')) | |
PKcomp_sha256_2 = hashlib.sha256(PKcomp_sha256_1.digest()) | |
checksum_comp = codecs.encode(PKcomp_sha256_2.digest(), 'hex')[0:8] | |
comp_PK = PKcomp + checksum_comp | |
#print(comp_PK) | |
WIF_uncomp = base58str(uncomp_PK.decode("utf-8")) | |
WIF_comp = base58str(comp_PK.decode("utf-8")) | |
print(uncomp_address + ":" + WIF_uncomp) | |
print(comp_address + ":" + WIF_comp) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
output:
Acala Token ^[0-9a-z-A-Z]{44,50}$
ADD ^[1-5a-z.]{1,12}$
Algorand ^[A-Z0-9]{58,58}$
APENFT ^T[1-9A-HJ-NP-Za-km-z]{33}$
Ardor ^(ARDOR-)[0-9A-Za-z]{4}(-)[0-9A-Za-z]{4}(-)[0-9A-Za-z]{4}(-)[0-9A-Za-z]{5}$
Ark ^(A)[A-Za-z0-9]{33}$
Arweave ^[0-9a-z-A-Z-_]{43}$
Astar ^[0-9a-z-A-Z]{44,50}$
Atidium ^[1-5a-z.]{1,12}$
Avalanche ^(X-avax)[0-9A-za-z]{39}$
Beam ^[A-Za-z0-9]{65,500}$|^(beam:)[A-Za-z0-9]{65,495}$
Bitcoin ^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^[(bc1q)|(bc1p)][0-9A-Za-z]{37,62}$
Bitcoin Cash ^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^[0-9A-Za-z]{42,42}$
Bitcoin Cash SV ^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^[0-9A-Za-z]{42,42}$
Bitcoin Diamond ^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$
Bitcoin Gold ^[AG][a-km-zA-HJ-NP-Z1-9]{25,34}$
BitcoinX ^(X)[0-9A-za-z]{33}$
BitShares ^[a-z]{1}[a-z0-9-.]{2,62}$
BitTorrent ^T[1-9A-HJ-NP-Za-km-z]{33}$
BitTorrent OLD ^T[1-9A-HJ-NP-Za-km-z]{33}$
Bonfida ^[1-9A-HJ-NP-Za-km-z]{32,44}$
Cardano ^(([0-9A-Za-z]{57,59})|([0-9A-Za-z]{100,104}))$
CKB ^ckb1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{8,}
Dash ^[X|7][0-9A-Za-z]{33}$
Decred ^(Ds|Dc)[0-9A-Za-z]{33}$
DigiByte ^[DS][a-km-zA-HJ-NP-Z1-9]{25,34}$|^(dgb1)[0-9A-Za-z]{39,59}$
DOCK ^(3)[0-9a-z-A-Z]{44,50}$
Dogecoin ^(D|A|9)[a-km-zA-HJ-NP-Z1-9]{33,34}$
Dogecoin ^(D|A|9)[a-km-zA-HJ-NP-Z1-9]{33,34}$
Donnie Finance ^[A-Za-z0-9_]{5,11}$
eCash ^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^(ecash:)([qpzry9x8gf2tvdw0s3jn54khce6mua7l]{42})$
Edgeware ^[0-9a-z-A-Z]{44,50}$
Elrond eGold ^(erd)[a-z-A-Z0-9]{59}$
EOS ^[1-5a-z.]{1,12}$
Everipedia ^[1-5a-z.]{1,12}$
Filecoin ^[a-z0-9]{41}$|[a-z0-9]{86}$
FIO Protocol ^(FIO)[a-z-A-Z0-9]{50}$
Firo ^[a|Z|3|4][0-9A-za-z]{33}$
Flamingo ^(A)[A-Za-z0-9]{33}$
Green Metaverse Token ^[1-9A-HJ-NP-Za-km-z]{32,44}$
Groestlcoin (F|3)[0-9A-za-z]{33}|grs1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{39}
GXChain ^[a-z]{1}[a-z0-9-.]{2,62}$
HealthCare Chain ^(H)[A-Za-z0-9]{33}$
Hedera Hashgraph ^0[.]0[.]\d{1,6}$
Helium ^(1)[0-9A-za-z]{50}$
Hive ^[a-z][a-z0-9-.]{0,14}[a-z0-9]$
Horizen ^(z)[0-9A-za-z]{34}$
HyperCash ^[H][a-km-zA-HJ-NP-Z1-9]{26,35}$
ICON ^(hx)[A-Za-z0-9]{40}$
Internet Computer ^[0-9a-zA-Z]{64}$
IOST ^[A-Za-z0-9_]{5,11}$
JUST ^T[1-9A-HJ-NP-Za-km-z]{33}$
Kadena ^k:[0-9a-zA-Z]{64}$
Kadena ^k:[0-9a-zA-Z]{64}$
Komodo ^(R)[A-Za-z0-9]{33}$
Kusama ^[0-9a-z-A-Z]{44,50}$
Litecoin ^(L|M|3)[A-Za-z0-9]{33}$|^(ltc1)[0-9A-Za-z]{39}$
LTO Network ^(3J)[0-9A-Za-z]{33}$
MEETONE ^[1-5a-z.]{1,12}$
Mina ^(B62)[A-Za-z0-9]{52}$
MIOTA ^(iota)[0-9a-z]{60}$
Monero ^[48][a-zA-Z|\d]{94}([a-zA-Z|\d]{11})?$
MovieBloc ^(A)[A-Za-z0-9]{33}$
Nano ^(xrb_|nano_)[13456789abcdefghijkmnopqrstuwxyz]{60}
Navcoin ((xN)[1-9A-HJ-NP-Za-km-z]{137})|^((N)[1-9A-HJ-NP-Za-km-z]{33})|((X|Y)[1-9A-HJ-NP-Za-km-z]{60})|((4)[1-9A-HJ-NP-Za-km-z]{88})$
NEAR Protocol ^[a-z0-9_-]{1}[a-z0-9_.-]{0,62}[a-z0-9_-]{1}$
Neblio ^N[A-Za-z0-9]{33}$
Nebulas ^n1[a-zA-Z0-9]{33}$
NEO ^(A)[A-Za-z0-9]{33}$
NEO ^(N)[A-Za-z0-9]{33}$
NeoGas ^(A)[A-Za-z0-9]{33}$
NeoGas ^(N)[A-Za-z0-9]{33}$
NerveNetwork ^NULSd[a-km-zA-HJ-NP-Z1-9]{32,32}$
Neutrino Token ^(3P)[0-9A-Za-z]{33}$
New BitShares ^[a-z]{1}[a-z0-9-.]{2,62}$
Nexus ^(2|8)[A-Za-z0-9]{50}$
Nuls ^NULSd[a-km-zA-HJ-NP-Z1-9]{32,32}$
Oasis Network ^(oasis1)[0-9a-z]{40}$
Ontology ^(A)[A-Za-z0-9]{33}$
Ontology Gas ^(A)[A-Za-z0-9]{33}$
Parallel Finance ^[0-9a-z-A-Z]{44,50}$
PIVX ^(D)[0-9A-za-z]{33}$
Polkadot ^(1)[0-9a-z-A-Z]{44,50}$
QiSwap ^[Q|M][A-Za-z0-9]{33}$
QLC Chain ^(A)[A-Za-z0-9]{33}$
Qtum ^[Q|M][A-Za-z0-9]{33}$
Ravencoin ^[Rr]{1}[A-Za-z0-9]{33,34}$
Raydium ^[1-9A-HJ-NP-Za-km-z]{32,44}$
Ripple ^r[1-9A-HJ-NP-Za-km-z]{25,34}$
Serum ^[1-9A-HJ-NP-Za-km-z]{32,44}$
Siacoin ^[A-Za-z0-9]{76}$
Skycoin ^[0-9A-Za-z]{26,35}$
Solana ^[1-9A-HJ-NP-Za-km-z]{32,44}$
Stacks ^S[PM][0-9A-Z]{38,39}$
Steem ^[a-z][a-z0-9-.]{0,14}[a-z0-9]$
Stellar Lumens ^G[A-D]{1}[A-Z2-7]{54}$
Stratis ^(X)[0-9A-Za-z]{33}$
SUN ^T[1-9A-HJ-NP-Za-km-z]{33}$
SUN OLD ^T[1-9A-HJ-NP-Za-km-z]{33}$
Super Bitcoin ^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$
Syscoin (S)[A-Za-z0-9]{32,33}|sys1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{39}
TetherUS ^[1-9A-HJ-NP-Za-km-z]{32,44}$
TetherUS ^T[1-9A-HJ-NP-Za-km-z]{33}$
Tezos ^(tz[1,2,3])[a-zA-Z0-9]{33}$
Triggers ^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$
TRON ^T[1-9A-HJ-NP-Za-km-z]{33}$
USD Coin ^[1-9A-HJ-NP-Za-km-z]{32,44}$
USD Coin ^T[1-9A-HJ-NP-Za-km-z]{33}$
Verge ^(D)[A-Za-z0-9]{33}$
VITE ^(vite_)[a-z0-9]{50}$
Waves ^(3P)[0-9A-Za-z]{33}$
WAX ^[1-5a-z.]{1,12}$
Wing Token ^(A)[A-Za-z0-9]{33}$
WINK ^T[1-9A-HJ-NP-Za-km-z]{33}$
Wrapped SOL ^[1-9A-HJ-NP-Za-km-z]{32,44}$
YOYOW ^[0-9]{5,20}$
Zcash ^(t)[A-Za-z0-9]{34}$