sant0sk1 (owner)

Revisions

gist: 92714 Download_button fork
public
Public Clone URL: git://gist.github.com/92714.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'ping'
 
unless ARGV.first =~ /\d+\.\d+\.\d+\.\d+/
  puts "Bad Network address: #{ARGV.first}"
  exit 1
end
 
$stdout = File.open(ARGV.last,"w") if ARGV.size == 2
 
class_c = ARGV.first.gsub(/\d+$/,"")
 
255.times do |i|
  ip_address = class_c + i.to_s
  if Ping.pingecho(ip_address, 1)
    $stdout.puts "#{ip_address} is up"
    $stdout.flush
  end
end