Hi All,
I'm developing TCL code to enter a list of passwords into ecryptfs in order to find which password is accurate. I know the base of the password, but I'm missing the cap status and the charcters for the last two digits, but I have the possible characters narrowed down. The bottom line is a I have about 200-250 password I need to feed into ecryptfs.
I coded the following and I will explain the resulting error at the end of the code
Code:
#!/usr/bin/expect
set timeout 10
#Set variables here – prefer incrementing through list
set pwlist[list Pass1 Pass2]
foreach password $pwlist {
spawn sudo "ecryptfs-recover-private"
expect {
timeout { send_user "\nTime Out Hit\n"; puts "$password\r"; exit 1 }
eof { send_user "\nEnd of file hit, attempt terminated \n"; exit 1 }
if {"Try to recover this directory? [Y/n]: "} {
send "y\r"
} elseif {"Do you know your LOGIN passphrase? [Y/n] "} {
send "y\r"
} elseif {"Passphrase: "} {
send "$password\r"
} else {
puts "end of expect if statement"
}
}
}
ecryptfs responds:
Try to recover this directory? [Y/n]:
The Expect response should be "Y"
Then ecryptfs asks:
Do you know your LOGIN passphrase? [Y/n]
The Expect response should be "Y"
Then it asks:
Passphrase:
The Expect response should be to enter the current password in the list.
The result:
"Try to recover this directory? [Y/n]: " is displayed in the terminal and nothing happens until it times out. If I enter the Y, nothing happens until it times out. The first password int he list is displayed in the terminal afer it times out.
I think the problem likely lies here:
"if {"Try to recover this directory? [Y/n]: "}"
My guess is it should be in the form:
"if {$return_var = "Try to recover this directory? [Y/n]: "}" or some such.
I can't find anything to guide my way, so any help is appreciated.
TIA...