I need the script to generate a password that must contain 6 and 7 within the parameters already set, if someone could help me modify the script that would be great
i.e: it would generate
PASSWORD63427
PASSWORD364734
It would always contain 6,7 within the numbers and have the ability to have 6 and 7 more than once
#!/usr/bin/ruby
middle = "PASSWORD" # The known part in the middle
min_right = 3 # The minimum number of chars on the left
max_right = 6 # The maximum number of chars on the left
max_total = 6 # The max total unknowns
chars = '456789'.chars.to_a # Possible chars to choose from
#chars << '\\' # ... plus backslash
#chars << "'" # ... plus single quote
def test(phrase)
print phrase, "\t"
system("./litecoind", "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
(1..max_total).each do |length|
chars.repeated_permutation(length) do |str|
max_offset = [max_right, length].min
(min_right..max_offset).each do |offset|
right = str.join[0,offset]
left = str.join[offset,99] || ""
test(middle + right)
end
end