Pages:
Author

Topic: Encrypted wallet.dat, lost password, any solutions? - page 21. (Read 213559 times)

hero member
Activity: 728
Merit: 500
165YUuQUWhBz3d27iXKxRiazQnjEtJNG9g
The scripts need Ruby 1.9.  Try this:

Code:
sudo apt-get install ruby1.9.1
sudo ln -sf /usr/bin/ruby1.9.1 /etc/alternatives/ruby

Then run it again.  If that doesn't work then paste the errors here so I can see what's wrong.
member
Activity: 112
Merit: 10
Man I hate needing to have my hand held through things but I've never run a ruby script before. Electrum 1.9+ doesn't seem to want to load for me anymore in Windows so I tried in a Debian Live bootable USB but kept getting syntax errors (cool OS btw, now I see why people are into it).

Share of the bounty for the guy who helps the noob run Revalin's script?
hero member
Activity: 728
Merit: 500
165YUuQUWhBz3d27iXKxRiazQnjEtJNG9g
Are Electrum wallets doable as well? I've lost my pass and seed. Couldn't even get a dump with pywallet and an electrum.dat file.

Bounty for anyone who can help of course.

Sure, I can do Electrum.  Their key stretching has an interesting flaw.  This script exploits it to get a few hundred times speedup compared to simple brute force.

My help is free but tips are always welcome.  I suggest 15%, just like tipping your waiter.  Smiley

Code:
#!/usr/bin/ruby
require 'base64'
require 'digest/sha2'
require 'open3'
require 'openssl'

# Double substitution for Electrum

# Put your best guess at your passphrase here
passphrase = 'Oops I forgot'

# The full path to your electrum.dat or default_wallet
wallet_file = '/home/revalin/.electrum/wallets/default_wallet'

# Where to find Electrum.  Use 1.9.2!  Older versions may be incompatible.
$electrum = '/home/revalin/Electrum-1.9.2/electrum'


def test(phrase)
  $cipher.reset
  $cipher.key = Digest::SHA256.digest(Digest::SHA256.digest(phrase))
  $cipher.update $seed
  $cipher.final
  puts phrase
  i,o,t = Open3.popen2e($electrum, "-o", "getseed")
  i.puts(phrase)
  i.close
  if t.value.success?
    puts "Found it! #{phrase}"
    exit
  end
rescue OpenSSL::Cipher::CipherError
end

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

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

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

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

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

  return list.uniq
end

wallet = File.read(wallet_file)
seed_base64 = wallet.match(/'seed': '([^']+)'/).captures.first
$seed = Base64.decode64(seed_base64)
$cipher = OpenSSL::Cipher.new('aes-256-cbc')
$cipher.iv = $seed.slice!(0,16)
Dir.chdir File.dirname $electrum
list1 = scramble(passphrase)
list1.each { |i| test i }
list1.each { |i| scramble(i).each { |j| test j }}
puts "No luck."
exit 1
newbie
Activity: 46
Merit: 0
Okay so I've wrote a c sharp forms app that executes bitcoind with the walletpassphrase argument.
The problem is that bitcoind takes about a second to finish executing each time, so I can only try one password per second which is quite a slow rate.
Does everyone else get about this speed? is there a faster method?
newbie
Activity: 6
Merit: 0
i think i clicked that yellow box and the password screen pop'd up' so it seamd like a good idea.. i wish the value would start dropping again! im not going to be able to afford more at the current rate of increase its really annoying me
full member
Activity: 154
Merit: 101
Why encrypt it? Store it offline.
newbie
Activity: 6
Merit: 0
revalin?? can you please help me?

your ruby scripts seam to be working okay for my windows pc *if i delete the exit if found it section and change /.bitcoind to /.multibit and i can get it to do what i require almost im just unsure if its testing my pass word

i think i may know the first part well, thiers about 10- 20 diffrent possibilities but i can run and attemtempt each one after much thought im almost 100% of the phrase and pretty sure it has a #after it but i cant seam to get the number combination right its between 1 and 4 numbers on the end between 20-30 charcters long all together

can you help? im running windows but the earlier scripts you posted seam to work the best becuse i dont have a rpc or user name for multibit

CAN YOU PLEASE HELP??

i dont have much invested but its all i have i can pay 0.01 or 0.001 if i must
member
Activity: 112
Merit: 10
Are Electrum wallets doable as well? I've lost my pass and seed. Couldn't even get a dump with pywallet and an electrum.dat file.

Bounty for anyone who can help of course.
sr. member
Activity: 434
Merit: 250
meh i am still dicking around with my 15k ltc wallet any progress on litecoin wallet tools?
hero member
Activity: 826
Merit: 500
Crypto Somnium
Congrats!

FWIW, there are john the ripper patches for wallet.dat passphrases (which can attempt about 8 tries per second) ... also support for bc.i passphrases, with speeds more like 10 million per second.


any word on this  bc.i passphrases ?
staff
Activity: 4242
Merit: 8672
Congrats!

FWIW, there are john the ripper patches for wallet.dat passphrases (which can attempt about 8 tries per second) ... also support for bc.i passphrases, with speeds more like 10 million per second.
newbie
Activity: 39
Merit: 0
** UPDATE **

I have fixed it and found the passphrase. I was only 2 digits out.

Looks like the Ruby script was not very good at finding my passphrase until I substituted lower case with upper case.
Man, I thought that was what the script was supposed to do.

I more or less had the passphrase correct before it actually found it.
In the end I was only out by about 2 characters.

Thanks for all the help and support.

Thistled.
newbie
Activity: 39
Merit: 0
Would you believe I am still reindexing. It seems there is a problem with 0.8.4 and there are a few posts in here suggesting the same problem with 0.8.5.

Anyhow, the scripts provided seem to be moving characters around as opposed to substituting an e with a 3. How the hell do I achieve this?
I know my passphrase, I just can't remember which characters are replaced with numbers.

Any clever ruby scripters in here?
newbie
Activity: 39
Merit: 0
Okay, thanks for all the advice / suggestions.  Cry

Still rebuilding the index. So, I suppose it will be tomorrow now before I can try this script.

TIA.

Thistled.
newbie
Activity: 39
Merit: 0
** UPDATE **

Okay, as I am using Gentoo Linux, I checked out which version of Ruby my system was set to use.
I have ruby 20 installed, but the system was using 18.  Sad
It is now set to 20 and I think the script is working. (The syntax errors have gone)
However I think I might have to play around with the "words" in the script.

I am currently having to rebuild the block index again  Cry
so I am not sure if the script will succeed while thats going on.

Should I wait until it has finished re-indexing?
newbie
Activity: 39
Merit: 0
Here's one for mik3 @ https://bitcointalksearch.org/topic/forgot-passphrase-variations-of-words-and-capitalizations-170137 .

Anyone on Windows or who's had trouble getting these scripts to run may want to grab the test() function from this one.  It uses JSON-RPC instead of calling bitcoind, as suggested by 2112 above.

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

# Fill in your RPC username and password from your bitcoin.conf here.
$rpc_auth = "user", "pass"

max_bangs = 10
words = [
  [ "one"   , "One"   , "ONE"]   ,
  [ "two"   , "Two"   , "TWO"]   ,
  [ "three" , "Three" , "THREE"] ,
  [ "four"  , "Four"  , "FOUR"]  ,
]

def test(passphrase)
  puts passphrase
  request = Net::HTTP::Post.new("/")
  request.basic_auth *$rpc_auth
  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

def spin(phrase, array)
  return phrase if array.empty?
  array.first.map do |word|
    p = phrase.dup.push word
    spin(p, array[1,99])
  end
end

spin([], words).flatten(words.count - 1).each do |phrase|
  phrase.permutation(words.count) do |shuffled|
    (max_bangs + 1).times do |bangs|
      test shuffled.join(" ") + ("!" * bangs)
    end
  end
end

puts "No luck."

When I attempt to run this I get...

json.rb:20: syntax error, unexpected tSYMBEG, expecting kDO or '{' or '('
  request.body = { method:"walletpassphrase", params:[pas...
                                     ^

is this because I am trying to run the script on Linux. I aint a programmer but got the idea the " should be replaced with ( but that didn't make any difference either.
newbie
Activity: 39
Merit: 0
So if system=./bitcoind does not exist, what should I replace it with?
newbie
Activity: 39
Merit: 0
This will mean the original ruby script will need changed, as it refers to the existence of /.bitcoind which I do not have.

Should I change the system=/.bitcoind reference in the ruby script to bitcoin-qt ?
Should I run the brute.rb script from the parent directory of .bitcoin, because if I don't it will reside in the same folder as wallet.dat, which as far as I understand, you should not do.

Also, because I am not running bitcoind, but bitcoin-qt with the settings Luke-Jnr suggested, then how do I "getinfo" before running the script?

So many frustrating questions.

TIA.

Thistled.
Pages:
Jump to: