[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: scripting a telnet session in lua
- From: Sean Conner <sean@...>
- Date: Fri, 22 Jul 2011 16:06:17 -0400
It was thus said that the Great Wade Guidry once stated:
> I'm new to lua.
>
> I'm trying to script a session against a telnet server (login, run a few commands within a menu-driven interface, then close the session).
>
> I'm using lua sockets. My code appears below.
>
> I'm not getting the expected results, though the code seems to run OK.
>
> I'm trying to figure out how I can "see" what's going on during the session.
>
> Is there a way in lua to echo back the server responses, for example?
You could try using conn:receive() (which blocks until data is received)
and printing the results. I don't have much experience with Lua sockets so
that's the best suggestion I can give.
> local assert (conn:send("^E\n")) (ed. note: not sure if this is the correct way to send a ctrl-E. Also tried \005 )
Using "\5\n" should work.
-spc