Skip to content

tharple/hosts2bind-zone-file

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

convert hosts file to bind zone file

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%