Forked from anonymous/gist:0e7e432fa664e04903c3
Last active
January 10, 2016 04:04
-
-
Save plainprogrammer/0519246455dcd0875814 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 | |
rev_10_file = File.open('rev_10.rev', 'a') | |
rev_172_file = File.new('rev_172.txt', 'w+') | |
rev_192_file = File.new("rev_192.txt", "w+") | |
Dir['/Users/andybaxter/bind/*.com'].each do |filename| | |
File.open(filename, 'r+').readlines.each do |line| | |
domain = line.split.first | |
ip = line.split.last | |
reversed_ip = ip.split('.').reverse.join('.') | |
if ip.include? "10." | |
rev_10_file.puts "#{reversed_ip}.in-addr.arpa. 60 IN PTR #{domain}" | |
elsif ip.include? "172." | |
rev_172_file.puts "#{reversed_ip}.in-addr.arpa. 60 IN PTR #{domain}" | |
else ip.include? "192." | |
rev_192_file.puts "#{reversed_ip}.in-addr.arpa. 60 IN PTR #{domain}" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment