Re:Cryptkeeper sets the same password “p” independently of u...
by tangus on Monday January 30, 2017 @09:58AM
(#13521646)
I agree, but if a script is going to use the CLI then it's the script's responsibility to parse the prompts and not to blindly send strings to the program. `expect` exists since 1990, use it or reinvent it.
[ Parent
| on HN ]
Re:Cryptkeeper sets the same password “p” independently of u...
by woah on Monday January 30, 2017 @10:55AM
(#13522168)
Can you go over some good ways to use expect to avoid this type of issue?
Re:Cryptkeeper sets the same password “p” independently of u...
by tangus on Monday January 30, 2017 @12:21PM
(#13523054)
You simply use it to wait for the appropriate prompt before sending anything. If the expected prompt never arrives, something is wrong (CLI changed), so abort. The snippet for this particular case could be something like
set timeout=1
expect {
"enter \"p\" for pre-configured paranoia mode" { puts p\n }
timeout abort
eof abort
}