pyshark无法在Windows 7上捕获数据包(python) [英] pyshark can not capture the packet on windows 7 (python)
本文介绍了pyshark无法在Windows 7上捕获数据包(python)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用pyshark捕获数据包。
,但我无法在Windows 7上捕获数据包。
I want to capture the packet using pyshark. but I could not capture the packet on windows 7.
import pyshark
def NetCap():
print 'capturing...'
livecapture = pyshark.LiveCapture(interface="eth0", output_file='./test.pcapng')
livecapture.sniff(packet_count=10)
print 'end of capture.'
print livecapture
if __name__ == "__main__":
NetCap()
this是结果
this is result
capturing...
end of capture.
<LiveCapture (0 packets)>
Livecapture为0个数据包。
我不知道怎么回事。
请帮助我。
Livecapture is 0 packets. I don't know what is the matter. please help me.
推荐答案
打开cmd并输入:
tshark -D
这会给您一个列表像:
C:\WINDOWS\system32>tshark -D
1. \Device\NPF_{BF2D596D-AEB8-4AF3-88A2-FF31441BB262} (VMware Network Adapter VMnet8)
2. \Device\NPF_{7AB58B39-455D-4A40-AA3A-678491E70B27} (Local Area Connection* 4)
3. \Device\NPF_{7FEC3EE6-0676-4E81-8B13-FBD5716BF2BF} (Wi-Fi)
4. \Device\NPF_{10D9C98D-BF03-4CE5-A58C-5A726BC6066A} (Ethernet)
5. \Device\NPF_{45AD9B2A-DB01-4EDE-A922-C2DD6D868568} (VMware Network Adapter VMnet1)
6. \\.\USBPcap1 (USBPcap1)
现在您可以按照以下要求使用任何接口:
now you can use any of the interface as required by this:
import pyshark
livecapture = pyshark.LiveCapture(interface='\\Device\\NPF_{7FEC3EE6-0676-4E81-8B13-FBD5716BF2BF}, output_file='./test.pcapng')
这篇关于pyshark无法在Windows 7上捕获数据包(python)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文