开发者

'module' object has no attribute 'pcapObject'

开发者 https://www.devze.com 2022-12-24 02:05 出处:网络
I have the following sample code which doesn\'t seem to want to run. import pcap pc = pcap.pcapObject()

I have the following sample code which doesn't seem to want to run.

import pcap
pc = pcap.pcapObject()
dev = sys.argv[1]
pc.open_live(dev, 1600, 0, 100)
pc.setfilter("udp port 53", 0, 0)
while 1:
    pc.dispatch(1, p.开发者_StackOverflow中文版pcap_dispatch)

I'm really not sure why. I'm using pypcap. I'm running this on both 2.5.1 and 2.6 versions of python (separate machines) using mac osx (leopard).


At least according to documentation from the project this line:

pc = pcap.pcapObject()

Should really be:

pc = pcap.pcap()


There are two pcap libraries for Python:

  • pypcap
  • pylibpcap

Both of them are imported as:

import pcap

But the following code implies that pylibpcap is actually expected, instead of pypcap.

pcap.pcapObject()


I dont have python on this Computer, but when i look at the example, it should be

pc = pcap.pcap ()

0

精彩评论

暂无评论...
验证码 换一张
取 消