shlib / expect
Routines for interfacing to interactive applications
import expect
expect.open ssh://[email protected]
if expect.match "*assword:*"; then
expect.write 'FakePassword'
fi
while expect.read; do
case "$(expect.line)" in
(prompt) do_stuff;;
esac
done