Expect

Expect is used to automate control of interactive applications such as Telnet, FTP, passwd, fsck, rlogin, tip, SSH, and others.

Many of these products provide some type of command-line interface, but these usually lack the power needed to write scripts.

They were built to service the users administering the product, but the company often does not spend the resources to fully implement a robust scripting language.

After retrieving information by interacting with the product via its command-line interface, the script can make intelligent decisions about what action to take, if any.

Another example of automated SSH login to a user machine: Various projects implement Expect-like functionality in other languages, such as C#, Java, Scala, Groovy, Perl, Python, Ruby, Shell and Go.