add check for public suffix

This commit is contained in:
Martin Cech 2018-02-04 21:22:36 -05:00
parent 8131c18655
commit 4f21e5c8a1
No known key found for this signature in database
GPG Key ID: F3D28C9A94E68B0E
3 changed files with 26 additions and 0 deletions

6
.travis.yml Normal file
View File

@ -0,0 +1,6 @@
language: python
python:
- "3.6"
script:
- python verify.py

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
publicsuffixlist

19
verify.py Normal file
View File

@ -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)