
esolve
New User
Oct 24, 2012, 10:37 AM
Post #1 of 5
(608 views)
|
I want to extract the content except http header from tcp flow files the content is like the following the http header ends when two ^M are met
HTTP/1.1 200 OK^M Last-Modified: Sat, 20 Mar 2010 09:43:12 GMT^M Content-Type: video/x-flv^M Date: Wed, 24 Oct 2012 14:34:13 GMT^M Expires: Wed, 24 Oct 2012 14:34:13 GMT^M Cache-Control: private, max-age=22124^M Accept-Ranges: bytes^M Content-Length: 29833281^M Connection: close^M X-Content-Type-Options: nosniff^M Server: gvs 1.0^M ^M FLV^A^E^@^@^@ ^@^@^@^@^R^@^CK^@^@^@^@^@^@^@^B^@ onMetaData^H^@^@^@^O^@^Hduration^@@i<97> =p£×^@ starttime^@^@^@^@^@^@^@^@^@^@^Mtotalduration^@@i<97> my code for extraction is as follows, and I run : extract.pl < tcp.flow but it seems the loop is endless, what is wrong with the codes? thanks!
#!/usr/bin/perl $start=0; $data=""; while(<STDIN>) { if ( $start eq 0 && $_ =~ /^\r\n/) { $start = 1; } elsif ( $start eq 1 ) { $data = $data . $_; } } open(FH, ">sample.flv"); print FH $data; close(FH);
(This post was edited by esolve on Oct 24, 2012, 10:38 AM)
|