Post
Topic
Board Bitcoin Technical Support
Re: Encrypted wallet.dat, lost password, any solutions?
by
Revalin
on 17/12/2013, 05:35:57 UTC
Is there any way this could be altered for multiple wordlists?

Eg. I am fairly sure I made the password from four wordlists.

For example, List A is shirt-themed (hawaiian, dress, long-sleeve, etc.)

List B is car-themed (ford, toyota, camry, etc.)

List C is country-themed (australia, thailand, colombia, etc.)

List D is guitar-themed (fender, gibson, valencia, etc.)

So it would try "hawaiianfordaustraliafender", "hawaiianfordaustraliagobson", etc.

Right now I am making it run all wordlists at once, but this is inefficient as it repeats words and it has a lot of combinations that I know are not correct (incorrect order, etc.)

Sure:

Code:
#!/usr/bin/ruby
require "net/http"
require "json"

$rpc_pass = "rpc-pass"
words_a = ['hawaiian', 'dress', 'long-sleeve']
words_b = ['ford', 'toyota', 'camry']
words_c = ['australia', 'thailand', 'colombia']
words_d = ['fender', 'gibson', 'valencia']

def test(passphrase)
  puts passphrase.inspect
  request = Net::HTTP::Post.new("/")
  request.basic_auth "", $rpc_pass
  request.body = { method:"walletpassphrase", params:[passphrase, 1] }.to_json
  response = Net::HTTP.new("localhost", 8332).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

words_a.each do |a|
  words_b.each do |b|
    words_c.each do |c|
      words_d.each do |d|
        [a,b,c,d].permutation.each { |p| test p.join }
      end
    end
  end
end

puts "No luck."