Greetings monks,

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.


The code that I have so far is here, if that helps explain my question better
$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";
It doesn't work, but I hope this helps explain what I mean

In reply to Expect, STDout, and formating by jcpunk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.