From 4f21e5c8a1a12c9ccd393da708d31e1043aa0728 Mon Sep 17 00:00:00 2001 From: Martin Cech Date: Sun, 4 Feb 2018 21:22:36 -0500 Subject: [PATCH 1/5] add check for public suffix --- .travis.yml | 6 ++++++ requirements.txt | 1 + verify.py | 19 +++++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 .travis.yml create mode 100644 requirements.txt create mode 100644 verify.py diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..306b569 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,6 @@ +language: python +python: + - "3.6" +script: + - python verify.py + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..3ad8980 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +publicsuffixlist diff --git a/verify.py b/verify.py new file mode 100644 index 0000000..48be00f --- /dev/null +++ b/verify.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python + +"""Verify the integrity of the domain blacklist +""" + +import sys + +from publicsuffixlist import PublicSuffixList + +def main(arguments): + psl = PublicSuffixList() + with open("disposable_email_blacklist", "r") as deb: + for line in deb: + if psl.publicsuffix(line) != line: + print(f'The following line is a public suffix: {line} - please remove it from the blacklist file. See https://publicsuffix.org for details.') + + +if __name__ == "__main__": + main(sys.argv) From fbc6e99ba27794313a9fb8c4a0bb09060abffece Mon Sep 17 00:00:00 2001 From: Martin Cech Date: Sun, 4 Feb 2018 21:26:23 -0500 Subject: [PATCH 2/5] fix filename --- verify.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/verify.py b/verify.py index 48be00f..7dec171 100644 --- a/verify.py +++ b/verify.py @@ -9,7 +9,7 @@ from publicsuffixlist import PublicSuffixList def main(arguments): psl = PublicSuffixList() - with open("disposable_email_blacklist", "r") as deb: + with open("disposable_email_blacklist.conf", "r") as deb: for line in deb: if psl.publicsuffix(line) != line: print(f'The following line is a public suffix: {line} - please remove it from the blacklist file. See https://publicsuffix.org for details.') From 683824dc2f92cf7d9b428dc1eaff16d64fc86503 Mon Sep 17 00:00:00 2001 From: Martin Cech Date: Sun, 4 Feb 2018 21:28:28 -0500 Subject: [PATCH 3/5] fix the inverted logic --- verify.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/verify.py b/verify.py index 7dec171..ef896cb 100644 --- a/verify.py +++ b/verify.py @@ -11,7 +11,7 @@ def main(arguments): psl = PublicSuffixList() with open("disposable_email_blacklist.conf", "r") as deb: for line in deb: - if psl.publicsuffix(line) != line: + if psl.publicsuffix(line) == line: print(f'The following line is a public suffix: {line} - please remove it from the blacklist file. See https://publicsuffix.org for details.') From 63ae4cbc3bde2037ff17840dcca80860bdd0a689 Mon Sep 17 00:00:00 2001 From: Martin Cech Date: Sun, 4 Feb 2018 22:09:52 -0500 Subject: [PATCH 4/5] strip line endings for comparison --- verify.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/verify.py b/verify.py index ef896cb..fd6d40c 100644 --- a/verify.py +++ b/verify.py @@ -3,16 +3,25 @@ """Verify the integrity of the domain blacklist """ +import io import sys from publicsuffixlist import PublicSuffixList def main(arguments): psl = PublicSuffixList() - with open("disposable_email_blacklist.conf", "r") as deb: - for line in deb: - if psl.publicsuffix(line) == line: - print(f'The following line is a public suffix: {line} - please remove it from the blacklist file. See https://publicsuffix.org for details.') + suffix_detected = False + + with io.open('disposable_email_blacklist.conf', 'r') as deb: + for i, line in enumerate(deb): + current_line = line.strip() + public_suffix = psl.publicsuffix(current_line) + if public_suffix == current_line: + print(f'The line number {i+1} contains just a public suffix: {current_line}') + suffix_detected = True + if suffix_detected: + print ('At least one valid public suffix found in the blacklist, please remove it. See https://publicsuffix.org for details on why this shouldn\'t be blacklisted.') + sys.exit(1) if __name__ == "__main__": From 32e84e83fc04965009d7e7043704718dcb20cf78 Mon Sep 17 00:00:00 2001 From: Martin Cech Date: Sun, 4 Feb 2018 22:13:21 -0500 Subject: [PATCH 5/5] remove public suffix domains that are part of the list at https://publicsuffix.org --- disposable_email_blacklist.conf | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/disposable_email_blacklist.conf b/disposable_email_blacklist.conf index f17634a..fe136ce 100644 --- a/disposable_email_blacklist.conf +++ b/disposable_email_blacklist.conf @@ -487,7 +487,6 @@ codeandscotch.com codivide.com coieo.com coldemail.info -com.ar compareshippingrates.org completegolfswing.com comwest.de @@ -536,7 +535,6 @@ darkharvestfilms.com daryxfox.net dash-pads.com dataarca.com -datafilehost datarca.com datazo.ca davidkoh.net @@ -672,7 +670,6 @@ durandinterstellar.com duskmail.com dwse.edu.pl dyceroprojects.com -dynu.net dz17.net e-mail.com e-mail.org @@ -686,8 +683,6 @@ ebeschlussbuch.de ecallheandi.com edgex.ru edinburgh-airporthotels.com -edu.my -edu.sg edv.to ee1.pl ee2.pl @@ -1147,7 +1142,6 @@ ibnuh.bz icantbelieveineedtoexplainthisshit.com icx.in icx.ro -id.au ieatspam.eu ieatspam.info ieh-mail.de @@ -1308,7 +1302,6 @@ kopaka.net kosmetik-obatkuat.com kostenlosemailadresse.de koszmail.pl -kozow.com krd.ag krsw.tk krypton.tk @@ -1616,7 +1609,6 @@ moza.pl mozej.com mr24.co msgos.com -msk.ru mspeciosa.com msrc.ml mswork.ru @@ -1713,7 +1705,6 @@ nodezine.com nogmailspam.info noicd.com nokiamail.com -nom.za nomail.pw nomail.xl.cx nomail2me.com @@ -2151,7 +2142,6 @@ spamthisplease.com spamtrail.com spamtrap.ro spamtroll.net -spb.ru speed.1s.fr speedgaus.net spikio.com @@ -2511,7 +2501,6 @@ watchfull.net watchironman3onlinefreefullmovie.com wbml.net web-mail.pp.ua -web.id webemail.me webm4il.info webmail.igg.biz @@ -2654,7 +2643,6 @@ yyolf.net z0d.eu z1p.biz z86.ru -za.com zain.site zainmax.net zasod.com