79387399

Date: 2025-01-25 19:46:40
Score: 2.5
Natty:
Report link

I don't have the reputation to comment above, so adding this as a response instead - even though the approach was spawned by the above info.

interact "\r" {return}
send "\r"

The use of "\r" as the terminating condition for interact means that the password or other secret goes directly from the user to the spawned process, except for the terminating carriage return, which the send then replaces on the user's behalf and completes the user's intention.

The {return} is required because expect's default action is to drop the terminal into a tcl/expect interpreter prompt. Return tells the interpreter to return from the Interact function and continue with the script.

Reasons:
  • Blacklisted phrase (1): to comment
  • RegEx Blacklisted phrase (1.5): I don't have the reputation to comment
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Dwm_bsd