{"id":1057,"date":"2014-11-03T20:09:26","date_gmt":"2014-11-03T20:09:26","guid":{"rendered":"https:\/\/trouble.org\/?p=1057"},"modified":"2014-11-03T20:09:43","modified_gmt":"2014-11-03T20:09:43","slug":"getting-tcpdump-to-write-to-pcap-format","status":"publish","type":"post","link":"https:\/\/trouble.org\/?p=1057","title":{"rendered":"getting tcpdump to write to pcap format"},"content":{"rendered":"<p>I wouldn&#8217;t think I&#8217;d be writing something like this, but&#8230;..<\/p>\n<p>Apple changed the default of tcpdump to writeout pcap-ng format,<br \/>\nwhich wireshark doens&#8217;t understand by default. Wasn&#8217;t sure what<br \/>\nwas up, but a quick search didn&#8217;t get any hits&#8230; turns out the<br \/>\n-y flag is the key (at least, Mavericks+.)<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"bash codecolorer\">$ <span class=\"kw2\">sudo<\/span> tcpdump <span class=\"re5\">-w<\/span> <span class=\"sy0\">\/<\/span>tmp<span class=\"sy0\">\/<\/span><span class=\"nu0\">1<\/span><br \/>\ntcpdump: data <span class=\"kw2\">link<\/span> <span class=\"kw3\">type<\/span> PKTAP<br \/>\ntcpdump: listening on pktap, link-type PKTAP <span class=\"br0\">&#40;<\/span>Packet Tap<span class=\"br0\">&#41;<\/span>, capture <span class=\"kw2\">size<\/span> <span class=\"nu0\">65535<\/span> bytes<br \/>\n^C68 packets captured<br \/>\n<span class=\"nu0\">71<\/span> packets received by filter<br \/>\n<span class=\"nu0\">0<\/span> packets dropped by kernel<br \/>\n<br \/>\n$ <span class=\"kw2\">sudo<\/span> tcpdump <span class=\"re5\">-y<\/span> RAW <span class=\"re5\">-w<\/span> <span class=\"sy0\">\/<\/span>tmp<span class=\"sy0\">\/<\/span><span class=\"nu0\">2<\/span><br \/>\ntcpdump: data <span class=\"kw2\">link<\/span> <span class=\"kw3\">type<\/span> RAW<br \/>\ntcpdump: listening on pktap, link-type RAW <span class=\"br0\">&#40;<\/span>Raw IP<span class=\"br0\">&#41;<\/span>, capture <span class=\"kw2\">size<\/span> <span class=\"nu0\">65535<\/span> bytes<br \/>\n^C873 packets captured<br \/>\n<span class=\"nu0\">879<\/span> packets received by filter<br \/>\n<span class=\"nu0\">0<\/span> packets dropped by kernel<br \/>\n<br \/>\n$ <span class=\"kw2\">sudo<\/span> <span class=\"kw2\">file<\/span> <span class=\"sy0\">\/<\/span>tmp<span class=\"sy0\">\/<\/span><span class=\"br0\">&#91;<\/span><span class=\"nu0\">12<\/span><span class=\"br0\">&#93;<\/span><br \/>\n<br \/>\n<span class=\"sy0\">\/<\/span>tmp<span class=\"sy0\">\/<\/span><span class=\"nu0\">1<\/span>: data<br \/>\n<span class=\"sy0\">\/<\/span>tmp<span class=\"sy0\">\/<\/span><span class=\"nu0\">2<\/span>: tcpdump capture <span class=\"kw2\">file<\/span> <span class=\"br0\">&#40;<\/span>little-endian<span class=\"br0\">&#41;<\/span> - version <span class=\"nu0\">2.4<\/span> <span class=\"br0\">&#40;<\/span>raw IP, capture length <span class=\"nu0\">65535<\/span><span class=\"br0\">&#41;<\/span><br \/>\n<br \/>\n$<\/div><\/div>\n<p>Amusingly Apple&#8217;s own file command doesn&#8217;t even recognize the new format.<br \/>\nTime to alias tcpdump until things get sorted out.<\/p>\n<p>Not impressed with Apple&#8217;s documentation on this one.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I wouldn&#8217;t think I&#8217;d be writing something like this, but&#8230;.. Apple changed the default of tcpdump to writeout pcap-ng format, which wireshark doens&#8217;t understand by default. Wasn&#8217;t sure what was up, but a quick search didn&#8217;t get any hits&#8230; turns out the -y flag is the key (at least, Mavericks+.) $ sudo tcpdump -w \/tmp\/1 [&hellip;]<\/p>\n","protected":false},"author":44,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33,6],"tags":[292,291],"class_list":["post-1057","post","type-post","status-publish","format-standard","hentry","category-dinosaur","category-tech","tag-like-cats-i-hate-undocumented-change","tag-tcpdump"],"_links":{"self":[{"href":"https:\/\/trouble.org\/index.php?rest_route=\/wp\/v2\/posts\/1057","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/trouble.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/trouble.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/trouble.org\/index.php?rest_route=\/wp\/v2\/users\/44"}],"replies":[{"embeddable":true,"href":"https:\/\/trouble.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1057"}],"version-history":[{"count":5,"href":"https:\/\/trouble.org\/index.php?rest_route=\/wp\/v2\/posts\/1057\/revisions"}],"predecessor-version":[{"id":1062,"href":"https:\/\/trouble.org\/index.php?rest_route=\/wp\/v2\/posts\/1057\/revisions\/1062"}],"wp:attachment":[{"href":"https:\/\/trouble.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1057"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/trouble.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1057"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/trouble.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1057"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}