I have been playing around with TCPFlow to look at telnet traffic. What I would like to do is have the output from TCPFlow redirected to a Perl Script that watches for the phrase "Password:" then prints out the following password to a terminal window or separate file. How do I redirect the output from TCPFlow to my Perl Script then constantly search it to find the "Password" string? Any suggestions?
A:
If you open TCPFlow as a subprocess open(my $infh, "<", "TCPFlow args|")
, you can get its output as a filehandle. The manual page has more.
Matt Kane
2010-09-05 17:41:44
You may also want to look at [`perldoc perlopentut`](http://perldoc.perl.org/perlopentut.html)
Chas. Owens
2010-09-05 18:07:21
humm...Im not sure how this would work. For tcpflow I can either write it to the console window or to a file. #tcpflow -c -s is what prints it out to the console window. So, it would be open(my $infh, "<", "tcpflow -c -s|")?
Jesse Miller
2010-09-05 20:34:51
what if I did open(FH, "tcpflow -c -s |");
Jesse Miller
2010-09-05 20:59:12
Would I be able to constantly search that file handle to look for a string?
Jesse Miller
2010-09-05 21:00:15
That call to open looks ok, What you can do in that case is `while (m $line = <FH>) { dostuffwith($line); }`
Matt Kane
2010-09-06 18:54:10