I
Iñaki Baz Castillo
Hi, I'd like to know the Ruby equivalent to the following Perl code:
=2D--------------------
open(PIPE,"ngrep dst port 80 |");
select(PIPE); $| =3D 1; # make unbuffered
select(STDOUT); $| =3D 1; # make unbuffered
while(<PIPE>)
{ =20
chomp($_);
s/
//ig;
s/ // if(/^ /);
#### process and change the captured data before writting to the screen ##=
##
}
close(PIPE);
=2D------------------------
"ngrep" itself is a Linux command that captures TCP/UDP data and prints it =
to=20
the screen. In this case I capture traffic with destination port 80.
I assume I must start with:
f =3D IO.popen("ngrep dst port 80")
but no idea of what to do after that. Any help please? Thanks a lot.
=2D-=20
I=C3=B1aki Baz Castillo
=2D--------------------
open(PIPE,"ngrep dst port 80 |");
select(PIPE); $| =3D 1; # make unbuffered
select(STDOUT); $| =3D 1; # make unbuffered
while(<PIPE>)
{ =20
chomp($_);
s/
//ig;
s/ // if(/^ /);
#### process and change the captured data before writting to the screen ##=
##
}
close(PIPE);
=2D------------------------
"ngrep" itself is a Linux command that captures TCP/UDP data and prints it =
to=20
the screen. In this case I capture traffic with destination port 80.
I assume I must start with:
f =3D IO.popen("ngrep dst port 80")
but no idea of what to do after that. Any help please? Thanks a lot.
=2D-=20
I=C3=B1aki Baz Castillo