Advertisement
skip420

Optimized-CPU

Feb 12th, 2021
1,244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.51 KB | None | 0 0
  1. # sudo apt-get install python-ecdsa
  2. import ecdsa
  3. import binascii
  4. import hashlib
  5. import sys
  6.  
  7. PasswordList   = '/media/shark/668E01B88E018233/Data/DoNotEnter/Cracking/Exfiltrated Passwords/Passwords'
  8. secp256k1curve=ecdsa.ellipticcurve.CurveFp(115792089237316195423570985008687907853269984665640564039457584007908834671663,0,7)
  9. secp256k1point=ecdsa.ellipticcurve.Point(secp256k1curve,0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798,0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8,0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141)
  10. secp256k1=ecdsa.curves.Curve('secp256k1',secp256k1curve,secp256k1point,(1,3,132,0,10))
  11.  
  12. BlockChain     = []
  13. BlockchainFile = 'NonSegwit-Short.txt'
  14. charset = '0123456789qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM'
  15. CharSetIndex = []
  16. Ranges = [] # 62 Characters * 2  Start and Stop characters
  17.  
  18. for x in range(0, 62 * 2, 2):
  19.     CharSetIndex.append(x)
  20.  
  21. def Crack(word):
  22.     privatekey = (int(hashlib.sha256(word).hexdigest(),16))
  23.     #privatekeysha = (hashlib.sha256(word)).hexdigest()
  24.     bcaddy = addy(privatekey)
  25.    
  26.     return bcaddy
  27.  
  28. def CheckOptimized(WalletAddress):
  29.     CompressedAddress =  WalletAddress[1:4] + WalletAddress[15:18] + WalletAddress[len(WalletAddress) - 3:len(WalletAddress)]
  30.  
  31.     # Find the correct initial character index
  32.     for x in range(len(charset) -1):
  33.         if(CompressedAddress[0] == charset[x]):
  34.           break
  35.  
  36.     # Search the section of the BlockChain List that begins with the first character in the compressed address
  37.     for y in range(Ranges[CharSetIndex[x]], Ranges[CharSetIndex[x + 1]] -1, 1):
  38.         if(BlockChain[y] == CompressedAddress):
  39.           return True
  40.  
  41. def LoadOptimizedLists(directory):
  42.     Ranges.append(0)
  43.     TotalBlockCount = 0
  44.  
  45.     for x in range(len(charset) -1):
  46.         # Load individual optimized address files
  47.         Tmp = [line.rstrip('\n') for line in open(directory + 'Address-' + charset[x])]
  48.        
  49.         for i in range(len(Tmp)):
  50.             BlockChain.append(Tmp[i])
  51.  
  52.         thisBlockCount = len(Tmp)
  53.         Ranges.append(thisBlockCount + TotalBlockCount)
  54.  
  55.         # Keep track of the total number of blocks
  56.         TotalBlockCount = TotalBlockCount + thisBlockCount
  57.  
  58.         # Starting Range of the next block is  +1
  59.         Ranges.append(TotalBlockCount + 1)
  60.  
  61.         # Remove all elements from the Tmp List
  62.         Tmp = []
  63.  
  64. def addy(pk):
  65.  pko=ecdsa.SigningKey.from_secret_exponent(pk,secp256k1)
  66.  pubkey=binascii.hexlify(pko.get_verifying_key().to_string())
  67.  pubkey2=hashlib.sha256(binascii.unhexlify('04'+pubkey)).hexdigest()
  68.  pubkey3=hashlib.new('ripemd160',binascii.unhexlify(pubkey2)).hexdigest()
  69.  pubkey4=hashlib.sha256(binascii.unhexlify('00'+pubkey3)).hexdigest()
  70.  pubkey5=hashlib.sha256(binascii.unhexlify(pubkey4)).hexdigest()
  71.  pubkey6=pubkey3+pubkey5[:8]
  72.  pubnum=int(pubkey6,16)
  73.  pubnumlist=[]
  74.  while pubnum!=0: pubnumlist.append(pubnum%58); pubnum/=58
  75.  address=''
  76.  for l in ['123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'[x] for x in pubnumlist]:
  77.   address=l+address
  78.  return '1'+address
  79.  
  80.  
  81.  
  82. LoadOptimizedLists('./Small-Non-Segwit-List/')
  83.  
  84. def Scan(PasswordList):
  85.     o = open('found.txt', 'a')
  86.     with open(PasswordList) as f:
  87.          for line in f:
  88.              thisAddress = Crack(line.strip())
  89.              if(CheckOptimized(thisAddress) == True):
  90.                print line.strip() + "," + thisAddress
  91.                o.write(line.strip() + "," + thisAddress + "\n")
  92.     o.close()
  93.  
  94. Scan(sys.argv[1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement