Post
Topic
Board Bitcoin Technical Support
Topic OP
Help with code
by
HER4S
on 04/10/2023, 16:51:04 UTC
Hello I made a huge mistake, I have one word wrong of my recovery seed copy, I know that this is the word number 6 because my safepal S1 doesn't give me the option to use the word that I have written on my recovery copy. I made a python code to brute force this word with the words of the bip-0039 document

The problem is that I don't know the API to run my python code. can someone help with this?

this is the complete code:

import requests

def clean_word(word):
return word.strip().lower()

def brute_force_seed(seed, word_number):
word_index = word_number
while word_index < len(seed.split()):
for word in english_words:
print("Checking word", word)
corrected_seed = seed.split()
corrected_seed[word_index] = clean_word(word)
corrected_seed = " ".join(corrected_seed)
response = requests.post("https://ep.isafepal.com", json={"phrase": corrected_seed})
if response.status_code == 200:
return corrected_seed

word_index += 1
return None

with open(r"C:\Users\kkk\OneDrive\desktop\rescue\bip0039.txt", "r") as file:
english_words = [clean_word(line.strip()) for line in file]

seed = "word1 word2 word3 word4 word5 word6 word7 word8 word9 word10 word11 word12 word13 word14 word15 word16 word17 word18 word19 word20 word21 word22 word23 word24"
word_number = 5

corrected_seed = brute_force_seed(seed, word_number)

if corrected_seed is not None:
print("The corrected phrase is:", corrected_seed)
else:
print("No match found.")