Python Forum
Multithread telnet not working Parallel
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multithread telnet not working Parallel
#6
Hi All,

I have below script to telnet devices and gather MAC details with noappend mode and storing in file. I would like to convert this to python script.
##########
#log_user 0
set timeout 10
set f [open "UT-ROM-Batch-1.txt"]
set hosts [split [read -nonewline $f] "\n"]
log_file
foreach host $hosts {
spawn telnet $host
expect {
"Login:" {
}
timeout {
continue
}
}

send "admin\r"
expect "Password:"
send "1234\r"
expect "Alfran1>"
send "dsl -c\r" # Prompt change
expect "\\$" # New prompt
log_file -noappend /home/anna/scripts/ut/$host.umac
send "get bridge port forwarding\r"
expect "\\$"
send "\x1A" # Send control+z to come out from inner prompt
expect "Alfran1>" # Outer prompt
send "exit\r"
log_file

}
expect eof
close $f
Reply


Messages In This Thread
Multithread telnet not working Parallel - by anna - Feb-01-2018, 11:02 AM
Convert expect script to python.. help required - by anna - Feb-05-2018, 12:31 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  telnet from ssh tunnel oldfart 3 7,190 Jul-17-2020, 02:28 PM
Last Post: noobami99
  telnet to a device under tacacs management kang18 0 1,582 Jun-05-2020, 06:11 AM
Last Post: kang18
  3.6 telnet eyler 3 11,314 Jun-28-2019, 05:22 AM
Last Post: Khanhamid90
  Any suggestion on python library to use for both ssh and telnet? lord_mani 4 3,793 Jun-25-2019, 04:07 PM
Last Post: gb74razor
  telnet question jacklee26 2 2,520 Mar-30-2019, 06:45 AM
Last Post: jacklee26
  Retrieve output from telnet command Networker 1 4,130 Mar-12-2019, 01:36 PM
Last Post: searching1
  Aggregate multiple telnet connections Jibeji 1 4,282 Mar-02-2018, 07:21 PM
Last Post: mpd
  Python telnet script for IP list mangesh 1 61,666 Jun-26-2017, 11:12 PM
Last Post: DeaD_EyE
  Need advice: UDP? TCP? Multithread? Guybrush 5 5,157 Apr-28-2017, 08:04 PM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020