Skip to content

Commit

Permalink
scripts for tld filters
Browse files Browse the repository at this point in the history
crossing fingers
  • Loading branch information
NotaInutilis committed Oct 31, 2023
1 parent cb4ee25 commit 556dcff
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 18 deletions.
1 change: 1 addition & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- master
paths:
- 'sources/**.txt'
- 'filters/**.txt'
workflow_dispatch:

jobs:
Expand Down
2 changes: 2 additions & 0 deletions filters/TLDs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
gop
republican
2 changes: 0 additions & 2 deletions filters/adblock.txt

This file was deleted.

2 changes: 0 additions & 2 deletions filters/dnsmasq.txt

This file was deleted.

2 changes: 0 additions & 2 deletions filters/ublacklist.txt

This file was deleted.

13 changes: 10 additions & 3 deletions scripts/domains_to_adblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@
# Usage:
# python domains_to_adblock.py > adblock.txt

text_file = open("domains.txt", "r")
lines = text_file.readlines()
text_file.close()
with open("domains.txt", "r") as domains:
linesdomains = domains.readlines()

# Additional filters
## TLDs
with open("filters/TLDs.txt", "r") as tlds:
linestlds = tlds.readlines()

# Complete list generation
lines = linesdomains + linestlds

for line in lines:
print('||' + line.strip() + '^')
14 changes: 11 additions & 3 deletions scripts/domains_to_dnsmasq.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
# This script converts domains.txt into dnsmasq's blocking syntax.
# Usage:
# python domains_to_dnsmasq.py > dnsmasq.txt

text_file = open("domains.txt", "r")
lines = text_file.readlines()
text_file.close()
with open("domains.txt", "r") as domains:
linesdomains = domains.readlines()

# Additional filters
## TLDs
with open("filters/TLDs.txt", "r") as tlds:
linestlds = tlds.readlines()

# Complete list generation
lines = linesdomains + linestlds

for line in lines:
print('address=/' + line.strip() + '/')
13 changes: 10 additions & 3 deletions scripts/domains_to_ublacklist.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@
# Usage:
# python domains_to_ublacklist.py > ublacklist.txt

text_file = open("domains.txt", "r")
lines = text_file.readlines()
text_file.close()
with open("domains.txt", "r") as domains:
linesdomains = domains.readlines()

# Additional filters
## TLDs
with open("filters/TLDs.txt", "r") as tlds:
linestlds = tlds.readlines()

# Complete list generation
lines = linesdomains + linestlds

for line in lines:
print('*://*.' + line.strip() + '/*')
5 changes: 2 additions & 3 deletions scripts/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,14 @@ python scripts/domains_to_hosts.py > hosts.txt
cp hosts.txt etc_hosts.txt # Previous filename for PiHole installations still subscribed to the old url.
python scripts/domains_to_hosts_ipv6.py > hosts.txt.ipv6
python scripts/domains_to_dnsmasq.py > dnsmasq.txt
cat ./filters/dnsmasq.txt >> dnsmasq.txt

## For browser extensions.
python scripts/domains_to_netsane.py > netsane.txt
python scripts/domains_to_adblock.py > adblock_temp.txt
cp ./headers/adblock.txt adblock.txt
cat adblock_temp.txt ./filters/adblock.txt >> adblock.txt
cat adblock_temp.txt >> adblock.txt
rm adblock_temp.txt
python scripts/domains_to_ublacklist.py > ublacklist_temp.txt
cp ./headers/adblock.txt ublacklist.txt # Currently using the same adblock header until uBlacklist implements its own header. https://github.com/iorate/ublacklist/issues/351
cat ublacklist_temp.txt ./filters/ublacklist.txt >> ublacklist.txt
cat ublacklist_temp.txt >> ublacklist.txt
rm ublacklist_temp.txt
1 change: 1 addition & 0 deletions sources/Police and army/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Anything related to Blue Live Matters, the Thin Blue Line, etc.

0 comments on commit 556dcff

Please sign in to comment.