Created
August 30, 2016 17:41
-
-
Save doyle/eb13b16fc355dc5653f24be389b6bf1f to your computer and use it in GitHub Desktop.
Searches all of the ip addresses in a range and prints out a message if a machine is found
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
(0..255).each do |i| | |
ip = "192.168.1.#{i}" | |
result = `ping -c 1 -W 5 #{ip}` | |
if result.match(/1 packets received/) | |
puts "something on #{ip}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment