jcpunk has asked for the wisdom of the Perl Monks concerning the following question:
I have got a script here using the Expect module and I need to get data out of it. normally I would just let it dump all over the screen, but it has to be formated nicely, so normally I would just throw together a reg-ex and use before() or after(), but I need to do some rather strange matching and do not think that solution is viable... so does anyone have any thoughts as to how to get STDout into a scalar from expect with log_stdout(0) enabled. Also keeping in mind that I am unable to dump output to a log and then open that up as that is "a security risk"...sigh
If anyone has any thoughts as to how this should be done they would be greatly apprecated.
It doesn't work, but I hope this helps explain what I mean$exp->send("/bin/sh\n"); #do lots of random shiznat here #that i dont want to see like a telnet login my $junk=$exp->send("/bin/cat /etc/passwd\n"); #do formating to skip things that arnt worth looking at #and probably make some tables so that it outputs nicely print "Output:<b>$junk</b>\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Expect, STDout, and formating
by cbro (Pilgrim) on Jun 12, 2003 at 21:03 UTC | |
|
Re: Expect, STDout, and formating
by BrowserUk (Patriarch) on Jun 12, 2003 at 21:19 UTC | |
|
Re: Expect, STDout, and formating
by aquarium (Curate) on Jun 12, 2003 at 22:27 UTC |