12345678910111213141516171819202122232425 |
- set timeout 10
- set IP [lindex $argv 0]
- set LOGIN [lindex $argv 1]
- set PASSWORD [lindex $argv 2]
- set METHOD [lindex $argv 3]
- if {[string match "TELNET" $METHOD]} {
- spawn telnet $IP
- expect "Username:*"
- send "$LOGIN\r"
- } elseif {[string match "SSH" $METHOD]} {
- spawn ssh $LOGIN@$IP
- expect {
- "(yes/no" {
- send "yes\r"
- }
- }
- }
- expect "Password:*"
- send "$PASSWORD\r"
- expect "*#"
- send "write\r"
- expect "*#"
- send "exit\r"
|