{"id":66,"date":"2011-05-20T15:42:32","date_gmt":"2011-05-20T14:42:32","guid":{"rendered":"http:\/\/www.phillips321.co.uk\/?p=66"},"modified":"2011-07-14T11:25:25","modified_gmt":"2011-07-14T10:25:25","slug":"extract-files-from-pcaps","status":"publish","type":"post","link":"https:\/\/www.phillips321.co.uk\/2011\/05\/20\/extract-files-from-pcaps\/","title":{"rendered":"Extracting files from PCAPs"},"content":{"rendered":"<p>So on a job i had captured some data transfer off the wire but wanted to put some proof of that in the report and for some brownie points.<\/p>\n<p>I wasn&#8217;t entirely sure what tool to use but a quick google pointed me in the direction of <a href=\"http:\/\/foremost.sourceforge.net\/\">foremost<\/a>.<\/p>\n<p>The pcap was captured in wireshark so i opened it up again and found the correct TCP stream that contained what looked like a pdf. Clicked &#8220;follow TCP Stream&#8221; and then save as (ensure RAW is selected).<\/p>\n<p>I saved the file as stream.raw and then used the foremost utility:<\/p>\n<div class=\"codecolorer-container bash vibrant\" style=\"overflow:auto;white-space:nowrap;width:100%;height:300px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/>10<br \/>11<br \/>12<br \/>13<br \/>14<br \/>15<br \/>16<br \/>17<br \/>18<br \/>19<br \/>20<br \/>21<br \/>22<br \/>23<br \/>24<br \/>25<br \/>26<br \/>27<br \/>28<br \/>29<br \/>30<br \/>31<br \/>32<br \/>33<br \/>34<br \/>35<br \/>36<br \/><\/div><\/td><td><div class=\"bash codecolorer\">root<span class=\"sy0\">@<\/span>GnackTrackR7:<span class=\"sy0\">\/<\/span><span class=\"co0\"># foremost -v -i stream.raw<\/span><br \/>\nForemost version 1.5.7 by Jesse Kornblum, Kris Kendall, and Nick Mikus<br \/>\nAudit File<br \/>\nForemost started at Sun May &nbsp;<span class=\"nu0\">8<\/span> <span class=\"nu0\">14<\/span>:<span class=\"nu0\">20<\/span>:<span class=\"nu0\">33<\/span> <span class=\"nu0\">2011<\/span><br \/>\nInvocation: foremost <span class=\"re5\">-v<\/span> <span class=\"re5\">-i<\/span> stream.raw<br \/>\nOutput directory: <span class=\"sy0\">\/<\/span>output<br \/>\nConfiguration file: <span class=\"sy0\">\/<\/span>usr<span class=\"sy0\">\/<\/span>local<span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>foremost.conf<br \/>\nProcessing: stream.raw<br \/>\n<span class=\"sy0\">|<\/span>------------------------------------------------------------------<br \/>\nFile: stream.raw<br \/>\nStart: Sun May &nbsp;<span class=\"nu0\">8<\/span> <span class=\"nu0\">14<\/span>:<span class=\"nu0\">20<\/span>:<span class=\"nu0\">33<\/span> <span class=\"nu0\">2011<\/span><br \/>\nLength: <span class=\"nu0\">395<\/span> KB <span class=\"br0\">&#40;<\/span><span class=\"nu0\">405422<\/span> bytes<span class=\"br0\">&#41;<\/span><br \/>\n<br \/>\nNum &nbsp;Name <span class=\"br0\">&#40;<\/span><span class=\"re2\">bs<\/span>=<span class=\"nu0\">512<\/span><span class=\"br0\">&#41;<\/span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Size &nbsp;File Offset&nbsp; &nbsp; &nbsp;Comment<br \/>\n<br \/>\n<span class=\"nu0\">0<\/span>:&nbsp; 00000000.htm &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"nu0\">1<\/span> KB &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"nu0\">308<\/span><br \/>\n<span class=\"nu0\">1<\/span>:&nbsp; 00000004.htm &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"nu0\">1<\/span> KB &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"nu0\">2405<\/span><br \/>\n<span class=\"nu0\">2<\/span>:&nbsp; 00000008.htm &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"nu0\">1<\/span> KB &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"nu0\">4202<\/span><br \/>\n<span class=\"nu0\">3<\/span>:&nbsp; 00000790.htm &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"nu0\">506<\/span> B &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"nu0\">404914<\/span><br \/>\n<span class=\"nu0\">4<\/span>:&nbsp; 00000012.pdf &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"nu0\">389<\/span> KB &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"nu0\">6286<\/span><br \/>\n<span class=\"sy0\">*|<\/span><br \/>\nFinish: Sun May &nbsp;<span class=\"nu0\">8<\/span> <span class=\"nu0\">14<\/span>:<span class=\"nu0\">20<\/span>:<span class=\"nu0\">34<\/span> <span class=\"nu0\">2011<\/span><br \/>\n<br \/>\n<span class=\"nu0\">5<\/span> FILES EXTRACTED<br \/>\n<br \/>\nhtm:= <span class=\"nu0\">4<\/span><br \/>\npdf:= <span class=\"nu0\">1<\/span><br \/>\n<span class=\"re5\">------------------------------------------------------------------<\/span><br \/>\n<br \/>\nForemost finished at Sun May &nbsp;<span class=\"nu0\">8<\/span> <span class=\"nu0\">14<\/span>:<span class=\"nu0\">20<\/span>:<span class=\"nu0\">34<\/span> <span class=\"nu0\">2011<\/span><br \/>\nroot<span class=\"sy0\">@<\/span>GnackTrackR7:<span class=\"sy0\">\/<\/span><span class=\"co0\"># cd output\/<\/span><br \/>\nroot<span class=\"sy0\">@<\/span>GnackTrackR7:<span class=\"sy0\">\/<\/span>output<span class=\"sy0\">\/<\/span><span class=\"co0\"># ls<\/span><br \/>\naudit.txt &nbsp;htm &nbsp;pdf<br \/>\nroot<span class=\"sy0\">@<\/span>GnackTrackR7:<span class=\"sy0\">\/<\/span>output<span class=\"co0\"># cd pdf\/<\/span><br \/>\nroot<span class=\"sy0\">@<\/span>GnackTrackR7:<span class=\"sy0\">\/<\/span>output<span class=\"sy0\">\/<\/span>pdf<span class=\"co0\"># ls<\/span><br \/>\n00000012.pdf<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>Am bam there you have it, the pdf file opened fine and a quick screen grab was placed in the report \ud83d\ude09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So on a job i had captured some data transfer off the wire but wanted to put some proof of that in the report and for some brownie points. I wasn&#8217;t entirely sure what tool to use but a quick google pointed me in the direction of foremost. The pcap was captured in wireshark so [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[88,86,87,89,85],"_links":{"self":[{"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/posts\/66"}],"collection":[{"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/comments?post=66"}],"version-history":[{"count":3,"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/posts\/66\/revisions"}],"predecessor-version":[{"id":197,"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/posts\/66\/revisions\/197"}],"wp:attachment":[{"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/media?parent=66"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/categories?post=66"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.phillips321.co.uk\/wp-json\/wp\/v2\/tags?post=66"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}