Author

Topic: Altcoin password recovery (typos, missing letters etc), eg LTC, CNC wallet (Read 1362 times)

member
Activity: 112
Merit: 10
I forgot my CNC wallet password.  feelsbadman Sad 1400 on there.
full member
Activity: 166
Merit: 100
So yesterday I couldnt remember my exact password to the CNHCoin-qt wallet (encrypted through the clients wallet encryption option). I must have made some stupid typo twice when I created it, in the new password field as well the repeat password field - ugh, all these precious chinese scam coins gone..
Then I searched the forums and found a solution for trying variations of a vaguely remembered password through the bitcoind daemon.(https://bitcointalk.org/index.php?topic=85495.20).
The problem is that the script talking to the bitcoind daemon expects a newer version of the daemon for testing the password against the wallet. If you try using that script with scrypt base coins like litecoin, LTC or chncoin, CNC daemons (based on old bitcoind 6.3 source), you only get a method not available error.

Manually trying out passwords was no option, so I created a small AutoHotKey script (Windows automation), that tests all the passwords in passes.txt by literally typing them in one by one and checking if the decryption goes through.

Here are the steps to make it work:
1) make the passwords file passes.txt, each password separated from the next by a newline.
You can create this simple ruby script to make 1 letter variations (ie typos) to your remembered password,
this is a minor variation of the script provided by Revalin in the above bitcoind recover thread, saving generated passwords to passes.txt:

create_passes.rb:
Code:
#!/usr/bin/ruby -w

passphrase = "S0me3!Pass"
characters = " !\"\#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"

def test(phrase)
  print phrase, "\t"
  #system("./bitcoind", "walletpassphrase", phrase, "20")
  File.open('passes.txt', 'a+') { |file| file.write(phrase+"\n") }
end

# transpose adjacent chars
(passphrase.length - 1).times do |i|
  testphrase = passphrase.dup
  testphrase[i] = passphrase[i+1]
  testphrase[i+1] = passphrase[i]
  test testphrase
end

# delete one char
passphrase.length.times do |i|
  testphrase = passphrase.dup
  testphrase = testphrase[0,i] + testphrase[(i+1)..-1]
  test testphrase
end

# substitutute one char
passphrase.length.times do |i|
  characters.chars.each do |c|
    testphrase = passphrase.dup
    testphrase[i] = c
    test testphrase
  end
end

# insert one char
(passphrase.length + 1).times do |i|
  characters.chars.each do |c|
    testphrase = passphrase.dup
    testphrase.insert(i, c)
    test testphrase
  end
end


2) Install AutoHotKey Windows automation scripting:
http://www.autohotkey.com/

3) put the following in bruteforce.ahk, adapt the install_path to folder where your passes.txt was created:
Code:
install_path := "C:\chncoin_passwords\"

;FileRead, pass, %install_path%passes.txt
;MsgBox, 4096,, myText is: %pass%
sleep, 100

WinActivate, ahk_class QWidget

IfWinExist, ahk_class QWidget
{
    ;real!
    Loop, Read, %install_path%passes.txt
    {
       
        ;SendPlay %A_LoopReadLine%

Send ^a ; Select All
Send %A_LoopReadLine%{ENTER}
        Sleep, 120
wingettitle, a, a
Sleep 20
if( a == "Unlock wallet")
{
;;give it more time
        Sleep, 200
wingettitle, a, a
}
Sleep 20
if( a == "Unlock wallet")
{
;;give it more time
        Sleep, 600
wingettitle, a, a
}
if(  a == "Wallet unlock failed" )
{
Send "{ENTER}"
}
else
{
MsgBox, 4096,, "FOUND IT:>>"%a%"<<>>%A_LoopReadLine%"<<"
}
    }
    MsgBox, 4096,, "SAD PANDA :("
}

return


4) Start the altcoin wallet-qt client, and go to the receive tab. Click "Add address" and enter a label for the address, click Ok.
Now the client with alert you with a small window titled "Unlock wallet" and a text field. The time has come to execute our little password tool - start the
bruteforce.ahk script by double clicking it. It will automatically switch focus back to the wallet client, and start entering passwords from the passes.txt file.
When it has found a hit the scripts halts and a message box appears telling you what password should match.
Note that password and in the status bar you can the pause/exit the ahk script.

Let me know if that helps you.

uBTC Donations: 154fh7MyC5XPj1qfgCemsJboqxqCo5i5uW
Jump to: