Thursday, May 22, 2008

Ping echo check in Ruby, a dummy port scanner

Ping library in Ruby is fun to use,
it is easy to make it as a small port scanner

require "ping"

if ARGV.length != 3
puts "Usage: pingb machine_domain min max"
exit 0
end

for port in (ARGV[1].to_i..ARGV[2].to_i) do
if Ping.pingecho(ARGV[0],1,port) then
puts "Port #{port} open"
end
end

$ruby pingecho.rb slashdots.org 80 100
Port 80 open

No comments: