Post
Topic
Board Bitcoin Technical Support
Re: Encrypted wallet.dat, lost password, any solutions?
by
Stan-O
on 29/05/2014, 17:23:40 UTC
here's one that is probably very easy to figure out.  i know the first 7 characters of the passphrase, and have some combination of 4-8 numbers on the end, no spaces anywhere.

Start myraidcoind like this:
Code:
myriadcoind -rpcpass=some-password

Then run this script:
Code:
#!/usr/bin/ruby -w
require 'net/http'
require 'json'

start = "passphrase"
min_digits = 4
max_digits = 8

$rpc_user = ""
$rpc_pass = "some-password"
$rpc_port = 10889

def test(passphrase)
  puts passphrase.inspect
  request = Net::HTTP::Post.new("/")
  request.basic_auth $rpc_user, $rpc_pass
  request.body = { method:"walletpassphrase", params:[passphrase, 1] }.to_json
  response = Net::HTTP.new("localhost", $rpc_port).request(request)
  if response.code == "401" ; puts "Incorrect RPC user/pass" ; exit 1 ; end
  ret = JSON.parse response.body
  if ret["error"].nil? ; puts "\nFound it! #{passphrase.inspect}" ; exit ; end
  return if ret["error"]["code"] == -14 # wrong passphrase
  raise "WTF? #{ret.inspect}"
end

(min_digits..max_digits).each do |digits|
  (10**digits).times do |i|
    test("%s%0#{digits}d" % [start, i])
  end
end

puts "No luck."
exit 1

It'll take about 1 day for 6 digits, 2 weeks for 7, 3 months for 8.

thanks Revalin.  i could swear it's 4 digits on the end.  

i'll give it a go and let you know how it turns out.

It's returning this error:

net/http: warning: Content-Type did not set; using application/x-www-form-urlenc
oded

and then a password attempt.  is it working?  it's runing through the passwords, but not sure if its actually applying them.