Re: expect/telnet

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On Fri, Mar 25, 2005 at 02:53:44PM -0600, rado wrote:
> > Hey y'all,
> > This Project: I have to reset my modem thru a script
> > what I can do:
> > # I can telnet into the modem
> > it asks me for my password
> > then I gotta hit "r" to reset
> > then I gotta hit "y" as a confirmation
> > then it's done and I am back at the shell prompt
> > 
> > ....need to get turned on to a very basic get me started tutorial 
> > ....and maybe after that, w/luck, a really good telnet example in a
> > script.
> 
> 
> > I just need a good point in the right direction...google and the man
> > page didn't do me too much
> 
> Google didn't help you find an expect tutorial ?
> 
> Are you sure you spelled google correctly?
course I spelled gougle right!
I really think my real problem is what I'm trying to expect.
telnet to the zoom ok to this screen:
                           CONEXANT SYSTEMS, INC.
                  ACCESS RUNNER ADSL CONSOLE PORT  3.27





















LOGON PASSWORD> *********************************
go to type password and it like overwrites itself...I have never been
able to do it the first time(password kinda overwrites itself in a wierd
way)
discovered that if I just hit return first time it asks, I can get my
password in but still like it's overwriting itself in that wierd way.

this is where the hangup is at.

using a script.exp that autoexpect produces just hangs right there no
matter what I try to do w/the timeout thang.
just dunno...wish I could find a way to do it w/out expect really.
jr
> 
> The best source of information on Expect is the book Exploring Expect by
> Don Libes published by O'Reilly. It contains an excellent tutorial on
> Expect and it's underlying language Tcl
> 
> 
> Here is a telnet example that returns the number of emails in your pop
> "account":
> 
> 
> #!/usr/bin/expect 
> 
> log_user 0
> eval spawn telnet -l myname pop.my_ISP.com 110
> expect "ready."
> send "user myname\r"
> expect "PASS"
> send "pass secret\r"
> expect "welcome"
> send "stat\r"
> expect "+OK "
> expect -re "\[0-9]* "
> set answer $expect_out(0,string)
> send_user "$answer \r\n"
> expect -re "\[0-9]*\r\n"
> send "quit\r"
> expect "signing off"
> exit
that is a neet script, Jeff  

jr

-- 
rado <rado@xxxxxxxxxxxxxxx>


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux