<p>I would approach this using JSON-RPC with the programming language of your choice and the <code>walletpassphrase</code> command.</p>
<p><code>walletpassphrase &quot;12345&quot; 60</code></p>
<p>The 60 at the end is number of seconds before the passphrase times out and needs to be entered again. Now all you need to do is create a loop that iterates through all number combinations.</p>
<p>If the guess is wrong the bitcoin client will return<br />
<code>Error: The wallet passphrase entered was incorrect. (code -14)</code></p>
<p>If the guess is correct the bitcoin client will return<br />
<code>null</code></p>
<p>So all you would need to do is check for the response and if <code>null</code> then the guess is correct and you can stop your loop.</p>

CC BY-SA 4.0
2020-11-08T18:08:02.983Z
2020-11-08T18:08:02.983Z
m1xolyd1an
<p>To bruteforce a wallet.dat file you would need to follow these steps.</p>
<ol>
<li>Install python from python.org</li>
<li>Download john the ripper from github</li>
<li>run the script bitcoin2john.py to extract the hash</li>
<li>get hashcat from hashcat.net</li>
</ol>
<p>With hashcat you can search the entire space of numbers of your choice using a mask ?d?d?d?d?d?d and increment.</p>
<p>Your hashcat command would look like: hashcat -m 11300 wallethash.txt -a 3 ?d?d?d?d?d?d?d --increment etc would work</p>
<p>Once the password is found you can use it to export the private key from core.</p>

CC BY-SA 4.0
2021-02-28T11:41:55.570Z
2021-02-28T11:41:55.570Z
KeychainX
<p>I have a wallet.dat file which is encrypted and I can remember that I have put only numbers as password(4 or 5 digits, not more, not less). <br>
My friend suggested to do brute force on it using python. <br>
I tried googling and unfortunately(poor programming) didn't got any python script.
Can anyone help me please ?</p>

<wallet><wallet-recovery><wallet.dat>
Brute force a wallet.dat file
svvc
# Brute force a wallet.dat file

(Asked by: username_0 on 2020-11-08)

I have a wallet.dat file which is encrypted and I can remember that I have put only numbers as password(4 or 5 digits, not more, not less).   
My friend suggested to do brute force on it using python.   
I tried googling and unfortunately(poor programming) didn't got any python script.
Can anyone help me please ?

**Tags:** wallet, wallet-recovery, wallet.dat


---

## 2 answers

### Answer by username_1 on 2020-11-08. Score: 2

I would approach this using JSON-RPC with the programming language of your choice and the `walletpassphrase` command.

`walletpassphrase "12345" 60`

The 60 at the end is number of seconds before the passphrase times out and needs to be entered again. Now all you need to do is create a loop that iterates through all number combinations.

If the guess is wrong the bitcoin client will return  
`Error: The wallet passphrase entered was incorrect. (code -14)`

If the guess is correct the bitcoin client will return  
`null`

So all you would need to do is check for the response and if `null` then the guess is correct and you can stop your loop.


---

### Answer by username_2 on 2021-02-28. Score: 0

To bruteforce a wallet.dat file you would need to follow these steps.

1. Install python from python.org
2. Download john the ripper from github
3. run the script bitcoin2john.py to extract the hash
4. get hashcat from hashcat.net

With hashcat you can search the entire space of numbers of your choice using a mask ?d?d?d?d?d?d and increment.

Your hashcat command would look like: hashcat -m 11300 wallethash.txt -a 3 ?d?d?d?d?d?d?d --increment etc would work

Once the password is found you can use it to export the private key from core.


---

