socket.error:[Errno 19]没有这样的设备错误

时间:2013-08-11 07:59:47

标签: python python-2.7

当我运行此脚本来检测凸轮表耗尽检测脚本时,会发生以下错误。

  File "camtable.py", line 22, in <module>
    sniff(iface=interface,prn=monitorPackets)
  File "/usr/lib/python2.7/site-packages/scapy/sendrecv.py", line 561, in sniff
    s = L2socket(type=ETH_P_ALL, *arg, **karg)
  File "/usr/lib/python2.7/site-packages/scapy/arch/linux.py", line 455, in __init__
    self.ins.bind((iface, type))
  File "/usr/lib64/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 19] No such device

需要一些指导。

import sys
import scapy
import datetime
from scapy.all import *
THRESH=(254/4)
START = 5

def monitorPackets(p):
    if p.haslayer(IP):
        hwSrc = p.getlayer(Ether).src
        if hwSrc not in hwList:
            hwList.append(hwSrc)
        delta = datetime.datetime.now() - start
        if((delta.seconds > START) and ((len(hwList)/delta.seconds) > THRESH)):
            print "[*]- Detected CAM Table Attack."


interface = sys.argv[0]
hwList = []
start = datetime.datetime.now()

sniff(iface=interface,prn=monitorPackets)

1 个答案:

答案 0 :(得分:1)

我想你想要sys.argv[1]。你试图传递什么价值?