I am using expect
for a streamlined login script to a whitelisted-only (thus low vulnerability) postgres
instance. Here is the redacted script
#!/usr/bin/expect
set RDSI [lindex $argv 0]
spawn /usr/local/bin/psql -U postgres -h $RDSI -d clips
expect "Password"
send "myPassword\r"
interact
expect eof # I have tried with and without this line
Let's run it:
19:00:38/ciderapp $./exp.sh
spawn /usr/local/bin/psql -U postgres -h -d clips
SET
psql (12.4)
Type "help" for help.
clips=# # We get into the db v quickly
# Delays here for about 20+ seconds
myPassword # we don't necessarily want this printed!
clips-#
Three questions:
- Given the initial entry to the
clips
is very fast (essentially immediate) what is going on for the subsequent 20+ second delay? - Is there any way to suppress the display of the myPassword ?
- Given we were already connected before
myPassword
were printed then the behavior of ( a ) wait ~20seconds then ( b ) print themyPassword
is confusing. Can that be explained?