{"id":3389,"date":"2024-03-24T05:52:29","date_gmt":"2024-03-23T21:52:29","guid":{"rendered":"http:\/\/www.ccwifi.cc\/blogs\/?p=3389"},"modified":"2024-03-24T05:52:29","modified_gmt":"2024-03-23T21:52:29","slug":"scapy%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b09064","status":"publish","type":"post","link":"https:\/\/www.ccwifi.cc\/blogs\/2024\/03\/24\/scapy%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b09064\/","title":{"rendered":"scapy\u5b66\u4e60\u7b14\u8bb0"},"content":{"rendered":"<div>\n<p>\u5728\u7ebfwifi\u8dd1\u5305 \u91d1\u521a\u5305\u8dd1\u5305 cap\u8dd1\u5305 hccapx ewsa\u5728\u7ebf \u5c31\u6765 <strong><a href=\"https:\/\/ccwifi.cc\" target=\"_blank\" rel=\"noopener\">\u63e1\u624b\u5305\u8dd1\u5305<\/a><\/strong><\/p>\n<p>\u5404\u4f4d\u597d \u53c8\u89c1\u9762\u4e86 \u6211\u662f\u66f9\u64cd \u4eca\u5929\u7ed9\u5927\u5bb6\u5e26\u6765\u4e00\u7bc7\u65b0\u7684\u6559\u7a0b<\/p>\n<p>\u5e0c\u671b\u5404\u4f4d\u7ec6\u5fc3\u5b66\u4e60 \u4f4e\u8c03\u7528\u7f51<\/p>\n<\/div>\n<pre><code>from scapy import *\nf=repcap('pcap_oath')<\/code><\/pre>\n<p><!-- \u6587\u7ae0\u6765\u6e90:https:\/\/blog.csdn.net\/sonflower123\/article\/details\/124683653 --><\/p>\n<p>\u5728\u89e3\u6790\u6570\u636e\u5305\u65f6\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u57fa\u672c\u51fd\u6570rdpcap()\u6765\u8bfb\u53d6pcap\u6587\u4ef6\u3002\u8fd9\u4e2a\u51fd\u6570\u8fd4\u56de\u7684\u662f\u4e00\u4e2ascapy.plist.Packet List\u7c7b\u578b\u7684\u5bf9\u8c61\uff0c\u53ef\u4ee5\u50cf\u64cd\u4f5c\u5217\u8868\u4e00\u6837\u4f7f\u7528\u3002\u4f8b\u5982\uff0c\u8981\u8bfb\u53d6\u7b2c\u4e00\u4e2a\u6570\u636e\u5305\u7684\u5185\u5bb9\uff0c\u53ef\u4ee5\u4f7f\u7528f[0]\uff0c\u7136\u540e\u4f7f\u7528f[0].show()\u6216f[0].display()\u6765\u683c\u5f0f\u5316\u6253\u5370\u6570\u636e\u5305\u3002<\/p>\n<p>\u8c03\u7528rdpcap()\u51fd\u6570\u65f6\uff0c\u6574\u4e2apcap\u6587\u4ef6\u5c06\u88ab\u8bfb\u5165\u5185\u5b58\u3002\u5982\u679cpcap\u6587\u4ef6\u8fc7\u5927\uff0c\u89e3\u6790\u901f\u5ea6\u53ef\u80fd\u4f1a\u975e\u5e38\u6162\u3002\u56e0\u6b64\uff0c\u5efa\u8bae\u5904\u7406\u7684\u6570\u636e\u5305\u5927\u5c0f\u4e0d\u8981\u8fc7\u5927\u3002<\/p>\n<p>show()\u548cdisplay()\u65b9\u6cd5\u53ef\u4ee5\u663e\u793a\u6570\u636e\u5305\u7684\u5c42\u6b21\u7ed3\u6784\u3002\u4f8b\u5982\uff0c\u901a\u8fc7f[3].payload\u53ef\u4ee5\u83b7\u53d6\u7b2c\u56db\u4e2a\u6570\u636e\u5305\u7684\u8f7d\u8377\u90e8\u5206\u3002\u901a\u8fc7\u91cd\u590d\u8c03\u7528payload\u65b9\u6cd5\uff0c\u6211\u4eec\u53ef\u4ee5\u627e\u5230\u6240\u9700\u7684\u5c42\uff0c\u5e76\u63d0\u53d6\u548c\u5206\u6790\u5176\u4e0b\u7684\u5b57\u6bb5\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u6cd5\u63d0\u53d6\u6570\u636e\u5305\u7684\u6e90IP\u5730\u5740\u3002\u7c7b\u4f3c\u5730\uff0c\u6211\u4eec\u53ef\u4ee5\u5bf9\u6570\u636e\u5305\u7684\u4efb\u4f55\u5b57\u6bb5\u8fdb\u884c\u63d0\u53d6\u548c\u5206\u6790\u3002<\/p>\n<p>\u5728scapy\u5e93\u4e2d\uff0c\u6570\u636e\u5305\u6309\u7167show()\u65b9\u6cd5\u7684\u5c42\u6b21\u7ed3\u6784\u8fdb\u884c\u7ba1\u7406\u3002\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u5173\u952e\u5b57\u63d0\u53d6\u6570\u636e\u5305\u5404\u4e2a\u5c42\u6b21\u7684\u5185\u5bb9\uff0c\u6216\u8005\u79fb\u52a8\u5230\u4efb\u4f55\u4e00\u5c42\u8fdb\u884c\u5185\u5bb9\u63d0\u53d6\u3002\u4e0b\u9762\u662f\u5bf9\u56fe\u4e2d\u6570\u636e\u5305\u8fdb\u884c\u5b9e\u9a8c\u7684\u793a\u4f8b\u3002<\/p>\n<p>\u79fb\u52a8\u5230\u4e0b\u4e00\u5c42\uff1a<\/p>\n<blockquote>\n<blockquote>\n<blockquote>\n<p>f[3].payload.show()<\/p>\n<h3 id=\"ip\">[ IP ]<\/h3>\n<p>version   = 4<br \/>\n        ihl= 5<br \/>\n        tos= 0x0<br \/>\n        len= 602<br \/>\n        id= 47448<br \/>\n        flags=<br \/>\n        frag= 0<br \/>\n        ttl= 128<br \/>\n        proto= tcp<br \/>\n        chksum    = 0x24e8<br \/>\n        src= 172.31.1.15<br \/>\n        dst= 172.32.1.15<br \/>\n        options   <\/p>\n<h3 id=\"tcp\">[ TCP ]<\/h3>\n<p>sport= 7859<br \/>\n        dport= https<br \/>\n        seq= 397598926<br \/>\n        ack= 405609299<br \/>\n        dataofs   = 5<br \/>\n        reserved  = 0<br \/>\n        flags= PA<br \/>\n        window    = 32768<br \/>\n        chksum    = 0x9672<br \/>\n        urgptr    = 0<br \/>\n        options   = []<\/p>\n<h3 id=\"raw\">[ Raw ]<\/h3>\n<p>load= &#8220;POST \/wikid\/InitDevice HTTP\/1.1rnX-MU-Session-ID: 2705156788rnContent-Length: 57rnAccept-Language: en-US,en;q=0.9rnAccept-Encoding: gzip, deflaternConnection: closernUpgrade-Insecure-Requests: 1rnOrigin: rnUser-Agent: Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/75.0.3770.142 Safari\/537.36rnHost: 172.31.1.15rnReferer: rnCache-Control: max-age=0rnContent-Type: application\/x-www-form-urlencodedrnPayload: dGVzdA==rnrnS=1&amp;a=test&#8217;&gt; <\/p>\n<\/blockquote>\n<\/blockquote>\n<\/blockquote>\n<p>\u76ee\u5f55<\/p>\n","protected":false},"excerpt":{"rendered":"<p>scapy\u5b66\u4e60\u7b14\u8bb0\u57fa\u672c\u51fd\u6570 rdpcap()\u8be5\u65b9\u6cd5\u662f\u5728\u89e3\u6790\u6570\u636e\u5305\u7684\u65f6\u5019\u8bfb\u5165pcap\u6587\u4ef6\u6240\u9700\u8981\u8c03\u7528\u7684\u65b9\u6cd5\u3002\u8c03\u7528\u65b9\u5f0f\u8be5\u51fd\u6570\u8fd4\u56de\u7684f \u662f\u4e00\u4e2ascapy.plist<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"topic":[],"class_list":["post-3389","post","type-post","status-publish","format-standard","hentry","category-1"],"_links":{"self":[{"href":"https:\/\/www.ccwifi.cc\/blogs\/wp-json\/wp\/v2\/posts\/3389","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ccwifi.cc\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ccwifi.cc\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ccwifi.cc\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ccwifi.cc\/blogs\/wp-json\/wp\/v2\/comments?post=3389"}],"version-history":[{"count":0,"href":"https:\/\/www.ccwifi.cc\/blogs\/wp-json\/wp\/v2\/posts\/3389\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.ccwifi.cc\/blogs\/wp-json\/wp\/v2\/media?parent=3389"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ccwifi.cc\/blogs\/wp-json\/wp\/v2\/categories?post=3389"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ccwifi.cc\/blogs\/wp-json\/wp\/v2\/tags?post=3389"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.ccwifi.cc\/blogs\/wp-json\/wp\/v2\/topic?post=3389"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}