Skip to content

Instantly share code, notes, and snippets.

@AbdallaZaki
Last active September 2, 2016 05:52
Show Gist options
  • Save AbdallaZaki/e51d23ff016c53bd9df4ae5dd5b6fcbe to your computer and use it in GitHub Desktop.
Save AbdallaZaki/e51d23ff016c53bd9df4ae5dd5b6fcbe to your computer and use it in GitHub Desktop.
require 'securerandom'
def get_ips ips_file
content=""
File.open(ips_file,"r") {|file| content = file.read }
result=""
content.scan(/(((([0-9]{1,3}\.){3}[0-9])|(([0-9a-f]{1,4}\:){3}\:))\/[0-9]{2})/) { |match| result += "#{match[0]}\n" }
File.open("#{ips_file}-#{SecureRandom.uuid}.txt","w") {|file| file.write(result)}
end
get_ips ARGV[0]
@khaled0fares
Copy link

Cool!

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