How to possibly regain access to wallet with .keys file if you lost the password

Scenario: My friend created a wallet for mining and was so excited he did not write the password down correctly. He created a wallet, entered a password, and copied the wallet address into the miner config, and let time pass. Well a month goes by and he wants to gain access to the wallet realizing he did not write down the entire password. He realizes he is locked out of his wallet without the passphrase.

Solution:
I downloaded John the Ripper and because Safex is a fork of Monero, we are able to use John The Ripper to try and use a wordlist to create permutations and try to crack the password hash.

First download John the Ripper,

Once you download it, we need to run monero2john on the Safex wallets .keys file to receive the hash.
./monero2john.py [wallet.keys file] >> myHash.txt

If you have a unique password that you can kind of remember or possible passwords you have used in the past you can create your own wordlist which is what i did so you can narrow down the permutations, otherwise using the generic word list can take days with no hit. I created a wordlist file called myWordlist.txt.

Once i had my .keys file hash and a wordlist saved to separate files, i used John the Ripper to decode the hash.
./john --wordlist='myWordlist.txt' --rules='Single' myHash.txt

This gave me the Safex wallet .keys file password within seconds and I was able to regain access to my friends wallet.

I hope this helps someone in the future.

~C

9 Likes