From f9226c4596cafbf01aaea579f167c2ae8c089c30 Mon Sep 17 00:00:00 2001 From: ShellCode33 Date: Sat, 1 Feb 2020 18:44:06 +0100 Subject: [PATCH 1/2] Python module compatible architecture --- reports/.keep => gdpr_analyzer/__init__.py | 0 gdpr_analyzer.py => gdpr_analyzer/__main__.py | 8 ++++---- gdpr_analyzer/modules/__init__.py | 0 gdpr_analyzer/modules/cookies/__init__.py | 0 .../modules}/cookies/config.ini | 0 .../modules}/cookies/cookies.py | 0 .../modules}/crypto/CipherSuite.py | 0 gdpr_analyzer/modules/crypto/__init__.py | 0 .../modules}/crypto/cipher_suite_tls_v10.json | 0 .../modules}/crypto/cipher_suite_tls_v11.json | 0 .../modules}/crypto/cipher_suite_tls_v12.json | 0 .../modules}/crypto/cipher_suite_tls_v13.json | 0 .../modules}/crypto/config.ini | 0 {modules => gdpr_analyzer/modules}/crypto/const.py | 0 {modules => gdpr_analyzer/modules}/crypto/crypto.py | 2 +- .../modules}/crypto/export1.json | 0 gdpr_analyzer/modules/report/__init__.py | 0 .../modules}/report/generate_report.py | 0 .../modules}/report/images/logo.png | Bin .../modules}/report/images/logo.svg | 0 .../modules}/report/templates/Montserrat-Black.ttf | Bin .../report/templates/Montserrat-ExtraLight.ttf | Bin .../modules}/report/templates/Montserrat-Medium.ttf | Bin .../report/templates/Montserrat-Regular.ttf | Bin .../report/templates/bootstrap-grid.min.css | 0 .../modules}/report/templates/style.css | 0 .../modules}/report/templates/template.html | 0 gdpr_analyzer/modules/web_beacon/__init__.py | 0 .../modules}/web_beacon/config.ini | 0 .../modules}/web_beacon/web_beacon.py | 0 30 files changed, 5 insertions(+), 5 deletions(-) rename reports/.keep => gdpr_analyzer/__init__.py (100%) rename gdpr_analyzer.py => gdpr_analyzer/__main__.py (97%) create mode 100644 gdpr_analyzer/modules/__init__.py create mode 100644 gdpr_analyzer/modules/cookies/__init__.py rename {modules => gdpr_analyzer/modules}/cookies/config.ini (100%) rename {modules => gdpr_analyzer/modules}/cookies/cookies.py (100%) rename {modules => gdpr_analyzer/modules}/crypto/CipherSuite.py (100%) create mode 100644 gdpr_analyzer/modules/crypto/__init__.py rename {modules => gdpr_analyzer/modules}/crypto/cipher_suite_tls_v10.json (100%) rename {modules => gdpr_analyzer/modules}/crypto/cipher_suite_tls_v11.json (100%) rename {modules => gdpr_analyzer/modules}/crypto/cipher_suite_tls_v12.json (100%) rename {modules => gdpr_analyzer/modules}/crypto/cipher_suite_tls_v13.json (100%) rename {modules => gdpr_analyzer/modules}/crypto/config.ini (100%) rename {modules => gdpr_analyzer/modules}/crypto/const.py (100%) rename {modules => gdpr_analyzer/modules}/crypto/crypto.py (99%) rename {modules => gdpr_analyzer/modules}/crypto/export1.json (100%) create mode 100644 gdpr_analyzer/modules/report/__init__.py rename {modules => gdpr_analyzer/modules}/report/generate_report.py (100%) rename {modules => gdpr_analyzer/modules}/report/images/logo.png (100%) rename {modules => gdpr_analyzer/modules}/report/images/logo.svg (100%) rename {modules => gdpr_analyzer/modules}/report/templates/Montserrat-Black.ttf (100%) rename {modules => gdpr_analyzer/modules}/report/templates/Montserrat-ExtraLight.ttf (100%) rename {modules => gdpr_analyzer/modules}/report/templates/Montserrat-Medium.ttf (100%) rename {modules => gdpr_analyzer/modules}/report/templates/Montserrat-Regular.ttf (100%) rename {modules => gdpr_analyzer/modules}/report/templates/bootstrap-grid.min.css (100%) rename {modules => gdpr_analyzer/modules}/report/templates/style.css (100%) rename {modules => gdpr_analyzer/modules}/report/templates/template.html (100%) create mode 100644 gdpr_analyzer/modules/web_beacon/__init__.py rename {modules => gdpr_analyzer/modules}/web_beacon/config.ini (100%) rename {modules => gdpr_analyzer/modules}/web_beacon/web_beacon.py (100%) diff --git a/reports/.keep b/gdpr_analyzer/__init__.py similarity index 100% rename from reports/.keep rename to gdpr_analyzer/__init__.py diff --git a/gdpr_analyzer.py b/gdpr_analyzer/__main__.py similarity index 97% rename from gdpr_analyzer.py rename to gdpr_analyzer/__main__.py index 108a712..3aee9e9 100644 --- a/gdpr_analyzer.py +++ b/gdpr_analyzer/__main__.py @@ -17,10 +17,10 @@ import sqlite3 import shutil -from modules.crypto.crypto import TransmissionSecurity -from modules.report.generate_report import generate_report -from modules.web_beacon.web_beacon import find_beacon, json_parser -from modules.cookies.cookies import cookie_evaluate +from gdpr_analyzer.modules.crypto.crypto import TransmissionSecurity +from gdpr_analyzer.modules.report.generate_report import generate_report +from gdpr_analyzer.modules.web_beacon.web_beacon import find_beacon, json_parser +from gdpr_analyzer.modules.cookies.cookies import cookie_evaluate class Bcolors: diff --git a/gdpr_analyzer/modules/__init__.py b/gdpr_analyzer/modules/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/gdpr_analyzer/modules/cookies/__init__.py b/gdpr_analyzer/modules/cookies/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/modules/cookies/config.ini b/gdpr_analyzer/modules/cookies/config.ini similarity index 100% rename from modules/cookies/config.ini rename to gdpr_analyzer/modules/cookies/config.ini diff --git a/modules/cookies/cookies.py b/gdpr_analyzer/modules/cookies/cookies.py similarity index 100% rename from modules/cookies/cookies.py rename to gdpr_analyzer/modules/cookies/cookies.py diff --git a/modules/crypto/CipherSuite.py b/gdpr_analyzer/modules/crypto/CipherSuite.py similarity index 100% rename from modules/crypto/CipherSuite.py rename to gdpr_analyzer/modules/crypto/CipherSuite.py diff --git a/gdpr_analyzer/modules/crypto/__init__.py b/gdpr_analyzer/modules/crypto/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/modules/crypto/cipher_suite_tls_v10.json b/gdpr_analyzer/modules/crypto/cipher_suite_tls_v10.json similarity index 100% rename from modules/crypto/cipher_suite_tls_v10.json rename to gdpr_analyzer/modules/crypto/cipher_suite_tls_v10.json diff --git a/modules/crypto/cipher_suite_tls_v11.json b/gdpr_analyzer/modules/crypto/cipher_suite_tls_v11.json similarity index 100% rename from modules/crypto/cipher_suite_tls_v11.json rename to gdpr_analyzer/modules/crypto/cipher_suite_tls_v11.json diff --git a/modules/crypto/cipher_suite_tls_v12.json b/gdpr_analyzer/modules/crypto/cipher_suite_tls_v12.json similarity index 100% rename from modules/crypto/cipher_suite_tls_v12.json rename to gdpr_analyzer/modules/crypto/cipher_suite_tls_v12.json diff --git a/modules/crypto/cipher_suite_tls_v13.json b/gdpr_analyzer/modules/crypto/cipher_suite_tls_v13.json similarity index 100% rename from modules/crypto/cipher_suite_tls_v13.json rename to gdpr_analyzer/modules/crypto/cipher_suite_tls_v13.json diff --git a/modules/crypto/config.ini b/gdpr_analyzer/modules/crypto/config.ini similarity index 100% rename from modules/crypto/config.ini rename to gdpr_analyzer/modules/crypto/config.ini diff --git a/modules/crypto/const.py b/gdpr_analyzer/modules/crypto/const.py similarity index 100% rename from modules/crypto/const.py rename to gdpr_analyzer/modules/crypto/const.py diff --git a/modules/crypto/crypto.py b/gdpr_analyzer/modules/crypto/crypto.py similarity index 99% rename from modules/crypto/crypto.py rename to gdpr_analyzer/modules/crypto/crypto.py index bf99954..573e8d1 100644 --- a/modules/crypto/crypto.py +++ b/gdpr_analyzer/modules/crypto/crypto.py @@ -8,7 +8,7 @@ from cryptography.hazmat.primitives import asymmetric import ssl import os -from modules.crypto import CipherSuite +from gdpr_analyzer.modules.crypto import CipherSuite config = configparser.ConfigParser() config.optionxform = lambda option: option diff --git a/modules/crypto/export1.json b/gdpr_analyzer/modules/crypto/export1.json similarity index 100% rename from modules/crypto/export1.json rename to gdpr_analyzer/modules/crypto/export1.json diff --git a/gdpr_analyzer/modules/report/__init__.py b/gdpr_analyzer/modules/report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/modules/report/generate_report.py b/gdpr_analyzer/modules/report/generate_report.py similarity index 100% rename from modules/report/generate_report.py rename to gdpr_analyzer/modules/report/generate_report.py diff --git a/modules/report/images/logo.png b/gdpr_analyzer/modules/report/images/logo.png similarity index 100% rename from modules/report/images/logo.png rename to gdpr_analyzer/modules/report/images/logo.png diff --git a/modules/report/images/logo.svg b/gdpr_analyzer/modules/report/images/logo.svg similarity index 100% rename from modules/report/images/logo.svg rename to gdpr_analyzer/modules/report/images/logo.svg diff --git a/modules/report/templates/Montserrat-Black.ttf b/gdpr_analyzer/modules/report/templates/Montserrat-Black.ttf similarity index 100% rename from modules/report/templates/Montserrat-Black.ttf rename to gdpr_analyzer/modules/report/templates/Montserrat-Black.ttf diff --git a/modules/report/templates/Montserrat-ExtraLight.ttf b/gdpr_analyzer/modules/report/templates/Montserrat-ExtraLight.ttf similarity index 100% rename from modules/report/templates/Montserrat-ExtraLight.ttf rename to gdpr_analyzer/modules/report/templates/Montserrat-ExtraLight.ttf diff --git a/modules/report/templates/Montserrat-Medium.ttf b/gdpr_analyzer/modules/report/templates/Montserrat-Medium.ttf similarity index 100% rename from modules/report/templates/Montserrat-Medium.ttf rename to gdpr_analyzer/modules/report/templates/Montserrat-Medium.ttf diff --git a/modules/report/templates/Montserrat-Regular.ttf b/gdpr_analyzer/modules/report/templates/Montserrat-Regular.ttf similarity index 100% rename from modules/report/templates/Montserrat-Regular.ttf rename to gdpr_analyzer/modules/report/templates/Montserrat-Regular.ttf diff --git a/modules/report/templates/bootstrap-grid.min.css b/gdpr_analyzer/modules/report/templates/bootstrap-grid.min.css similarity index 100% rename from modules/report/templates/bootstrap-grid.min.css rename to gdpr_analyzer/modules/report/templates/bootstrap-grid.min.css diff --git a/modules/report/templates/style.css b/gdpr_analyzer/modules/report/templates/style.css similarity index 100% rename from modules/report/templates/style.css rename to gdpr_analyzer/modules/report/templates/style.css diff --git a/modules/report/templates/template.html b/gdpr_analyzer/modules/report/templates/template.html similarity index 100% rename from modules/report/templates/template.html rename to gdpr_analyzer/modules/report/templates/template.html diff --git a/gdpr_analyzer/modules/web_beacon/__init__.py b/gdpr_analyzer/modules/web_beacon/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/modules/web_beacon/config.ini b/gdpr_analyzer/modules/web_beacon/config.ini similarity index 100% rename from modules/web_beacon/config.ini rename to gdpr_analyzer/modules/web_beacon/config.ini diff --git a/modules/web_beacon/web_beacon.py b/gdpr_analyzer/modules/web_beacon/web_beacon.py similarity index 100% rename from modules/web_beacon/web_beacon.py rename to gdpr_analyzer/modules/web_beacon/web_beacon.py From 1ec529043113e8c2b8151504e84bcef6dbf947b2 Mon Sep 17 00:00:00 2001 From: ShellCode33 Date: Sat, 1 Feb 2020 19:30:08 +0100 Subject: [PATCH 2/2] Everything's ready for packaging ! --- gdpr_analyzer/__main__.py | 6 +++- setup.py | 64 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 setup.py diff --git a/gdpr_analyzer/__main__.py b/gdpr_analyzer/__main__.py index 3aee9e9..23d9756 100644 --- a/gdpr_analyzer/__main__.py +++ b/gdpr_analyzer/__main__.py @@ -299,7 +299,7 @@ def start(): print("{}[-] JSON generated, it is stored in {}{}".format(Bcolors.GREEN, path_json, Bcolors.RESET)) -if __name__ == '__main__': +def main(): urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) @@ -308,3 +308,7 @@ def start(): sys.exit(1) start() + + +if __name__ == "__main__": + main() diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..1a542d1 --- /dev/null +++ b/setup.py @@ -0,0 +1,64 @@ +# coding: utf-8 + +from setuptools import setup, find_packages + +with open("README.md", "r") as f: + long_description = f.read() + +setup( + name="gdpr_analyzer", + version="0.1", + author="dev4privacy", + description="Measures the compliance of any web page with the GDPR by analyzing its source code and behaviour.", + long_description=long_description, + long_description_content_type="text/markdown", + url="https://github.com/dev4privacy/gdpr-analyzer", + install_requires=[ + "beautifulsoup4==4.8.2", + "blessings==1.7", + "bs4==0.0.1", + "cairocffi==1.1.0", + "CairoSVG==2.4.2", + "certifi==2019.11.28", + "cffi==1.13.2", + "chardet==3.0.4", + "cryptography==2.8", + "cssselect2==0.2.2", + "defusedxml==0.6.0", + "html5lib==1.0.1", + "idna==2.8", + "Jinja2==2.10.3", + "MarkupSafe==1.1.1", + "mozfile==2.1.0", + "mozlog==5.0", + "mozprofile==2.4.0", + "mozterm==1.0.0", + "Pillow==7.0.0", + "pycparser==2.19", + "pyOpenSSL==19.1.0", + "Pyphen==0.9.5", + "requests==2.22.0", + "selenium==3.141.0", + "six==1.14.0", + "soupsieve==1.9.5", + "splinter==0.13.0", + "tinycss==0.4", + "tinycss2==1.0.2", + "urllib3==1.25.7", + "WeasyPrint==51" + ], + packages=find_packages(), + package_data={ + "": ["*.ini"], + "gdpr_analyzer.modules.report": ["images/*", "templates/*"] + }, + entry_points={ + "console_scripts": ['gdpr-analyzer=gdpr_analyzer.__main__:main'] + }, + classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: GPLv3 License", + "Operating System :: OS Independent", + ], + python_requires='>=3.7', +)