Skip to content

Latest commit

 

History

History
29 lines (26 loc) · 773 Bytes

File metadata and controls

29 lines (26 loc) · 773 Bytes

A easy way to convert hosts file to Bind .zone file.

edit the flowing code to custom attribute.

#download hosts file path.
hostsFile="hosts"
#zone file save path.
outputZoneFile="hosts.zone"
#target named zone file path
targetZoneFile="/usr/local/named/var/rpz.zone
nameServer="ns1"
# I don't know what the means of following fields. Just copied from others.
domainName="pandadns.com"
zoneSerial=datetime.datetime.strftime(datetime.datetime.now(), '%Y%m%d%H%M%S')
refresh = "3H"
retry = "15M"
expiry = "1W"
SOA = [ ''+zoneSerial+'	; serial',
        '3H		; refresh',
        '15M		; retry',
        '1W		; expiry',
        '1D)		; minimum'
       ]
)		; minimum'
       ]
  • run python3 hosts2zone.py to fetch hosts file and generate a hosts.zone file.