D
David Anderson
I am trying to automate the following session - to talk to my router:
=======================
telnet speedtouch
Trying 192.168.1.254...
Connected to speedtouch.
Escape character is '^]'.
Username : Administrator
Password :
------------------------------------------------------------------------
______ SpeedTouch 780
___/_____/\
/ /\ 6.1.7.2
_____/__ / \
_/ /\_____/___ \ Copyright (c) 1999-2006, THOMSON
// / \ /\ \
_______//_______/ \ / _\/______
/ / \ \ / / / /\
__/ / \ \ / / / / _\__
/ / / \_______\/ / / / / /\
/_/______/___________________/ /________/ /___/ \
\ \ \ ___________ \ \ \ \ \ /
\_\ \ / /\ \ \ \ \___\/
\ \/ / \ \ \ \ /
\_____/ / \ \ \________\/
/__________/ \ \ /
\ _____ \ /_____\/
\ / /\ \ /___\/
/____/ \ \ /
\ \ /___\/
\____\/
------------------------------------------------------------------------
_{Administrator}=>?
Following commands are available :
help : Displays this help information
menu : Displays menu
? : Displays this help information
exit : Exits this shell.
... : Exits group selection.
saveall : Saves current configuration.
ping : Send ICMP ECHO_REQUEST packets.
traceroute : Send ICMP/UDP packets to trace the ip path.
Following command groups are available :
firewall service autopvc connection cwmp
dhcp dns dsd dyndns eth
adsl atm config debug env
expr grp hostmgr ids igmp
interface ip ipqos label language
mbus memm mlp nat ppp
pptp script snmp sntp software
system systemlog upgrade upnp user
voice wireless
{Administrator}=>exit
========================
I am using the following code:
#!/usr/bin/env python
import pexpect
import sys
child = pexpect.spawn('telnet 192.168.1.254')
fout = file('mylog.txt','w')
child.logfile = fout
child.expect('sername : ')
child.sendline('Administrator')
child.expect('assword : ')
child.sendline('')
child.expect('_{Administrator}=>')
child.sendline('?')
child.expect('_{Administrator}=>')
child.expect('exit')
========================
This times out after child.sendline('Administrator')
mylog.txt contains:
Trying 192.168.1.254...
Connected to 192.168.1.254.
Escape character is '^]'.
Username : Administrator
Administrator
========================
Can anyone help me in finding out what I am doing wrong?
Regards
David
=======================
telnet speedtouch
Trying 192.168.1.254...
Connected to speedtouch.
Escape character is '^]'.
Username : Administrator
Password :
------------------------------------------------------------------------
______ SpeedTouch 780
___/_____/\
/ /\ 6.1.7.2
_____/__ / \
_/ /\_____/___ \ Copyright (c) 1999-2006, THOMSON
// / \ /\ \
_______//_______/ \ / _\/______
/ / \ \ / / / /\
__/ / \ \ / / / / _\__
/ / / \_______\/ / / / / /\
/_/______/___________________/ /________/ /___/ \
\ \ \ ___________ \ \ \ \ \ /
\_\ \ / /\ \ \ \ \___\/
\ \/ / \ \ \ \ /
\_____/ / \ \ \________\/
/__________/ \ \ /
\ _____ \ /_____\/
\ / /\ \ /___\/
/____/ \ \ /
\ \ /___\/
\____\/
------------------------------------------------------------------------
_{Administrator}=>?
Following commands are available :
help : Displays this help information
menu : Displays menu
? : Displays this help information
exit : Exits this shell.
... : Exits group selection.
saveall : Saves current configuration.
ping : Send ICMP ECHO_REQUEST packets.
traceroute : Send ICMP/UDP packets to trace the ip path.
Following command groups are available :
firewall service autopvc connection cwmp
dhcp dns dsd dyndns eth
adsl atm config debug env
expr grp hostmgr ids igmp
interface ip ipqos label language
mbus memm mlp nat ppp
pptp script snmp sntp software
system systemlog upgrade upnp user
voice wireless
{Administrator}=>exit
========================
I am using the following code:
#!/usr/bin/env python
import pexpect
import sys
child = pexpect.spawn('telnet 192.168.1.254')
fout = file('mylog.txt','w')
child.logfile = fout
child.expect('sername : ')
child.sendline('Administrator')
child.expect('assword : ')
child.sendline('')
child.expect('_{Administrator}=>')
child.sendline('?')
child.expect('_{Administrator}=>')
child.expect('exit')
========================
This times out after child.sendline('Administrator')
mylog.txt contains:
Trying 192.168.1.254...
Connected to 192.168.1.254.
Escape character is '^]'.
Username : Administrator
Administrator
========================
Can anyone help me in finding out what I am doing wrong?
Regards
David