Skip to content

Instantly share code, notes, and snippets.

Created January 10, 2016 03:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save anonymous/0e7e432fa664e04903c3 to your computer and use it in GitHub Desktop.
Save anonymous/0e7e432fa664e04903c3 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
#Dir.foreach('/Users/andybaxter/bind/*.com', 'r+').File.open do |line|
File.open("hq.internal.mx", 'r+').readlines.each do |line|
domain = line.split.first
ip = line.split.last
if ip.include? "10."
new_file = File.open('rev_10.rev', 'a')
new_file.puts "#{ip}.in-addr.arpa. 60 IN PTR #{domain}"
elsif ip.include? "172."
new_file = File.new("rev_172.txt", "w+")
new_file.puts "#{ip}.in-addr.arpa. 60 IN PTR #{domain}"
else ip.include? "192."
new_file = File.new("rev_192.txt", "w+")
new_file.puts "#{ip.reverse}.in-addr.arpa. 60 IN PTR #{domain}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment