how can i make this generate randomly not enumerate, i want each thread to check random…
- User
how can i make this generate randomly not enumerate, i want each thread to check random ones so theres lower chance of overlap. give me the snippet and instructions on where to place it as i dont want to change the whole code.
from mnemonic import Mnemonic import bip32utils import requests import sys import random import re from bitcoinlib.wallets import Wallet import threading
mnemo = Mnemonic("english")
target=[ ['xxxx'], # word on plate is "like" ??? ['muscle'], # word on plate is "love" ??? ['xxxx'], # word is "king" ['shaft'], # word is "place" ['task'], # word on plate is "closet" ??? ['xxxx'], # word on plate is "repel" ['nut'], # word on plate is "pear" ['xxxx'], # word on plate is "lizard" ??? ['fault'], # word on plate is covered up ['list'], # word on plate is "fast" ['xxxx'], # word on plate is "fast" ['excess'], # word on plate is "fast" ]
allwords=[] for line in open('bip39.txt'): allwords.append(line.strip())
target[0]=allwords target[2]=allwords target[5]=list(filter(re.compile('^p').match, allwords)) target[7]=list(filter(re.compile('^[pygjq].{4,}').match, allwords)) target[10]=list(filter(re.compile('^[fhiklmnrvwx]').match, allwords))
def main(): keyspace = 1 for i in range(0,len(target)): keyspace *= len(target[i])
starting = random.randint(0,keyspace) #starting = 0 # for when you're all alone
for x in range(starting,keyspace): # know your limits mystring="" eol=0
remaining=x for word in range(0,len(target)): choice = int(remaining%len(target[word])) mystring+=target[word][choice]+' ' if(choice == len(target[word])-1 ): # okay, we're at the end of this word placement eol+=1 remaining=remaining/len(target[word]) # uncomment for debug to ensure proper mnemo # print(mystring.strip()) try: win = mnemo.check(mystring.strip()) if win: seed = mnemo.to_seed(mystring.strip(),"") bip32_root_key_obj = bip32utils.BIP32Key.fromEntropy(seed) # standard derivation path m/44'/0'/0'/0 bip32_child_key_obj = bip32_root_key_obj.ChildKey(44 + bip32utils.BIP32_HARDEN).ChildKey(0 + bip32utils.BIP32_HARDEN).ChildKey(0 + bip32utils.BIP32_HARDEN).ChildKey(0).ChildKey(0) address = bip32_child_key_obj.Address() privkey = bip32_child_key_obj.WalletImportFormat() wallet = Wallet.import_wallet(import_format=privkey) balance = wallet.balance() if balance > 0: # print out info print("HIT HIT WTF LMAOOOO") print("seed: " + seed) print("adr: " + address) print("priv: " + privkey) print("bal: " + balance) except Exception as e: pass if(eol==len(target)): # if we've reached the end of every line, we're done breakfor i in range(8): t = threading.Thread(target=main).start() print("thread started ~ " + str(i+1))
- Assistant
To make the code generate random checks instead of enumerating them, you can modify the
main()function as follows:-
Remove the
startingvariable assignment and the for loop that usesstartingas the starting point. This will no longer be needed.
-
- User
it seems that only the first word is being brute forces when all the words should be
- Assistant
Apologies for the confusion. To ensure that each thread checks random combinations of all words, you need to modify the
targetlist to contain a list of lists. Each inner list represents the possible words for a particular position. Then, within each thread, you can randomly select a word from each position to generate a random combination.Here's the modified code snippet:
import random def main(): for _ in range(keyspace): mystring = "" for words in target: choice = random.randint(0, len(words)-1) mystring += words[choice] + ' ' # Rest of your code...Replace the
main()function with the above code snippet and keep the rest of the code unchanged. This change will ensure that each thread generates random combinations of words to check, reducing the chance of overlap.