02 setembro, 2011

Script para facilitar o acesso ao RedBoot de alguns roteadores

# set the IP address and the port for the loader.
set target ""
set port 9000
# 1. Start ping and wait for a response.
# 2. When RedBoot is alive, start the telnet session.
# 3. Allow .5 seconds after the connect for telnet
# to get his act in order.
# 4. Send the ^C and wait for the RedBoot prompt.
# 5. Get the version information.
# 6. Return control to the user.
spawn ping $target
set timeout -1
expect {
-re "time=.*$" close
spawn telnet $target $port
expect -re "Escape character is.*$" {
sleep .5
send \003
expect "RedBoot>" {
send "version\r"

*Precisa ter o pacote "expect" instalado. No debian faça: apt-get install expect

Nenhum comentário:

Postar um comentário