linux 檢查router
我想用LINUX去檢查ROUTER有無被設定密碼,
#!/usr/bin/expect -f
set timeout 2
set ip [lindex $argv 0]
set port [lindex $argv 1]
set local localhost
set para 0
spawn telnet 163.25.137.165 4001
expect {
"Connection refused"
{set para -1}
}
if {$para>-1} {
send "\n"
expect {
"Would you like to enter the initial configuration dialog?"
{set para 1}
"Router>"
{set para 2; send "en\n"; send "reload\n"; send "\n"}
"Router#"
{set para 3; send "reload\n"; send "\n"}
timeout
{set para 4; send "en\n"; send "reload\n"; send "no\n"; send "\n"}
}
}
if {$para!=1} {
spawn wget [url]http://sss@XXXXXXX
sleep 1
}
我是寫這樣,再用autoexpect去執行
但不能.....
想問問各位厲害的大大我這樣寫是哪裡有問題?
還是有哪裡出錯呢?
各位幫我解答一下吧