Exclusively for TechExams members for Infosec Boot Camps starting before April 30, 2026
varelg wrote: » Perhaps the Expect tool can easily do that job. Not only simple login, but you can script your response based on what the remote machine answers back upon login. You would have to learn a bit of TCL, but it is a small tradeoff...
pram wrote: » No need to learn TCL, just use autoexpect:autoexpect(1) - Linux man page
#!/usr/bin/expect -f set host [lindex $argv 0] set pass [lindex $argv 1] set timeout 10 spawn ssh manager@$host expect { "(yes/no)? " { send "yes\n" expect "assword:" { send "$pass\n" } } "assword: " { send "$pass\n" } } # swap this for what ever you expect for prompt ( here it is 3com) expect "*>*" # put the command here send "backup fabric current-configuration to xxx.xxx.xxx.xxx name.cfg\n" expect "*>*" send "q\n" close $spawn_id
Exclusively for TechExam members. Applies to boot camps starting before April 30, 2026.