Multiple Telnet sessions through one script

vmalhotra drdpmalhotra at gmail.com
Mon Jul 31 09:33:43 EDT 2006


Hi

I am new in python scripting. I want to open a Multiple telnet session
through once script. In other way i can tell i want to open two linux
consoles through one script.

I wrote one script, but the issue is I am not able to open multiple
consoles. The Scripts which i wrote is as follows:

import pexpect
session = pexpect.spawn("telnet localhost 2601\n")
session.expect("Password: ")
session.send("XYZ\n\n")
session.expect("Router1> ")
session1 = pexpect.spawn("telnet localhost 2604\n")
session1.expect("Password: ")
session1.send("ABCD\n\n")
session1.expect("ospfd> ")
#session1.interact()
session1.interact()

output :
ospf>

But in this case, i want in one console router one can open and on
other console ospf should open. But this i want to do is through one
script only.

Regds
Vik




More information about the Python-list mailing list