Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/expect -f
- set remote_server [ lindex $argv 0]
- set login [ lindex $argv 1]
- set password [ lindex $argv 2]
- log_user 0 # Отключаем вывод на экран.
- spawn telnet $remote_server
- expect "UserName:" {send "$login\r"}
- expect "PassWord:" {send "$password\r"}
- log_user 1 # Нам необходим результат поэтому активируем вывод
- set commandtxt [ open "command.txt" r]
- foreach uline [split [ read $commandtxt] "\n" ] {
- expect "*#" {send "$uline\r"}
- for {} 1 {} {
- expect {
- -timeout 5
- "*Next Page*" { send "n" }
- "More:*space*" { send " " }
- "*#" exit 0
- }
- }
- }
- close $commandtxt
- send "logout\r\n"
- log_user 0
Add Comment
Please, Sign In to add comment