From 4f21e5c8a1a12c9ccd393da708d31e1043aa0728 Mon Sep 17 00:00:00 2001 From: Martin Cech Date: Sun, 4 Feb 2018 21:22:36 -0500 Subject: [PATCH] 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)