diff --git a/py-hole-bind9RPZ b/py-hole-bind9RPZ index 4edc7b2..ea40f24 100755 --- a/py-hole-bind9RPZ +++ b/py-hole-bind9RPZ @@ -48,20 +48,20 @@ if 'reloadzonecommand' not in config: # build our zone -zonedata = re.sub ( r'', '%010d' % int(time.time()), config['rpztemplate'] ) +outputdata = re.sub ( r'', '%010d' % int(time.time()), config['rpztemplate'] ) seenbefore = {} commentstart = ';' # for bind def addcomment ( comment ): - global zonedata - zonedata += ";%s\n" % comment + global outputdata + outputdata += ";%s\n" % comment def addhost ( host ): - global zonedata + global outputdata host = host.lower().strip() if host in seenbefore: - zonedata += "%s seenbefore in %s %s" % (commentstart,seenbefore[host],commentstart) + outputdata += "%s seenbefore in %s %s" % (commentstart,seenbefore[host],commentstart) if host in config['exclusions']: - zonedata += "%s excluded %s" % (commentstart,commentstart) - zonedata += "%s %s\n" % (host,config['defaultresponse']) + outputdata += "%s excluded %s" % (commentstart,commentstart) + outputdata += "%s %s\n" % (host,config['defaultresponse']) seenbefore[host] = source @@ -90,9 +90,9 @@ for source in config['blacklists']: # all done data = response.data # we are good to go - zonedata += ";=============================================================================\n" - zonedata += "; Source: %s :: %s\n" % (source,config['blacklists'][source]['url']) - zonedata += ";=============================================================================\n\n" + outputdata += ";=============================================================================\n" + outputdata += "; Source: %s :: %s\n" % (source,config['blacklists'][source]['url']) + outputdata += ";=============================================================================\n\n" # process data recordcount = 0 if config['blacklists'][source]['format'] == 'hosts': @@ -130,7 +130,7 @@ for source in config['blacklists']: # write the config['rpzfile'] file with open ( config['rpzfile']+'.TMP', 'wt' ) as f: - f.write ( zonedata ) + f.write ( outputdata ) os.rename ( config['rpzfile'], config['rpzfile']+'.old' ) os.rename ( config['rpzfile']+'.TMP', config['rpzfile'] ) # reload bind zone file diff --git a/py-hole-dnsmasq b/py-hole-dnsmasq index 4bfb54e..c8f95f2 100755 --- a/py-hole-dnsmasq +++ b/py-hole-dnsmasq @@ -54,20 +54,20 @@ else: # our hostsfile -hostsdata = "# created %d\n" % int(time.time()) +outputdata = "# created %d\n" % int(time.time()) seenbefore = {} commentstart = '#' # for hosts / dnsmasq def addcomment ( comment ): - global hostsdata - hostsdata += ";%s\n" % comment + global outputdata + outputdata += ";%s\n" % comment def addhost ( host ): - global hostsdata + global outputdata host = host.lower().strip() if host in seenbefore: - hostsdata += "%s seenbefore in %s %s" % (commentstart,seenbefore[host],commentstart) + outputdata += "%s seenbefore in %s %s" % (commentstart,seenbefore[host],commentstart) if host in config['exclusions']: - hostsdata += "%s excluded %s" % (commentstart,commentstart) - hostsdata += "%s %s\n" % (host,config['defaultresponse']) + outputdata += "%s excluded %s" % (commentstart,commentstart) + outputdata += "%s %s\n" % (host,config['defaultresponse']) seenbefore[host] = source @@ -96,9 +96,9 @@ for source in config['blacklists']: # all done data = response.data # we are good to go - hostsdata += "#=============================================================================\n" - hostsdata += "# Source: %s :: %s\n" % (source,config['blacklists'][source]['url']) - hostsdata += "#=============================================================================\n\n" + outputdata += "#=============================================================================\n" + outputdata += "# Source: %s :: %s\n" % (source,config['blacklists'][source]['url']) + outputdata += "#=============================================================================\n\n" # process data recordcount = 0 if config['blacklists'][source]['format'] == 'hosts': @@ -136,7 +136,7 @@ for source in config['blacklists']: # write the config['hostsfile'] file with open ( config['hostsfile']+'.TMP', 'wt' ) as f: - f.write ( hostsdata ) + f.write ( outputdata ) os.rename ( config['hostsfile'], config['hostsfile']+'.old' ) os.rename ( config['hostsfile']+'.TMP', config['hostsfile'] )