Help with litecoin-cli to recover passphrase

Hello,

I have miss remembered my password to my wallet, but I think i am close. I found a script to brute force a passphrase for bitcoin, but i can’t seem to get it working for litecoin. My problem is getting the script to communicate with litecoin-ltc. It was originally written to access litecoind, but apparently that functionality has been moved to litecoin-ltc since the script was written.

Currently I’m running litecoind via terminal ( ./litecoind daemon ) and then ./litecoin-cli testnet but i get back this message

error: couldn’t connect to server: unknown (code -1)
(make sure server is running and you are connecting to the correct RPC port)

any help getting the proper syntax here would be much appreciated!

#!/usr/bin/ruby -w

passphrase = “guesshere”

def test(phrase)
print phrase, “\t"
system(”./litecoin-cli", “walletpassphrase”, phrase, “20”)
case $?.exitstatus
when 0
puts "Found it! #{phrase}"
exit 0
when 127
puts "litecoin-cli not found in current dir"
exit 1
end
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

list1 = scramble(passphrase)
list1.each { |i| test i }
list1.each { |i| scramble(i).each { |j| test j }}

puts "No luck."
exit 1