Join the nixCraft community via RSS Feed, Email Newsletter or follow on Twitter. He wrote more than 7k+ posts and helped numerous readers to master IT topics. Vivek Gite is the founder of nixCraft, the oldest running blog about Linux and open source. Hacking Beetel 220x ADSL router (Broadcom BCM6338).You can now modify script.exp to reboot or to run other commands. Output: autoexpect done, file is script.exp You are done, type exit to stop autoexepct command: Next type telnet command (telnet to the router): $ autoexpectautoexpect started, file is script.exp
#Dreambox telnet command how to#
Moreover, if you are a beginner, you may be able to get away with learning nothing more about Expect than how to call autoexpect. It is much easier to cut/paste hunks of autoexpect scripts together than to write them from scratch. Even if you are an Expect expert, you will find it convenient to use autoexpect to automate the more mindless parts of interactions. It watches you interacting with another program and creates an Expect script that reproduces your interactions For straightline scripts, autoexpect saves substantial time over writing scripts by hand. If you are a new to expect then use autoexpect command to generate script. Therefore, you may need to modify above script to work with your router. Since my ISP router offers menu as soon as login above script may not work on generic router such as Cisco or linksys router. For example to display router uptime, interface information and to reboot router you need to type command as follows: You need to pass command to script to execute on a router. $ chmod +x router.exp How do I run this script? Save script and setup executable permission on it: Send - " $pass \r" # get out of ISP's Stupid menu program, go to shell
#Dreambox telnet command password#
Spawn telnet $routerip # send username & password #!/usr/bin/expect -f set timeout 20 # router user name set name "admin" # router password set pass "PASSWORD" # router IP address set routerip "192.168.1.254" # Read command as arg to this script set routercmd # start telnet