From 9a52cd6432161ee8300b4626d023777a6a2cff9c Mon Sep 17 00:00:00 2001 From: minoplhy Date: Thu, 14 Oct 2021 17:21:35 +0700 Subject: [PATCH 1/7] Merge Modules --- maker.py | 235 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 235 insertions(+) create mode 100644 maker.py diff --git a/maker.py b/maker.py new file mode 100644 index 0000000..7dac20f --- /dev/null +++ b/maker.py @@ -0,0 +1,235 @@ +import datetime +import pytz + +def linecounter(incoming): + with open(incoming) as f: + for i, l in enumerate(f): + pass + return i + 1 + +def ABPBlocklist(excluded,incoming,output,Version): + ankstanop = linecounter(incoming) + with open(excluded ,'r') as f: + exclude = f.read().split() + 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 : 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'])) + 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() + +def DNSMASQBlocklist(excluded,incoming,output,Version): + ankstanop = linecounter(incoming) + with open(excluded ,'r') as f: + exclude = f.read().split() + 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 : 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(['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 DOMAINBlocklist(excluded ,incoming,Version): + ankstanop = linecounter(incoming) + with open(excluded ,'r') as f: + exclude = f.read().split() + with open(incoming ,'r') as f: + lines = f.read().splitlines() # read lines + with open(incoming ,'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 : 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'])) + elif line.startswith((';','$','@',' IN')): + f.write('\n'.join([line + '\n'])) + elif not line.strip(): + f.write('\n'.join([line + '\n'])) + f.close() + +def DOMAINAllowlist(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() + +def HOSTBlocklist(excluded ,incoming ,output,Version): + ankstanop = linecounter(incoming) + with open(excluded ,'r') as f: + exclude = f.read().split() + 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 : Hosts\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('127.0.0.1 localhost\n') + f.write('127.0.0.1 localhost.localdomain\n') + f.write('127.0.0.1 local\n') + f.write('255.255.255.255 broadcasthost\n') + f.write('::1 localhost\n') + f.write('::1 ip6-localhost\n') + f.write('::1 ip6-loopback\n') + f.write('fe80::1%lo0 localhost\n') + f.write('ff00::0 ip6-localnet\n') + f.write('ff00::0 ip6-mcastprefix\n') + f.write('ff02::1 ip6-allnodes\n') + f.write('ff02::2 ip6-allrouters\n') + f.write('ff02::3 ip6-allhosts\n') + f.write('0.0.0.0 0.0.0.0\n\n') + + for line in lines: + if line.strip() and not line in exclude and not line.startswith('#'): + f.write('\n'.join(['0.0.0.0 ' + 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 RPZBlocklist(excluded,incoming,output,Version): + ankstanop = linecounter(incoming) + with open(excluded ,'r') as f: + exclude = f.read().split() + 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 : 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') + f.write('@ IN SOA localhost. root.localhost. (1 6h 1h 1w 2h)\n') + f.write(' NS localhost.\n;\n') + for line in lines: + if line.strip() and not line in exclude and not line.startswith(';'): + 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 RPZAllowlist(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() + +def UNBOUNDBlocklist(excluded,incoming,output,Version): + ankstanop = linecounter(incoming) + with open(excluded ,'r') as f: + exclude = f.read().split() + 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 : 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(['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() \ No newline at end of file From b22a6329975a96cf5840c6e4582569707700463a Mon Sep 17 00:00:00 2001 From: minoplhy Date: Thu, 14 Oct 2021 17:26:43 +0700 Subject: [PATCH 2/7] Delete --- maker_abp.py | 55 --------------------------------------------- maker_dnsmasq.py | 36 ------------------------------ maker_domains.py | 57 ----------------------------------------------- maker_hosts.py | 51 ------------------------------------------ maker_rpz.py | 58 ------------------------------------------------ maker_unbound.py | 36 ------------------------------ 6 files changed, 293 deletions(-) delete mode 100644 maker_abp.py delete mode 100644 maker_dnsmasq.py delete mode 100644 maker_domains.py delete mode 100644 maker_hosts.py delete mode 100644 maker_rpz.py delete mode 100644 maker_unbound.py diff --git a/maker_abp.py b/maker_abp.py deleted file mode 100644 index f622991..0000000 --- a/maker_abp.py +++ /dev/null @@ -1,55 +0,0 @@ -import datetime -import pytz - -UTC = pytz.utc -date = datetime.datetime.now(UTC) - -def linecounter(incoming): - with open(incoming) as f: - for i, l in enumerate(f): - pass - return i + 1 - -def ABPbuilding(excluded,incoming,output,Version): - ankstanop = linecounter(incoming) - with open(excluded ,'r') as f: - exclude = f.read().split() - 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 : 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'])) - 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_dnsmasq.py b/maker_dnsmasq.py deleted file mode 100644 index b39838e..0000000 --- a/maker_dnsmasq.py +++ /dev/null @@ -1,36 +0,0 @@ -import datetime -import pytz - -UTC = pytz.utc -date = datetime.datetime.now(UTC) - -def linecounter(incoming): - with open(incoming) as f: - for i, l in enumerate(f): - pass - return i + 1 - -def DNQbuilding(excluded,incoming,output,Version): - ankstanop = linecounter(incoming) - with open(excluded ,'r') as f: - exclude = f.read().split() - 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 : 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(['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() \ No newline at end of file diff --git a/maker_domains.py b/maker_domains.py deleted file mode 100644 index db415e3..0000000 --- a/maker_domains.py +++ /dev/null @@ -1,57 +0,0 @@ -import datetime -import pytz - -UTC = pytz.utc -date = datetime.datetime.now(UTC) - -def linecounter(incoming): - with open(incoming) as f: - for i, l in enumerate(f): - pass - return i + 1 - -def domainsbuilding(excluded ,incoming,Version): - ankstanop = linecounter(incoming) - with open(excluded ,'r') as f: - exclude = f.read().split() - with open(incoming ,'r') as f: - lines = f.read().splitlines() # read lines - with open(incoming ,'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 : 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'])) - 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 : 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_hosts.py b/maker_hosts.py deleted file mode 100644 index a40cbcc..0000000 --- a/maker_hosts.py +++ /dev/null @@ -1,51 +0,0 @@ -import datetime -import pytz - -UTC = pytz.utc -date = datetime.datetime.now(UTC) - -def linecounter(incoming): - with open(incoming) as f: - for i, l in enumerate(f): - pass - return i + 1 - -def hostsbuilding(excluded ,incoming ,output,Version): - ankstanop = linecounter(incoming) - with open(excluded ,'r') as f: - exclude = f.read().split() - 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 : Hosts\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('127.0.0.1 localhost\n') - f.write('127.0.0.1 localhost.localdomain\n') - f.write('127.0.0.1 local\n') - f.write('255.255.255.255 broadcasthost\n') - f.write('::1 localhost\n') - f.write('::1 ip6-localhost\n') - f.write('::1 ip6-loopback\n') - f.write('fe80::1%lo0 localhost\n') - f.write('ff00::0 ip6-localnet\n') - f.write('ff00::0 ip6-mcastprefix\n') - f.write('ff02::1 ip6-allnodes\n') - f.write('ff02::2 ip6-allrouters\n') - f.write('ff02::3 ip6-allhosts\n') - f.write('0.0.0.0 0.0.0.0\n\n') - - for line in lines: - if line.strip() and not line in exclude and not line.startswith('#'): - f.write('\n'.join(['0.0.0.0 ' + line + '\n'])) - elif line.startswith((';','$','@',' IN')): - f.write('\n'.join([line + '\n'])) - elif not line.strip(): - f.write('\n'.join([line + '\n'])) - f.close() \ No newline at end of file diff --git a/maker_rpz.py b/maker_rpz.py deleted file mode 100644 index a31a42c..0000000 --- a/maker_rpz.py +++ /dev/null @@ -1,58 +0,0 @@ -import datetime -import pytz - -UTC = pytz.utc -date = datetime.datetime.now(UTC) - -def linecounter(incoming): - with open(incoming) as f: - for i, l in enumerate(f): - pass - return i + 1 - -def RPZbuilding(excluded,incoming,output,Version): - ankstanop = linecounter(incoming) - with open(excluded ,'r') as f: - exclude = f.read().split() - 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 : 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') - f.write('@ IN SOA localhost. root.localhost. (1 6h 1h 1w 2h)\n') - f.write(' NS localhost.\n;\n') - for line in lines: - if line.strip() and not line in exclude and not line.startswith(';'): - 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 RPZallowlist(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 diff --git a/maker_unbound.py b/maker_unbound.py deleted file mode 100644 index 3592053..0000000 --- a/maker_unbound.py +++ /dev/null @@ -1,36 +0,0 @@ -import datetime -import pytz - -UTC = pytz.utc -date = datetime.datetime.now(UTC) - -def linecounter(incoming): - with open(incoming) as f: - for i, l in enumerate(f): - pass - return i + 1 - -def UNBbuilding(excluded,incoming,output,Version): - ankstanop = linecounter(incoming) - with open(excluded ,'r') as f: - exclude = f.read().split() - 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 : 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(['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() \ No newline at end of file From 2c6e8f8b8b7e1e4052e9d17a7bd1d25d57040b09 Mon Sep 17 00:00:00 2001 From: minoplhy Date: Thu, 14 Oct 2021 17:33:54 +0700 Subject: [PATCH 3/7] action.example.py is shit --- action.example.py | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/action.example.py b/action.example.py index 271d314..5cc5b75 100644 --- a/action.example.py +++ b/action.example.py @@ -1,26 +1 @@ -import sys -sys.path.append('/filters-maker') - -import crawler -import maker_rpz -import maker_domains - -incoming = "/repros/Private-build/ucate/domains.txt" -excluded = "/repros/Resources/excluded.txt" -rpz_locat = "/repros/Private-build/ucate/rpz.txt" - -crawler.download_filters("https://dbl.oisd.nl/" ,incoming) -crawler.download_filters("https://hosts.netlify.app/Pro/rpz.txt" ,incoming) -crawler.download_filters("https://filters.kylz.nl/RPZ/adguard/dns.txt" ,incoming) -crawler.download_filters("https://filters.kylz.nl/RPZ/adguard/cname-tracker.txt" ,incoming) -crawler.download_filters("https://filters.kylz.nl/RPZ/adguard/cname-original.txt" ,incoming) -crawler.download_filters("https://filters.kylz.nl/RPZ/stevenblack/f-s.txt" ,incoming) -crawler.download_filters("https://filters.kylz.nl/RPZ/someonewhocares/rpz.txt" ,incoming) -crawler.download_filters("https://urlhaus.abuse.ch/downloads/rpz/" ,incoming) -crawler.download_filters("https://github.com/easylist/easylist/raw/master/easylist/easylist_adservers.txt" ,incoming) -crawler.filtering(incoming) -crawler.filteringcon(incoming) -crawler.killingdup(incoming) -crawler.excluded(excluded, incoming) -maker_rpz.RPZbuilding(excluded, incoming, rpz_locat) -maker_domains.domainsbuilding(excluded, incoming) \ No newline at end of file +# GOTO : https://github.com/minoplhy/filters/blob/main/action.py \ No newline at end of file From f63fd6795ac17ac044d8ea2fb057650848a768cf Mon Sep 17 00:00:00 2001 From: minoplhy Date: Thu, 14 Oct 2021 17:36:35 +0700 Subject: [PATCH 4/7] Defind date --- maker.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/maker.py b/maker.py index 7dac20f..b4d082c 100644 --- a/maker.py +++ b/maker.py @@ -1,6 +1,10 @@ import datetime import pytz + +UTC = pytz.utc +date = datetime.datetime.now(UTC) + def linecounter(incoming): with open(incoming) as f: for i, l in enumerate(f): From 2c9e8a07bfcce86fa443b7051677f469f442c91e Mon Sep 17 00:00:00 2001 From: minoplhy Date: Fri, 15 Oct 2021 11:05:00 +0700 Subject: [PATCH 5/7] Build Date as Module --- maker.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/maker.py b/maker.py index b4d082c..17e11ad 100644 --- a/maker.py +++ b/maker.py @@ -1,9 +1,10 @@ import datetime import pytz - -UTC = pytz.utc -date = datetime.datetime.now(UTC) +def BuildDate(): + UTC = pytz.utc + date = datetime.datetime.now(UTC) + return date def linecounter(incoming): with open(incoming) as f: @@ -13,6 +14,7 @@ def linecounter(incoming): def ABPBlocklist(excluded,incoming,output,Version): ankstanop = linecounter(incoming) + date = BuildDate() with open(excluded ,'r') as f: exclude = f.read().split() with open(incoming ,'r') as f: @@ -36,6 +38,7 @@ def ABPBlocklist(excluded,incoming,output,Version): def ABPallowlist(incoming,output,Version): ankstanop = linecounter(incoming) + date = BuildDate() with open(incoming ,'r') as f: lines = f.read().splitlines() # read lines with open(output ,'w') as f: @@ -57,6 +60,7 @@ def ABPallowlist(incoming,output,Version): def DNSMASQBlocklist(excluded,incoming,output,Version): ankstanop = linecounter(incoming) + date = BuildDate() with open(excluded ,'r') as f: exclude = f.read().split() with open(incoming ,'r') as f: @@ -82,6 +86,7 @@ def DNSMASQBlocklist(excluded,incoming,output,Version): def DOMAINBlocklist(excluded ,incoming,Version): ankstanop = linecounter(incoming) + date = BuildDate() with open(excluded ,'r') as f: exclude = f.read().split() with open(incoming ,'r') as f: @@ -107,6 +112,7 @@ def DOMAINBlocklist(excluded ,incoming,Version): def DOMAINAllowlist(incoming, output,Version): ankstanop = linecounter(incoming) + date = BuildDate() with open(incoming ,'r') as f: lines = f.read().splitlines() # read lines with open(output ,'w') as f: @@ -128,6 +134,7 @@ def DOMAINAllowlist(incoming, output,Version): def HOSTBlocklist(excluded ,incoming ,output,Version): ankstanop = linecounter(incoming) + date = BuildDate() with open(excluded ,'r') as f: exclude = f.read().split() with open(incoming ,'r') as f: @@ -168,6 +175,7 @@ def HOSTBlocklist(excluded ,incoming ,output,Version): def RPZBlocklist(excluded,incoming,output,Version): ankstanop = linecounter(incoming) + date = BuildDate() with open(excluded ,'r') as f: exclude = f.read().split() with open(incoming ,'r') as f: @@ -194,6 +202,7 @@ def RPZBlocklist(excluded,incoming,output,Version): def RPZAllowlist(incoming,output,Version): ankstanop = linecounter(incoming) + date = BuildDate() with open(incoming ,'r') as f: lines = f.read().splitlines() # read lines with open(output ,'w') as f: @@ -215,6 +224,7 @@ def RPZAllowlist(incoming,output,Version): def UNBOUNDBlocklist(excluded,incoming,output,Version): ankstanop = linecounter(incoming) + date = BuildDate() with open(excluded ,'r') as f: exclude = f.read().split() with open(incoming ,'r') as f: From 6a041f2ccf35f3cdedc4a5e4f009d05307b3a0e3 Mon Sep 17 00:00:00 2001 From: minoplhy Date: Fri, 15 Oct 2021 11:28:50 +0700 Subject: [PATCH 6/7] Update PYTZ version to 2021.3 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 30883db..d552eef 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ requests==2.26.0 -pytz==2021.1 +pytz==2021.3 From 4aacb61ee067d8fff071f5bb6ecebd52e2ddc125 Mon Sep 17 00:00:00 2001 From: minoplhy Date: Mon, 18 Oct 2021 20:47:14 +0700 Subject: [PATCH 7/7] Big A Letter --- maker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maker.py b/maker.py index 17e11ad..de2c8b3 100644 --- a/maker.py +++ b/maker.py @@ -36,7 +36,7 @@ def ABPBlocklist(excluded,incoming,output,Version): f.write('\n'.join([line + '\n'])) f.close() -def ABPallowlist(incoming,output,Version): +def ABPAllowlist(incoming,output,Version): ankstanop = linecounter(incoming) date = BuildDate() with open(incoming ,'r') as f: