"Want more expert insights and updates? Follow us on LinkedIn and explore our company page to connect with us directly. Don’t miss out - click the link and join the conversation!"
Follow us on LinkedIn / plexinor
Company Website Https://www.plexinor.com
lab@admin:~$ cat E55
#!/usr/bin/expect
global spawn_id
global expect_out
global match_max
set load_fh [open "D-IP" r]
set ip_list [split [read $load_fh] "\n"]
close $load_fh
puts -nonewline "Enter your username: "
flush stdout
gets stdin username
#stty -echo
puts -nonewline "Enter your password: "
flush stdout
gets stdin password
#stty echo
#puts ""
foreach ip $ip_list {
set I 1
if {$ip != ""} {
#set timeout 30
#set u "lab"
#set p "lab123"
set sid [spawn ssh -l $username $ip]
#expect "?"
#send "yes\r"
expect "Password:"
send "$password\r"
expect "(I removed prompt with angle bracket as YouTube won't allow"
send "\r"
expect "(I removed prompt with angle bracket as YouTube won't allow"
send "show arp no-resolve |no-more\r"
expect "(I removed prompt with angle bracket as YouTube won't allow"
send "\r"
expect "(I removed prompt with angle bracket as YouTube won't allow"
puts "Done Collecting Command exiting from this Router ######################################$ip"
send "exit\r"
sleep 5
incr I
}
}