diff --git a/maker_abp.py b/maker_abp.py index e9f9fe9..f622991 100644 --- a/maker_abp.py +++ b/maker_abp.py @@ -10,7 +10,7 @@ def linecounter(incoming): pass return i + 1 -def ABPbuilding(excluded,incoming,output): +def ABPbuilding(excluded,incoming,output,Version): ankstanop = linecounter(incoming) with open(excluded ,'r') as f: exclude = f.read().split() @@ -22,6 +22,8 @@ def ABPbuilding(excluded,incoming,output): f.write('! Source : Resources/Source.txt\n') f.write('! Rule Counter : ' + str(ankstanop) +' Rules\n') f.write('! Format : AdblockPlus\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: @@ -29,4 +31,25 @@ def ABPbuilding(excluded,incoming,output): f.write('\n'.join(['||' + line + '^ \n'])) elif line.startswith((';','$','@',' IN')): f.write('\n'.join([line + '\n'])) + f.close() + +def ABPallowlist(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 : AdblockPlus\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(['@@||' + line + '^ \n'])) + elif line.startswith((';','$','@',' IN')): + f.write('\n'.join([line + '\n'])) f.close() \ No newline at end of file diff --git a/maker_domains.py b/maker_domains.py index c4c7a7c..724e348 100644 --- a/maker_domains.py +++ b/maker_domains.py @@ -10,7 +10,7 @@ def linecounter(incoming): pass return i + 1 -def domainsbuilding(excluded ,incoming): +def domainsbuilding(excluded ,incoming,Version): ankstanop = linecounter(incoming) with open(excluded ,'r') as f: exclude = f.read().split() @@ -22,6 +22,8 @@ def domainsbuilding(excluded ,incoming): f.write('# Source : Resources/Source.txt\n') f.write('# Rule Counter : ' + str(ankstanop) +' Rules\n') f.write('# Format : Domains\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: @@ -31,4 +33,25 @@ def domainsbuilding(excluded ,incoming): f.write('\n'.join([line + '\n'])) elif not line.strip(): f.write('\n'.join([line + '\n'])) + f.close() + +def ABPallowlist(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 : Domains\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([line + '\n'])) + elif line.startswith((';','$','@',' IN')): + f.write('\n'.join([line + '\n'])) f.close() \ No newline at end of file diff --git a/maker_rpz.py b/maker_rpz.py index 0d5cf37..da83eaa 100644 --- a/maker_rpz.py +++ b/maker_rpz.py @@ -10,7 +10,7 @@ def linecounter(incoming): pass return i + 1 -def RPZbuilding(excluded,incoming,output): +def RPZbuilding(excluded,incoming,output,Version): ankstanop = linecounter(incoming) with open(excluded ,'r') as f: exclude = f.read().split() @@ -22,6 +22,8 @@ def RPZbuilding(excluded,incoming,output): f.write('; Source : Resources/Source.txt\n') f.write('; Rule Counter : ' + str(ankstanop) +' Rules\n') f.write('; Format : RPZ\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') f.write('$TTL 30\n') @@ -32,4 +34,25 @@ def RPZbuilding(excluded,incoming,output): f.write('\n'.join([line + ' CNAME .\n'])) and f.write('\n'.join(['*.' + line + ' CNAME .\n'])) elif line.startswith((';','$','@',' IN')): f.write('\n'.join([line + '\n'])) + f.close() + +def ABPallowlist(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 : Domains\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([line + 'CNAME rpz-passthru.\n'])) + elif line.startswith((';','$','@',' IN')): + f.write('\n'.join([line + '\n'])) f.close() \ No newline at end of file