You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
471 B
30 lines
471 B
#!/usr/bin/expect
|
|
|
|
set timeout 10
|
|
set host [lindex $argv 0]
|
|
set port [lindex $argv 1]
|
|
set pass [lindex $argv 2]
|
|
|
|
spawn telnet $host $port
|
|
expect "password:"
|
|
send "$pass\r"
|
|
expect "Logged in successfully"
|
|
#send "say 'This is a test (shutdown command) (no, it is not actually shutting down, hence the test).'\r"
|
|
send "saveandexit 0\r"
|
|
expect eof
|
|
|
|
|
|
##!/usr/bin/env sh
|
|
#host=$1
|
|
#port=$2
|
|
#pass=$3
|
|
#
|
|
#telnet $host $port <<EOF
|
|
#$pass
|
|
#say 'This is a test.'
|
|
#^]
|
|
#EOF
|
|
#
|
|
#exit 0
|
|
|