This may be useful for anyone in a "missing number" situation. You can set the start or end to "" (empty string) if the mystery number is at the end or beginning, and you can add 0 to the list of digits if yours might have a zero.
start = "pass"
finish = "word"
def test(phrase)
print phrase, "\t"
system("./bitcoind", "walletpassphrase", phrase, "20")
case $?.exitstatus
when 0
puts "Found it! #{phrase}"
exit 0
when 127
puts "bitcoind not found in current dir"
exit 1
when nil
puts "Aborting"
exit 1
end
end
(0..20).each do |length|
[1,2,3,4,5,6,7,8,9].repeated_permutation(length) do |digits|
test(start + digits.join + finish)
end
end