Guest User

MVPS to BIND RPZ converter

a guest
Jan 18th, 2017
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. import sys
  2.  
  3. fn = sys.argv[1]
  4.  
  5. print("""
  6. ;
  7. ; BIND RPZ
  8. ;
  9.  
  10. $TTL    3600
  11. @       IN      SOA     mvps.rpz.zone. mvps.rpz.zone. (
  12.                              2         ; Serial
  13.                         604800         ; Refresh
  14.                          86400         ; Retry
  15.                        2419200         ; Expire
  16.                         604800 )       ; Negative Cache TTL
  17. ;
  18.  
  19. @       IN      NS      localhost.
  20. """)
  21.  
  22. for line in open(fn, 'r'):
  23.     p = line.find('#')
  24.     line = line[:p].strip()
  25.  
  26.     if line:
  27.         parts = line.split(' ')
  28.         host = parts[1]
  29.         if host != "localhost":
  30.             print("{:52s} CNAME .".format(host))
  31.             print("*.{:50s} CNAME .".format(host))
Advertisement
Add Comment
Please, Sign In to add comment