{"id":4458,"date":"2022-09-17T14:02:06","date_gmt":"2022-09-17T06:02:06","guid":{"rendered":"https:\/\/www.chenqing.work\/?p=4458"},"modified":"2022-09-17T16:31:46","modified_gmt":"2022-09-17T08:31:46","slug":"tcpdump-%e6%8a%93%e5%8c%85%e4%b8%80%e7%af%87","status":"publish","type":"post","link":"https:\/\/www.chenqing.work\/?p=4458","title":{"rendered":"tcpdump \u6293\u5305\u5feb\u901f\u4e0a\u624b"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1920\" height=\"1278\" src=\"https:\/\/www.chenqing.work\/wp-content\/uploads\/2022\/09\/ray-hennessy-xUUZcpQlqpM-unsplash-1.jpg\" alt=\"\" class=\"wp-image-4461\"\/><\/figure>\n\n\n\n<p>\u5f53\u524d\u4efb\u4f55\u7684\u8ba1\u7b97\u673a\u7cfb\u7cfb\u7edf\uff0c\u4e0d\u53ef\u80fd\u4e0d\u901a\u8fc7\u7f51\u7edc\u4f20\u8f93\u6570\u636e\uff0c\u903b\u8f91\u4e0a\u7684\u4e00\u4e2a\u7cfb\u7edf\uff0c\u5728\u7269\u7406\u4e16\u754c\u5f80\u5f80\u5bf9\u5e94\u82e5\u5e72\u5c0f\u7cfb\u7edf\u2014\u2014\u4e00\u4e2a\u96c6\u7fa4\u3002\u5bf9\u5916\u9700\u8981\u4e0e\u5176\u4ed6\u7cfb\u7edf\u4ea4\u6362\u4fe1\u606f\uff0c\u5bf9\u5185\u5404\u5c0f\u7cfb\u7edf\u4e5f\u9700\u8981\u4e92\u76f8\u4ea4\u6362\u4fe1\u606f\u3002\u4e16\u754c\u5c31\u662f\u8fd9\u6837\u8054\u7ed3\u5728\u4e00\u8d77\u7684\u3002<\/p>\n\n\n\n<p>\u5bf9\u4e8e\u4e00\u4e2a\u786e\u5b9a\u7684\u7cfb\u7edf\uff0c\u901a\u8fc7\u65e5\u5fd7\u6765\u89c2\u5bdf\u7cfb\u7edf\u5f80\u5f80\u4e0d\u90a3\u4e48\u786e\u5b9a\uff0c\u56e0\u4e3a\u65e5\u5fd7\u4ec5\u4ec5\u63ed\u793a\u4e86\u7cfb\u7edf\u7684\u5f88\u5c0f\u4e00\u90e8\u5206\u8fd0\u884c\u65f6\u884c\u4e3a\uff0c\u66f4\u5927\u7684\u4e00\u90e8\u5206\u4f9d\u65e7\u9690\u85cf\u5728\u9ed1\u6697\u91cc\u2014\u2014\u60f3\u60f3\u5355\u6b65\u8c03\u8bd5 springboot \u7684\u8c03\u7528\u8fc7\u7a0b\uff0c\u66f4\u522b\u8bf4 cpu \u6267\u884c\u7684\u6307\u4ee4\u5e8f\u5217\u4e86\u3002\u8fd9\u662f\u91c7\u7528\u81ea\u5e95\u5411\u4e0a\u65b9\u6cd5\u8bba\uff0c\u5bf9\u8ba1\u7b97\u903b\u8f91\u8fdb\u884c\u5c42\u5c42\u62bd\u8c61\u6240\u4e0d\u53ef\u907f\u514d\u5e26\u6765\u7684\u95ee\u9898\u3002<\/p>\n\n\n\n<p>\u76f8\u6bd4\u4e8e\u65e5\u5fd7\u63ed\u793a\u7684\u4e0d\u786e\u5b9a\u6027\uff0c\u7f51\u7edc\u5219\u663e\u5f97\u786e\u5b9a\u5f97\u591a\uff0c\u901a\u8fc7\u6293\u5305\uff0c\u53ef\u4ee5\u5b8c\u6574\u5730\u89c2\u5bdf\u5230\u7f51\u7edc\u7684\u6240\u6709\u884c\u4e3a\uff0c\u5feb\u901f\u5b9a\u4f4d\u8bf7\u6c42\u505c\u7559\u5728\u54ea\u4e2a\u8282\u70b9\u4e0a\uff0c\u4e0d\u5b58\u5728\u6ca1\u6709\u5bf9\u5e94\u62a5\u6587\u7684\u884c\u4e3a\u3002<\/p>\n\n\n\n<p>\u8fdb\u5165\u4e91\u539f\u751f\u65f6\u4ee3\u540e\uff0c\u5f80\u5f80\u5efa\u8bae\u901a\u8fc7\u8c03\u7528\u94fe\u8ddf\u8e2a\u6216\u8005\u6307\u6807\u76d1\u63a7\u6765\u8fdb\u884c\u95ee\u9898\u5b9a\u4f4d\uff0c\u5b58\u5728\u540c\u6837\u7684\u95ee\u9898\u2014\u2014\u8c03\u7528\u94fe\u548c\u6307\u6807\u90fd\u53ea\u63ed\u793a\u4e86\u7cfb\u7edf\u8fd0\u884c\u884c\u4e3a\u7a7a\u95f4\u7684\u4e00\u90e8\u5206\uff0c\u5f88\u591a\u65f6\u5019\u8fd8\u662f\u9700\u8981\u7ed3\u5408\u6293\u5305\u6765\u505a\u8fdb\u4e00\u6b65\u5206\u6790\uff0c\u4f46\u4e91\u73af\u5883\u5bf9\u6293\u5305\u884c\u4e3a\u7684\u652f\u6301\u5e76\u4e0d\u7406\u60f3\uff0c\u8fd9\u662f\u76ee\u524d\u611f\u5230\u675f\u624b\u675f\u811a\u7684\u4e00\u4e2a\u5730\u65b9\u3002<\/p>\n\n\n\n<p>windows \u7cfb\u7edf\u4e00\u822c\u53ef\u4ee5\u91c7\u7528 wireshark \u6216\u8005 network monitor \u8fdb\u884c\u6293\u5305\u3002linux \u7cfb\u7edf\u5219\u53ef\u4ee5\u91c7\u7528\u81ea\u5e26\u7684\u547d\u4ee4\u884c\u5de5\u5177 tcpdump\u3002<\/p>\n\n\n\n<p>\u8fc7\u6ee4\u8868\u8fbe\u5f0f\u683c\u5f0f\uff08tcpdump -i eth0 &#8220;ip and udp&#8221;\uff09<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u534f\u8bae\u7c7b\u578b\uff1a<ul><li>tcp<\/li><li>udp<\/li><li>ip<\/li><li>ip6<\/li><li>icmp<\/li><li>icmp6<\/li><li>&#8230;<\/li><\/ul><\/li><li>\u534f\u8bae\u5b57\u6bb5\uff1a<ul><li>ether src &lt;source mac&gt; ; <\/li><li>ether dst &lt;destination mac&gt; ; <\/li><li>src host &lt;source ip&gt; ; <\/li><li>dst host &lt;destination ip&gt; ; <\/li><li>src net &lt;source net&gt; ; <\/li><li>src port &lt;source port&gt; ; <\/li><li>&#8230;<\/li><\/ul><\/li><li>\u62a5\u6587\u67d0\u5904\u503c\uff1a<ul><li>ip[0:2]=0xcafe\uff0cip\u62a5\u6587\u7684\u5934\u4e24\u4e2a\u5b57\u8282\u4e3a16\u8fdb\u5236\u7684cafe ; <\/li><li>ether[0]=0xca\uff0c\u5e27\u7684\u5934\u4e00\u4e2a\u5b57\u8282\u4e3a16\u8fdb\u5236\u7684ca ; &nbsp;<\/li><li>ether[0] &amp; 1 = 0 and ip[16] &gt;= 224\uff0c\u7b5b\u9009\u6761\u4ef6\u7684\u7ec4\u5408\u4f7f\u7528 ;&nbsp;<\/li><li>tcp port 80 and (((ip[2:2] &#8211; ((ip[0]&amp;0xf)&lt;&lt;2)) &#8211; ((tcp[12]&amp;0xf0)&gt;&gt;2)) != 0)\uff0c\u8fd9\u662f\u4e00\u4e2a\u590d\u6742\u4e00\u4e9b\u7684\u4f8b\u5b50 ; <\/li><li>&#8230;<\/li><\/ul><\/li><\/ul>\n\n\n\n<p>\u5927\u90e8\u5206\u60c5\u51b5\u4e0b\uff0c\u91c7\u7528\u4ee5\u4e0b\u9009\u9879\u7ec4\u5408\u7ec4\u5408\u5c31\u591f\u7528\u4e86<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><tbody><tr><td><strong><em>\u53c2\u6570<\/em><\/strong><\/td><td><strong><em>\u8bf4\u660e<\/em><\/strong><\/td><\/tr><tr><td><strong>-i&nbsp; eth0<\/strong><\/td><td><strong>\u76d1\u542c eth0 \u63a5\u53e3<\/strong><\/td><\/tr><tr><td><strong>-n<\/strong><\/td><td><strong>\u4e0d\u8fdb\u884c rarp \u8f6c\u6362<\/strong><\/td><\/tr><tr><td><strong>-s0<\/strong><\/td><td><strong>\u4e0d\u9650\u5236\u6293\u53d6\u7684\u62a5\u6587\u5927\u5c0f<\/strong><\/td><\/tr><tr><td><strong>-w &lt;filename&gt;<\/strong><\/td><td><strong>\u5199\u5165\u6587\u4ef6<\/strong><\/td><\/tr><tr><td><strong>&#8220;dst host &lt;destination ip&gt;&#8221;<\/strong><\/td><td><strong>\u9650\u5b9a\u76ee\u6807\u5730\u5740<\/strong><\/td><\/tr><tr><td>&#8220;src host &lt;source ip&gt;&#8221;&nbsp;<\/td><td>\u9650\u5b9a\u6e90\u5730\u5740<\/td><\/tr><tr><td>-c 100<\/td><td>\u6293\u53d6\u524d 100 \u4e2a\u62a5\u6587<\/td><\/tr><tr><td>&#8220;dst port 22&#8221;<\/td><td>\u9650\u5236\u76ee\u6807\u7aef\u53e3<\/td><\/tr><tr><td>&#8220;src net 192.168.1.0\/24&#8221;<\/td><td>\u9650\u5236\u6e90\u7f51\u6bb5<\/td><\/tr><tr><td>&#8220;(src port 21) and (dst port 22)&#8221;<\/td><td>\u4e0e<\/td><\/tr><tr><td>or<\/td><td>\u6216<\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u5f53\u524d\u4efb\u4f55\u7684\u8ba1\u7b97\u673a\u7cfb\u7cfb\u7edf\uff0c\u4e0d\u53ef\u80fd\u4e0d\u901a\u8fc7\u7f51\u7edc\u4f20\u8f93\u6570\u636e\uff0c\u903b\u8f91\u4e0a\u7684\u4e00\u4e2a\u7cfb\u7edf\uff0c\u5728\u7269\u7406\u4e16\u754c\u5f80\u5f80\u5bf9\u5e94\u82e5\u5e72\u5c0f\u7cfb\u7edf\u2014\u2014 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[91],"class_list":["post-4458","post","type-post","status-publish","format-standard","hentry","category-code","tag-tcpdump"],"_links":{"self":[{"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/posts\/4458","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4458"}],"version-history":[{"count":35,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/posts\/4458\/revisions"}],"predecessor-version":[{"id":4495,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=\/wp\/v2\/posts\/4458\/revisions\/4495"}],"wp:attachment":[{"href":"https:\/\/www.chenqing.work\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4458"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4458"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chenqing.work\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4458"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}