-
-
Save anonymous/0e7e432fa664e04903c3 to your computer and use it in GitHub Desktop.
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
#!/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