Skip to content

Instantly share code, notes, and snippets.

Created June 3, 2014 23:55
Show Gist options
  • Save anonymous/d269e30f3e45aae37780 to your computer and use it in GitHub Desktop.
Save anonymous/d269e30f3e45aae37780 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'socket'
require 'thread'
threads = Array.new
ports = [*(1..1024)]
port.each do port
threads << Thread.new(port) do |p|
begin
t = TCPSocket.new("myserver.net", p).close
puts "PORT #{p} OPEN"
rescue
puts "PORT #{p} CLOSED"
end
end
end
threads.each(&:join)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment