From cf9a976075f4f09066d1dbcb60fa048fe4c49831 Mon Sep 17 00:00:00 2001 From: minoplhy Date: Wed, 29 Sep 2021 22:10:01 +0700 Subject: [PATCH] Maker Fix --- maker_dnsmasq.py | 27 +++------------------------ maker_unbound.py | 23 +---------------------- 2 files changed, 4 insertions(+), 46 deletions(-) diff --git a/maker_dnsmasq.py b/maker_dnsmasq.py index 87a90ad..5b3923c 100644 --- a/maker_dnsmasq.py +++ b/maker_dnsmasq.py @@ -10,7 +10,7 @@ def linecounter(incoming): pass return i + 1 -def domainsbuilding(excluded ,incoming,Version): +def DNQbuilding(excluded ,incoming,Version): ankstanop = linecounter(incoming) with open(excluded ,'r') as f: exclude = f.read().split() @@ -21,37 +21,16 @@ def domainsbuilding(excluded ,incoming,Version): f.write('# Description : My Very Personal DNS Blocklist plus crawling from the source\n') f.write('# Source : Resources/Source.txt\n') f.write('# Rule Counter : ' + str(ankstanop) +' Rules\n') - f.write('# Format : Domains\n') + f.write('# Format : Dnsmasq\n') f.write('# Type : Blocklist\n') f.write('# Version : ' + str(Version) +'\n') f.write('# Licenses : MIT\n') f.write('# Compiled Date : ' + str(date) +'\n\n') for line in lines: if line.strip() and not line in exclude and not line.startswith('#'): - f.write('\n'.join([line + '\n'])) + f.write('\n'.join(['server=/' + line + '/\n'])) elif line.startswith((';','$','@',' IN')): f.write('\n'.join([line + '\n'])) elif not line.strip(): f.write('\n'.join([line + '\n'])) - f.close() - -def DNQallowlist(incoming, output,Version): - ankstanop = linecounter(incoming) - with open(incoming ,'r') as f: - lines = f.read().splitlines() # read lines - with open(output ,'w') as f: - f.write('# Title : Minoplhy Personal Blocklist\n') - f.write('# Description : My Very Personal DNS Blocklist plus crawling from the source\n') - f.write('# Source : Resources/Source.txt\n') - f.write('# Rule Counter : ' + str(ankstanop) +' Rules\n') - f.write('# Format : Dnsmasq\n') - f.write('# Type : Allowlist\n') - f.write('# Version : ' + str(Version) +'\n') - f.write('# Licenses : MIT\n') - f.write('# Compiled Date : ' + str(date) +'\n\n') - for line in lines: - if line.strip() and not line.startswith(';'): - f.write('\n'.join(['server=/' + line + '/\n'])) - elif line.startswith((';','$','@',' IN')): - f.write('\n'.join([line + '\n'])) f.close() \ No newline at end of file diff --git a/maker_unbound.py b/maker_unbound.py index ab53af5..c6a63cd 100644 --- a/maker_unbound.py +++ b/maker_unbound.py @@ -28,30 +28,9 @@ def UNBbuilding(excluded ,incoming,Version): f.write('# Compiled Date : ' + str(date) +'\n\n') for line in lines: if line.strip() and not line in exclude and not line.startswith('#'): - f.write('\n'.join([line + '\n'])) + f.write('\n'.join(['local-zone: "' + line + '" always_refuse\n'])) elif line.startswith((';','$','@',' IN')): f.write('\n'.join([line + '\n'])) elif not line.strip(): f.write('\n'.join([line + '\n'])) - f.close() - -def DMallowlist(incoming, output,Version): - ankstanop = linecounter(incoming) - with open(incoming ,'r') as f: - lines = f.read().splitlines() # read lines - with open(output ,'w') as f: - f.write('# Title : Minoplhy Personal Blocklist\n') - f.write('# Description : My Very Personal DNS Blocklist plus crawling from the source\n') - f.write('# Source : Resources/Source.txt\n') - f.write('# Rule Counter : ' + str(ankstanop) +' Rules\n') - f.write('# Format : Unbound\n') - f.write('# Type : Allowlist\n') - f.write('# Version : ' + str(Version) +'\n') - f.write('# Licenses : MIT\n') - f.write('# Compiled Date : ' + str(date) +'\n\n') - for line in lines: - if line.strip() and not line.startswith(';'): - f.write('\n'.join(['local-zone: "' + line + '" always_refuse\n'])) - elif line.startswith((';','$','@',' IN')): - f.write('\n'.join([line + '\n'])) f.close() \ No newline at end of file