From 5dfa0153ee95e9cadec3c87a10c55d406c6c58a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donncha=20=C3=93=20Cearbhaill?= Date: Mon, 30 Sep 2024 12:26:29 +0200 Subject: [PATCH 1/8] Restructure MVT to use pyproject.toml --- Makefile | 34 ++++-- pyproject.toml | 103 ++++++++++++++++++ ruff.toml | 6 - setup.cfg | 96 ---------------- setup.py | 8 -- {mvt => src/mvt}/__init__.py | 0 {mvt => src/mvt}/android/__init__.py | 0 .../mvt}/android/artifacts/__init__.py | 0 .../mvt}/android/artifacts/artifact.py | 0 .../artifacts/dumpsys_accessibility.py | 0 .../mvt}/android/artifacts/dumpsys_appops.py | 0 .../artifacts/dumpsys_battery_daily.py | 0 .../artifacts/dumpsys_battery_history.py | 0 .../mvt}/android/artifacts/dumpsys_dbinfo.py | 0 .../artifacts/dumpsys_package_activities.py | 0 .../android/artifacts/dumpsys_packages.py | 0 .../android/artifacts/dumpsys_receivers.py | 0 {mvt => src/mvt}/android/artifacts/getprop.py | 0 .../mvt}/android/artifacts/processes.py | 0 .../mvt}/android/artifacts/settings.py | 0 {mvt => src/mvt}/android/cli.py | 0 {mvt => src/mvt}/android/cmd_check_adb.py | 0 .../mvt}/android/cmd_check_androidqf.py | 0 {mvt => src/mvt}/android/cmd_check_backup.py | 0 .../mvt}/android/cmd_check_bugreport.py | 0 {mvt => src/mvt}/android/cmd_download_apks.py | 0 {mvt => src/mvt}/android/modules/__init__.py | 0 .../mvt}/android/modules/adb/__init__.py | 0 {mvt => src/mvt}/android/modules/adb/base.py | 0 .../android/modules/adb/chrome_history.py | 0 .../modules/adb/dumpsys_accessibility.py | 0 .../android/modules/adb/dumpsys_activities.py | 0 .../android/modules/adb/dumpsys_appops.py | 0 .../modules/adb/dumpsys_battery_daily.py | 0 .../modules/adb/dumpsys_battery_history.py | 0 .../android/modules/adb/dumpsys_dbinfo.py | 0 .../mvt}/android/modules/adb/dumpsys_full.py | 0 .../android/modules/adb/dumpsys_receivers.py | 0 {mvt => src/mvt}/android/modules/adb/files.py | 0 .../mvt}/android/modules/adb/getprop.py | 0 .../mvt}/android/modules/adb/logcat.py | 0 .../mvt}/android/modules/adb/packages.py | 0 .../mvt}/android/modules/adb/processes.py | 0 .../mvt}/android/modules/adb/root_binaries.py | 0 .../android/modules/adb/selinux_status.py | 0 .../mvt}/android/modules/adb/settings.py | 0 {mvt => src/mvt}/android/modules/adb/sms.py | 0 .../mvt}/android/modules/adb/whatsapp.py | 0 .../android/modules/androidqf/__init__.py | 0 .../mvt}/android/modules/androidqf/base.py | 0 .../androidqf/dumpsys_accessibility.py | 0 .../modules/androidqf/dumpsys_activities.py | 0 .../modules/androidqf/dumpsys_appops.py | 0 .../androidqf/dumpsys_battery_daily.py | 0 .../androidqf/dumpsys_battery_history.py | 0 .../modules/androidqf/dumpsys_dbinfo.py | 0 .../modules/androidqf/dumpsys_packages.py | 0 .../modules/androidqf/dumpsys_receivers.py | 0 .../mvt}/android/modules/androidqf/getprop.py | 0 .../android/modules/androidqf/packages.py | 0 .../android/modules/androidqf/processes.py | 0 .../android/modules/androidqf/settings.py | 0 .../mvt}/android/modules/androidqf/sms.py | 0 .../mvt}/android/modules/backup/__init__.py | 0 .../mvt}/android/modules/backup/base.py | 0 .../mvt}/android/modules/backup/helpers.py | 0 .../mvt}/android/modules/backup/sms.py | 0 .../android/modules/bugreport/__init__.py | 0 .../modules/bugreport/accessibility.py | 0 .../android/modules/bugreport/activities.py | 0 .../mvt}/android/modules/bugreport/appops.py | 0 .../mvt}/android/modules/bugreport/base.py | 0 .../modules/bugreport/battery_daily.py | 0 .../modules/bugreport/battery_history.py | 0 .../mvt}/android/modules/bugreport/dbinfo.py | 0 .../mvt}/android/modules/bugreport/getprop.py | 0 .../android/modules/bugreport/packages.py | 0 .../android/modules/bugreport/receivers.py | 0 {mvt => src/mvt}/android/parsers/__init__.py | 0 {mvt => src/mvt}/android/parsers/backup.py | 0 {mvt => src/mvt}/android/utils.py | 0 {mvt => src/mvt}/common/__init__.py | 0 {mvt => src/mvt}/common/artifact.py | 0 {mvt => src/mvt}/common/cmd_check_iocs.py | 0 {mvt => src/mvt}/common/command.py | 0 {mvt => src/mvt}/common/help.py | 0 {mvt => src/mvt}/common/indicators.py | 0 {mvt => src/mvt}/common/logo.py | 0 {mvt => src/mvt}/common/module.py | 0 {mvt => src/mvt}/common/options.py | 0 {mvt => src/mvt}/common/updates.py | 0 {mvt => src/mvt}/common/url.py | 0 {mvt => src/mvt}/common/utils.py | 0 {mvt => src/mvt}/common/version.py | 0 {mvt => src/mvt}/common/virustotal.py | 0 {mvt => src/mvt}/ios/__init__.py | 0 {mvt => src/mvt}/ios/cli.py | 0 {mvt => src/mvt}/ios/cmd_check_backup.py | 0 {mvt => src/mvt}/ios/cmd_check_fs.py | 0 {mvt => src/mvt}/ios/data/ios_models.json | 0 {mvt => src/mvt}/ios/data/ios_versions.json | 0 {mvt => src/mvt}/ios/decrypt.py | 0 {mvt => src/mvt}/ios/modules/__init__.py | 0 .../mvt}/ios/modules/backup/__init__.py | 0 .../mvt}/ios/modules/backup/backup_info.py | 0 .../modules/backup/configuration_profiles.py | 0 .../mvt}/ios/modules/backup/manifest.py | 0 .../mvt}/ios/modules/backup/profile_events.py | 0 {mvt => src/mvt}/ios/modules/base.py | 0 {mvt => src/mvt}/ios/modules/fs/__init__.py | 0 {mvt => src/mvt}/ios/modules/fs/analytics.py | 0 .../ios/modules/fs/analytics_ios_versions.py | 0 .../mvt}/ios/modules/fs/cache_files.py | 0 {mvt => src/mvt}/ios/modules/fs/filesystem.py | 0 .../mvt}/ios/modules/fs/net_netusage.py | 0 .../mvt}/ios/modules/fs/safari_favicon.py | 0 .../mvt}/ios/modules/fs/shutdownlog.py | 0 .../mvt}/ios/modules/fs/version_history.py | 0 .../mvt}/ios/modules/fs/webkit_base.py | 0 .../mvt}/ios/modules/fs/webkit_indexeddb.py | 0 .../ios/modules/fs/webkit_localstorage.py | 0 .../modules/fs/webkit_safariviewservice.py | 0 .../mvt}/ios/modules/mixed/__init__.py | 0 .../mvt}/ios/modules/mixed/applications.py | 0 .../mvt}/ios/modules/mixed/calendar.py | 0 {mvt => src/mvt}/ios/modules/mixed/calls.py | 0 .../mvt}/ios/modules/mixed/chrome_favicon.py | 0 .../mvt}/ios/modules/mixed/chrome_history.py | 0 .../mvt}/ios/modules/mixed/contacts.py | 0 .../mvt}/ios/modules/mixed/firefox_favicon.py | 0 .../mvt}/ios/modules/mixed/firefox_history.py | 0 .../ios/modules/mixed/global_preferences.py | 0 .../mvt}/ios/modules/mixed/idstatuscache.py | 0 .../mvt}/ios/modules/mixed/interactionc.py | 0 .../mvt}/ios/modules/mixed/locationd.py | 0 .../mvt}/ios/modules/mixed/net_datausage.py | 0 .../ios/modules/mixed/osanalytics_addaily.py | 0 .../ios/modules/mixed/safari_browserstate.py | 0 .../mvt}/ios/modules/mixed/safari_history.py | 0 .../mvt}/ios/modules/mixed/shortcuts.py | 0 {mvt => src/mvt}/ios/modules/mixed/sms.py | 0 .../mvt}/ios/modules/mixed/sms_attachments.py | 0 {mvt => src/mvt}/ios/modules/mixed/tcc.py | 0 .../mixed/webkit_resource_load_statistics.py | 0 .../mixed/webkit_session_resource_log.py | 0 .../mvt}/ios/modules/mixed/whatsapp.py | 0 {mvt => src/mvt}/ios/modules/net_base.py | 0 {mvt => src/mvt}/ios/versions.py | 0 test-requirements.txt | 8 ++ 149 files changed, 136 insertions(+), 119 deletions(-) create mode 100644 pyproject.toml delete mode 100644 ruff.toml delete mode 100644 setup.cfg delete mode 100755 setup.py rename {mvt => src/mvt}/__init__.py (100%) rename {mvt => src/mvt}/android/__init__.py (100%) rename {mvt => src/mvt}/android/artifacts/__init__.py (100%) rename {mvt => src/mvt}/android/artifacts/artifact.py (100%) rename {mvt => src/mvt}/android/artifacts/dumpsys_accessibility.py (100%) rename {mvt => src/mvt}/android/artifacts/dumpsys_appops.py (100%) rename {mvt => src/mvt}/android/artifacts/dumpsys_battery_daily.py (100%) rename {mvt => src/mvt}/android/artifacts/dumpsys_battery_history.py (100%) rename {mvt => src/mvt}/android/artifacts/dumpsys_dbinfo.py (100%) rename {mvt => src/mvt}/android/artifacts/dumpsys_package_activities.py (100%) rename {mvt => src/mvt}/android/artifacts/dumpsys_packages.py (100%) rename {mvt => src/mvt}/android/artifacts/dumpsys_receivers.py (100%) rename {mvt => src/mvt}/android/artifacts/getprop.py (100%) rename {mvt => src/mvt}/android/artifacts/processes.py (100%) rename {mvt => src/mvt}/android/artifacts/settings.py (100%) rename {mvt => src/mvt}/android/cli.py (100%) rename {mvt => src/mvt}/android/cmd_check_adb.py (100%) rename {mvt => src/mvt}/android/cmd_check_androidqf.py (100%) rename {mvt => src/mvt}/android/cmd_check_backup.py (100%) rename {mvt => src/mvt}/android/cmd_check_bugreport.py (100%) rename {mvt => src/mvt}/android/cmd_download_apks.py (100%) rename {mvt => src/mvt}/android/modules/__init__.py (100%) rename {mvt => src/mvt}/android/modules/adb/__init__.py (100%) rename {mvt => src/mvt}/android/modules/adb/base.py (100%) rename {mvt => src/mvt}/android/modules/adb/chrome_history.py (100%) rename {mvt => src/mvt}/android/modules/adb/dumpsys_accessibility.py (100%) rename {mvt => src/mvt}/android/modules/adb/dumpsys_activities.py (100%) rename {mvt => src/mvt}/android/modules/adb/dumpsys_appops.py (100%) rename {mvt => src/mvt}/android/modules/adb/dumpsys_battery_daily.py (100%) rename {mvt => src/mvt}/android/modules/adb/dumpsys_battery_history.py (100%) rename {mvt => src/mvt}/android/modules/adb/dumpsys_dbinfo.py (100%) rename {mvt => src/mvt}/android/modules/adb/dumpsys_full.py (100%) rename {mvt => src/mvt}/android/modules/adb/dumpsys_receivers.py (100%) rename {mvt => src/mvt}/android/modules/adb/files.py (100%) rename {mvt => src/mvt}/android/modules/adb/getprop.py (100%) rename {mvt => src/mvt}/android/modules/adb/logcat.py (100%) rename {mvt => src/mvt}/android/modules/adb/packages.py (100%) rename {mvt => src/mvt}/android/modules/adb/processes.py (100%) rename {mvt => src/mvt}/android/modules/adb/root_binaries.py (100%) rename {mvt => src/mvt}/android/modules/adb/selinux_status.py (100%) rename {mvt => src/mvt}/android/modules/adb/settings.py (100%) rename {mvt => src/mvt}/android/modules/adb/sms.py (100%) rename {mvt => src/mvt}/android/modules/adb/whatsapp.py (100%) rename {mvt => src/mvt}/android/modules/androidqf/__init__.py (100%) rename {mvt => src/mvt}/android/modules/androidqf/base.py (100%) rename {mvt => src/mvt}/android/modules/androidqf/dumpsys_accessibility.py (100%) rename {mvt => src/mvt}/android/modules/androidqf/dumpsys_activities.py (100%) rename {mvt => src/mvt}/android/modules/androidqf/dumpsys_appops.py (100%) rename {mvt => src/mvt}/android/modules/androidqf/dumpsys_battery_daily.py (100%) rename {mvt => src/mvt}/android/modules/androidqf/dumpsys_battery_history.py (100%) rename {mvt => src/mvt}/android/modules/androidqf/dumpsys_dbinfo.py (100%) rename {mvt => src/mvt}/android/modules/androidqf/dumpsys_packages.py (100%) rename {mvt => src/mvt}/android/modules/androidqf/dumpsys_receivers.py (100%) rename {mvt => src/mvt}/android/modules/androidqf/getprop.py (100%) rename {mvt => src/mvt}/android/modules/androidqf/packages.py (100%) rename {mvt => src/mvt}/android/modules/androidqf/processes.py (100%) rename {mvt => src/mvt}/android/modules/androidqf/settings.py (100%) rename {mvt => src/mvt}/android/modules/androidqf/sms.py (100%) rename {mvt => src/mvt}/android/modules/backup/__init__.py (100%) rename {mvt => src/mvt}/android/modules/backup/base.py (100%) rename {mvt => src/mvt}/android/modules/backup/helpers.py (100%) rename {mvt => src/mvt}/android/modules/backup/sms.py (100%) rename {mvt => src/mvt}/android/modules/bugreport/__init__.py (100%) rename {mvt => src/mvt}/android/modules/bugreport/accessibility.py (100%) rename {mvt => src/mvt}/android/modules/bugreport/activities.py (100%) rename {mvt => src/mvt}/android/modules/bugreport/appops.py (100%) rename {mvt => src/mvt}/android/modules/bugreport/base.py (100%) rename {mvt => src/mvt}/android/modules/bugreport/battery_daily.py (100%) rename {mvt => src/mvt}/android/modules/bugreport/battery_history.py (100%) rename {mvt => src/mvt}/android/modules/bugreport/dbinfo.py (100%) rename {mvt => src/mvt}/android/modules/bugreport/getprop.py (100%) rename {mvt => src/mvt}/android/modules/bugreport/packages.py (100%) rename {mvt => src/mvt}/android/modules/bugreport/receivers.py (100%) rename {mvt => src/mvt}/android/parsers/__init__.py (100%) rename {mvt => src/mvt}/android/parsers/backup.py (100%) rename {mvt => src/mvt}/android/utils.py (100%) rename {mvt => src/mvt}/common/__init__.py (100%) rename {mvt => src/mvt}/common/artifact.py (100%) rename {mvt => src/mvt}/common/cmd_check_iocs.py (100%) rename {mvt => src/mvt}/common/command.py (100%) rename {mvt => src/mvt}/common/help.py (100%) rename {mvt => src/mvt}/common/indicators.py (100%) rename {mvt => src/mvt}/common/logo.py (100%) rename {mvt => src/mvt}/common/module.py (100%) rename {mvt => src/mvt}/common/options.py (100%) rename {mvt => src/mvt}/common/updates.py (100%) rename {mvt => src/mvt}/common/url.py (100%) rename {mvt => src/mvt}/common/utils.py (100%) rename {mvt => src/mvt}/common/version.py (100%) rename {mvt => src/mvt}/common/virustotal.py (100%) rename {mvt => src/mvt}/ios/__init__.py (100%) rename {mvt => src/mvt}/ios/cli.py (100%) rename {mvt => src/mvt}/ios/cmd_check_backup.py (100%) rename {mvt => src/mvt}/ios/cmd_check_fs.py (100%) rename {mvt => src/mvt}/ios/data/ios_models.json (100%) rename {mvt => src/mvt}/ios/data/ios_versions.json (100%) rename {mvt => src/mvt}/ios/decrypt.py (100%) rename {mvt => src/mvt}/ios/modules/__init__.py (100%) rename {mvt => src/mvt}/ios/modules/backup/__init__.py (100%) rename {mvt => src/mvt}/ios/modules/backup/backup_info.py (100%) rename {mvt => src/mvt}/ios/modules/backup/configuration_profiles.py (100%) rename {mvt => src/mvt}/ios/modules/backup/manifest.py (100%) rename {mvt => src/mvt}/ios/modules/backup/profile_events.py (100%) rename {mvt => src/mvt}/ios/modules/base.py (100%) rename {mvt => src/mvt}/ios/modules/fs/__init__.py (100%) rename {mvt => src/mvt}/ios/modules/fs/analytics.py (100%) rename {mvt => src/mvt}/ios/modules/fs/analytics_ios_versions.py (100%) rename {mvt => src/mvt}/ios/modules/fs/cache_files.py (100%) rename {mvt => src/mvt}/ios/modules/fs/filesystem.py (100%) rename {mvt => src/mvt}/ios/modules/fs/net_netusage.py (100%) rename {mvt => src/mvt}/ios/modules/fs/safari_favicon.py (100%) rename {mvt => src/mvt}/ios/modules/fs/shutdownlog.py (100%) rename {mvt => src/mvt}/ios/modules/fs/version_history.py (100%) rename {mvt => src/mvt}/ios/modules/fs/webkit_base.py (100%) rename {mvt => src/mvt}/ios/modules/fs/webkit_indexeddb.py (100%) rename {mvt => src/mvt}/ios/modules/fs/webkit_localstorage.py (100%) rename {mvt => src/mvt}/ios/modules/fs/webkit_safariviewservice.py (100%) rename {mvt => src/mvt}/ios/modules/mixed/__init__.py (100%) rename {mvt => src/mvt}/ios/modules/mixed/applications.py (100%) rename {mvt => src/mvt}/ios/modules/mixed/calendar.py (100%) rename {mvt => src/mvt}/ios/modules/mixed/calls.py (100%) rename {mvt => src/mvt}/ios/modules/mixed/chrome_favicon.py (100%) rename {mvt => src/mvt}/ios/modules/mixed/chrome_history.py (100%) rename {mvt => src/mvt}/ios/modules/mixed/contacts.py (100%) rename {mvt => src/mvt}/ios/modules/mixed/firefox_favicon.py (100%) rename {mvt => src/mvt}/ios/modules/mixed/firefox_history.py (100%) rename {mvt => src/mvt}/ios/modules/mixed/global_preferences.py (100%) rename {mvt => src/mvt}/ios/modules/mixed/idstatuscache.py (100%) rename {mvt => src/mvt}/ios/modules/mixed/interactionc.py (100%) rename {mvt => src/mvt}/ios/modules/mixed/locationd.py (100%) rename {mvt => src/mvt}/ios/modules/mixed/net_datausage.py (100%) rename {mvt => src/mvt}/ios/modules/mixed/osanalytics_addaily.py (100%) rename {mvt => src/mvt}/ios/modules/mixed/safari_browserstate.py (100%) rename {mvt => src/mvt}/ios/modules/mixed/safari_history.py (100%) rename {mvt => src/mvt}/ios/modules/mixed/shortcuts.py (100%) rename {mvt => src/mvt}/ios/modules/mixed/sms.py (100%) rename {mvt => src/mvt}/ios/modules/mixed/sms_attachments.py (100%) rename {mvt => src/mvt}/ios/modules/mixed/tcc.py (100%) rename {mvt => src/mvt}/ios/modules/mixed/webkit_resource_load_statistics.py (100%) rename {mvt => src/mvt}/ios/modules/mixed/webkit_session_resource_log.py (100%) rename {mvt => src/mvt}/ios/modules/mixed/whatsapp.py (100%) rename {mvt => src/mvt}/ios/modules/net_base.py (100%) rename {mvt => src/mvt}/ios/versions.py (100%) create mode 100644 test-requirements.txt diff --git a/Makefile b/Makefile index a9b18dd6d..0d4d8ccc8 100644 --- a/Makefile +++ b/Makefile @@ -1,23 +1,39 @@ PWD = $(shell pwd) -check: - flake8 +autofix: + ruff format . + ruff check --fix . + +check: ruff mypy + +ruff: + ruff format --check . ruff check -q . - black --check . - pytest -q +mypy: + mypy + +test: + pytest + +test-ci: + pytest -v + +install: + python3 -m pip install --upgrade -e . + +test-requirements: + python3 -m pip install --upgrade -r test-requirements.txt clean: - rm -rf $(PWD)/build $(PWD)/dist $(PWD)/mvt.egg-info + rm -rf $(PWD)/build $(PWD)/dist $(PWD)/src/mvt.egg-info dist: - python3 setup.py sdist bdist_wheel + python3 -m pip install --upgrade build + python3 -m build upload: python3 -m twine upload dist/* test-upload: python3 -m twine upload --repository testpypi dist/* - -pylint: - pylint --rcfile=setup.cfg mvt diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..9b0229de5 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,103 @@ +[project] +name = "mvt" +dynamic = ["version"] +authors = [ + {name = "Claudio Guarnieri", email = "nex@nex.sx"} +] +maintainers = [ + {name = "Etienne Maynier", email = "tek@randhome.io"}, + {name = "Donncha Ó Cearbhaill", email = "donncha.ocearbhaill@amnesty.org"}, + {name = "Rory Flynn", email = "rory.flynn@amnesty.org"} +] +description = "Mobile Verification Toolkit" +readme = "README.md" +keywords = ["security", "mobile", "forensics", "malware"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Information Technology", + "Operating System :: OS Independent", + "Programming Language :: Python" +] +dependencies = [ + "click >=8.1.3", + "rich >=12.6.0", + "tld >=0.12.6", + "requests >=2.28.1", + "simplejson >=3.17.6", + "packaging >=21.3", + "appdirs >=1.4.4", + "iOSbackup >=0.9.923", + "adb-shell >=0.4.3", + "libusb1 >=3.0.0", + "cryptography >=42.0.5", + "pyyaml >=6.0", + "pyahocorasick >= 2.0.0", +] +requires-python = ">= 3.8" + +[project.urls] +homepage = "https://docs.mvt.re/en/latest/" +repository = "https://github.com/mvt-project/mvt" + +[project.scripts] + mvt-ios = "mvt.ios:cli" + mvt-android = "mvt.android:cli" + +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[tool.coverage.run] +omit = [ + "tests/*", +] + +[tool.coverage.html] +directory= "htmlcov" + +[tool.mypy] +install_types = true +non_interactive = true +ignore_missing_imports = true +packages = "src" + +[tool.pytest.ini_options] +addopts = "-ra -q --cov=./src/mvt --cov-report html" +testpaths = [ + "tests" +] + +[tool.ruff.lint] +select = ["C90", "E", "F", "W"] # flake8 default set +ignore = [ + "E501", # don't enforce line length violations + "C901", # complex-structure + + # These were previously ignored but don't seem to be required: + # "E265", # no-space-after-block-comment + # "F401", # unused-import + # "E127", # not included in ruff + # "W503", # not included in ruff + # "E226", # missing-whitespace-around-arithmetic-operator + # "E203", # whitespace-before-punctuation +] + +[tool.ruff.lint.per-file-ignores] +"__init__.py" = ["F401"] # unused-import + +[tool.ruff.lint.mccabe] +max-complexity = 10 + +[tool.setuptools] +include-package-data = true +package-dir = {"" = "src"} + + +[tool.setuptools.packages.find] +where = ["src"] + +[tool.setuptools.package-data] +mvt = ["ios/data/*.json"] + +[tool.setuptools.dynamic] +version = {attr = "mvt.common.version.MVT_VERSION"} \ No newline at end of file diff --git a/ruff.toml b/ruff.toml deleted file mode 100644 index ffb51b033..000000000 --- a/ruff.toml +++ /dev/null @@ -1,6 +0,0 @@ -# Never enforce `E501` (line length violations). -ignore = ["E501"] - -# Ignore `E402` (import violations) in all `__init__.py` files, and in `path/to/file.py`. -[per-file-ignores] -"__init__.py" = ["F401"] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index d3325f104..000000000 --- a/setup.cfg +++ /dev/null @@ -1,96 +0,0 @@ -[metadata] -name = mvt -version = attr: mvt.common.version.MVT_VERSION -author = Claudio Guarnieri -author_email = nex@nex.sx -description = Mobile Verification Toolkit -long_description = file: README.md -long_description_content_type = text/markdown -url = https://github.com/mvt-project/mvt -keywords = security, mobile, forensics, malware -license = MVT v1.1 -classifiers = - Development Status :: 5 - Production/Stable - Intended Audience :: Information Technology - Operating System :: OS Independent - Programming Language :: Python - -[options] -packages = find: -package_dir = = ./ -include_package_data = True -python_requires = >= 3.8 -install_requires = - click >=8.1.3 - rich >=12.6.0 - tld >=0.12.6 - requests >=2.28.1 - simplejson >=3.17.6 - packaging >=21.3 - appdirs >=1.4.4 - iOSbackup >=0.9.923 - adb-shell >=0.4.3 - libusb1 >=3.0.0 - cryptography >=42.0.5 - pyyaml >=6.0 - pyahocorasick >= 2.0.0 - -[options.packages.find] -where = ./ - -[options.entry_points] -console_scripts = - mvt-ios = mvt.ios:cli - mvt-android = mvt.android:cli - -[options.package_data] -mvt = ios/data/*.json - -[flake8] -max-complexity = 10 -max-line-length = 1000 -ignore = - C901, - E265, - F401, - E127, - W503, - E226, - E203 - -[pylint] -score = no -reports = no -output-format = colorized - -max-locals = 25 -max-args = 10 - -good-names = i,m - -min-similarity-lines = 10 -ignore-comments = yes -ignore-docstrings = yes -ignore-imports = yes - -ignored-argument-names=args|kwargs - -# https://pylint.pycqa.org/en/stable/technical_reference/features.html -disable = - too-many-instance-attributes, - broad-except, - abstract-method, - dangerous-default-value, - too-few-public-methods, - missing-docstring, - missing-module-docstring, - missing-class-docstring, - missing-function-docstring, - #duplicate-code, - #line-too-long, - -[mypy] -ignore_missing_imports = True - -[isort] -profile=black diff --git a/setup.py b/setup.py deleted file mode 100755 index 8447368d5..000000000 --- a/setup.py +++ /dev/null @@ -1,8 +0,0 @@ -# Mobile Verification Toolkit (MVT) -# Copyright (c) 2021-2023 The MVT Authors. -# Use of this software is governed by the MVT License 1.1 that can be found at -# https://license.mvt.re/1.1/ - -from setuptools import setup - -setup() diff --git a/mvt/__init__.py b/src/mvt/__init__.py similarity index 100% rename from mvt/__init__.py rename to src/mvt/__init__.py diff --git a/mvt/android/__init__.py b/src/mvt/android/__init__.py similarity index 100% rename from mvt/android/__init__.py rename to src/mvt/android/__init__.py diff --git a/mvt/android/artifacts/__init__.py b/src/mvt/android/artifacts/__init__.py similarity index 100% rename from mvt/android/artifacts/__init__.py rename to src/mvt/android/artifacts/__init__.py diff --git a/mvt/android/artifacts/artifact.py b/src/mvt/android/artifacts/artifact.py similarity index 100% rename from mvt/android/artifacts/artifact.py rename to src/mvt/android/artifacts/artifact.py diff --git a/mvt/android/artifacts/dumpsys_accessibility.py b/src/mvt/android/artifacts/dumpsys_accessibility.py similarity index 100% rename from mvt/android/artifacts/dumpsys_accessibility.py rename to src/mvt/android/artifacts/dumpsys_accessibility.py diff --git a/mvt/android/artifacts/dumpsys_appops.py b/src/mvt/android/artifacts/dumpsys_appops.py similarity index 100% rename from mvt/android/artifacts/dumpsys_appops.py rename to src/mvt/android/artifacts/dumpsys_appops.py diff --git a/mvt/android/artifacts/dumpsys_battery_daily.py b/src/mvt/android/artifacts/dumpsys_battery_daily.py similarity index 100% rename from mvt/android/artifacts/dumpsys_battery_daily.py rename to src/mvt/android/artifacts/dumpsys_battery_daily.py diff --git a/mvt/android/artifacts/dumpsys_battery_history.py b/src/mvt/android/artifacts/dumpsys_battery_history.py similarity index 100% rename from mvt/android/artifacts/dumpsys_battery_history.py rename to src/mvt/android/artifacts/dumpsys_battery_history.py diff --git a/mvt/android/artifacts/dumpsys_dbinfo.py b/src/mvt/android/artifacts/dumpsys_dbinfo.py similarity index 100% rename from mvt/android/artifacts/dumpsys_dbinfo.py rename to src/mvt/android/artifacts/dumpsys_dbinfo.py diff --git a/mvt/android/artifacts/dumpsys_package_activities.py b/src/mvt/android/artifacts/dumpsys_package_activities.py similarity index 100% rename from mvt/android/artifacts/dumpsys_package_activities.py rename to src/mvt/android/artifacts/dumpsys_package_activities.py diff --git a/mvt/android/artifacts/dumpsys_packages.py b/src/mvt/android/artifacts/dumpsys_packages.py similarity index 100% rename from mvt/android/artifacts/dumpsys_packages.py rename to src/mvt/android/artifacts/dumpsys_packages.py diff --git a/mvt/android/artifacts/dumpsys_receivers.py b/src/mvt/android/artifacts/dumpsys_receivers.py similarity index 100% rename from mvt/android/artifacts/dumpsys_receivers.py rename to src/mvt/android/artifacts/dumpsys_receivers.py diff --git a/mvt/android/artifacts/getprop.py b/src/mvt/android/artifacts/getprop.py similarity index 100% rename from mvt/android/artifacts/getprop.py rename to src/mvt/android/artifacts/getprop.py diff --git a/mvt/android/artifacts/processes.py b/src/mvt/android/artifacts/processes.py similarity index 100% rename from mvt/android/artifacts/processes.py rename to src/mvt/android/artifacts/processes.py diff --git a/mvt/android/artifacts/settings.py b/src/mvt/android/artifacts/settings.py similarity index 100% rename from mvt/android/artifacts/settings.py rename to src/mvt/android/artifacts/settings.py diff --git a/mvt/android/cli.py b/src/mvt/android/cli.py similarity index 100% rename from mvt/android/cli.py rename to src/mvt/android/cli.py diff --git a/mvt/android/cmd_check_adb.py b/src/mvt/android/cmd_check_adb.py similarity index 100% rename from mvt/android/cmd_check_adb.py rename to src/mvt/android/cmd_check_adb.py diff --git a/mvt/android/cmd_check_androidqf.py b/src/mvt/android/cmd_check_androidqf.py similarity index 100% rename from mvt/android/cmd_check_androidqf.py rename to src/mvt/android/cmd_check_androidqf.py diff --git a/mvt/android/cmd_check_backup.py b/src/mvt/android/cmd_check_backup.py similarity index 100% rename from mvt/android/cmd_check_backup.py rename to src/mvt/android/cmd_check_backup.py diff --git a/mvt/android/cmd_check_bugreport.py b/src/mvt/android/cmd_check_bugreport.py similarity index 100% rename from mvt/android/cmd_check_bugreport.py rename to src/mvt/android/cmd_check_bugreport.py diff --git a/mvt/android/cmd_download_apks.py b/src/mvt/android/cmd_download_apks.py similarity index 100% rename from mvt/android/cmd_download_apks.py rename to src/mvt/android/cmd_download_apks.py diff --git a/mvt/android/modules/__init__.py b/src/mvt/android/modules/__init__.py similarity index 100% rename from mvt/android/modules/__init__.py rename to src/mvt/android/modules/__init__.py diff --git a/mvt/android/modules/adb/__init__.py b/src/mvt/android/modules/adb/__init__.py similarity index 100% rename from mvt/android/modules/adb/__init__.py rename to src/mvt/android/modules/adb/__init__.py diff --git a/mvt/android/modules/adb/base.py b/src/mvt/android/modules/adb/base.py similarity index 100% rename from mvt/android/modules/adb/base.py rename to src/mvt/android/modules/adb/base.py diff --git a/mvt/android/modules/adb/chrome_history.py b/src/mvt/android/modules/adb/chrome_history.py similarity index 100% rename from mvt/android/modules/adb/chrome_history.py rename to src/mvt/android/modules/adb/chrome_history.py diff --git a/mvt/android/modules/adb/dumpsys_accessibility.py b/src/mvt/android/modules/adb/dumpsys_accessibility.py similarity index 100% rename from mvt/android/modules/adb/dumpsys_accessibility.py rename to src/mvt/android/modules/adb/dumpsys_accessibility.py diff --git a/mvt/android/modules/adb/dumpsys_activities.py b/src/mvt/android/modules/adb/dumpsys_activities.py similarity index 100% rename from mvt/android/modules/adb/dumpsys_activities.py rename to src/mvt/android/modules/adb/dumpsys_activities.py diff --git a/mvt/android/modules/adb/dumpsys_appops.py b/src/mvt/android/modules/adb/dumpsys_appops.py similarity index 100% rename from mvt/android/modules/adb/dumpsys_appops.py rename to src/mvt/android/modules/adb/dumpsys_appops.py diff --git a/mvt/android/modules/adb/dumpsys_battery_daily.py b/src/mvt/android/modules/adb/dumpsys_battery_daily.py similarity index 100% rename from mvt/android/modules/adb/dumpsys_battery_daily.py rename to src/mvt/android/modules/adb/dumpsys_battery_daily.py diff --git a/mvt/android/modules/adb/dumpsys_battery_history.py b/src/mvt/android/modules/adb/dumpsys_battery_history.py similarity index 100% rename from mvt/android/modules/adb/dumpsys_battery_history.py rename to src/mvt/android/modules/adb/dumpsys_battery_history.py diff --git a/mvt/android/modules/adb/dumpsys_dbinfo.py b/src/mvt/android/modules/adb/dumpsys_dbinfo.py similarity index 100% rename from mvt/android/modules/adb/dumpsys_dbinfo.py rename to src/mvt/android/modules/adb/dumpsys_dbinfo.py diff --git a/mvt/android/modules/adb/dumpsys_full.py b/src/mvt/android/modules/adb/dumpsys_full.py similarity index 100% rename from mvt/android/modules/adb/dumpsys_full.py rename to src/mvt/android/modules/adb/dumpsys_full.py diff --git a/mvt/android/modules/adb/dumpsys_receivers.py b/src/mvt/android/modules/adb/dumpsys_receivers.py similarity index 100% rename from mvt/android/modules/adb/dumpsys_receivers.py rename to src/mvt/android/modules/adb/dumpsys_receivers.py diff --git a/mvt/android/modules/adb/files.py b/src/mvt/android/modules/adb/files.py similarity index 100% rename from mvt/android/modules/adb/files.py rename to src/mvt/android/modules/adb/files.py diff --git a/mvt/android/modules/adb/getprop.py b/src/mvt/android/modules/adb/getprop.py similarity index 100% rename from mvt/android/modules/adb/getprop.py rename to src/mvt/android/modules/adb/getprop.py diff --git a/mvt/android/modules/adb/logcat.py b/src/mvt/android/modules/adb/logcat.py similarity index 100% rename from mvt/android/modules/adb/logcat.py rename to src/mvt/android/modules/adb/logcat.py diff --git a/mvt/android/modules/adb/packages.py b/src/mvt/android/modules/adb/packages.py similarity index 100% rename from mvt/android/modules/adb/packages.py rename to src/mvt/android/modules/adb/packages.py diff --git a/mvt/android/modules/adb/processes.py b/src/mvt/android/modules/adb/processes.py similarity index 100% rename from mvt/android/modules/adb/processes.py rename to src/mvt/android/modules/adb/processes.py diff --git a/mvt/android/modules/adb/root_binaries.py b/src/mvt/android/modules/adb/root_binaries.py similarity index 100% rename from mvt/android/modules/adb/root_binaries.py rename to src/mvt/android/modules/adb/root_binaries.py diff --git a/mvt/android/modules/adb/selinux_status.py b/src/mvt/android/modules/adb/selinux_status.py similarity index 100% rename from mvt/android/modules/adb/selinux_status.py rename to src/mvt/android/modules/adb/selinux_status.py diff --git a/mvt/android/modules/adb/settings.py b/src/mvt/android/modules/adb/settings.py similarity index 100% rename from mvt/android/modules/adb/settings.py rename to src/mvt/android/modules/adb/settings.py diff --git a/mvt/android/modules/adb/sms.py b/src/mvt/android/modules/adb/sms.py similarity index 100% rename from mvt/android/modules/adb/sms.py rename to src/mvt/android/modules/adb/sms.py diff --git a/mvt/android/modules/adb/whatsapp.py b/src/mvt/android/modules/adb/whatsapp.py similarity index 100% rename from mvt/android/modules/adb/whatsapp.py rename to src/mvt/android/modules/adb/whatsapp.py diff --git a/mvt/android/modules/androidqf/__init__.py b/src/mvt/android/modules/androidqf/__init__.py similarity index 100% rename from mvt/android/modules/androidqf/__init__.py rename to src/mvt/android/modules/androidqf/__init__.py diff --git a/mvt/android/modules/androidqf/base.py b/src/mvt/android/modules/androidqf/base.py similarity index 100% rename from mvt/android/modules/androidqf/base.py rename to src/mvt/android/modules/androidqf/base.py diff --git a/mvt/android/modules/androidqf/dumpsys_accessibility.py b/src/mvt/android/modules/androidqf/dumpsys_accessibility.py similarity index 100% rename from mvt/android/modules/androidqf/dumpsys_accessibility.py rename to src/mvt/android/modules/androidqf/dumpsys_accessibility.py diff --git a/mvt/android/modules/androidqf/dumpsys_activities.py b/src/mvt/android/modules/androidqf/dumpsys_activities.py similarity index 100% rename from mvt/android/modules/androidqf/dumpsys_activities.py rename to src/mvt/android/modules/androidqf/dumpsys_activities.py diff --git a/mvt/android/modules/androidqf/dumpsys_appops.py b/src/mvt/android/modules/androidqf/dumpsys_appops.py similarity index 100% rename from mvt/android/modules/androidqf/dumpsys_appops.py rename to src/mvt/android/modules/androidqf/dumpsys_appops.py diff --git a/mvt/android/modules/androidqf/dumpsys_battery_daily.py b/src/mvt/android/modules/androidqf/dumpsys_battery_daily.py similarity index 100% rename from mvt/android/modules/androidqf/dumpsys_battery_daily.py rename to src/mvt/android/modules/androidqf/dumpsys_battery_daily.py diff --git a/mvt/android/modules/androidqf/dumpsys_battery_history.py b/src/mvt/android/modules/androidqf/dumpsys_battery_history.py similarity index 100% rename from mvt/android/modules/androidqf/dumpsys_battery_history.py rename to src/mvt/android/modules/androidqf/dumpsys_battery_history.py diff --git a/mvt/android/modules/androidqf/dumpsys_dbinfo.py b/src/mvt/android/modules/androidqf/dumpsys_dbinfo.py similarity index 100% rename from mvt/android/modules/androidqf/dumpsys_dbinfo.py rename to src/mvt/android/modules/androidqf/dumpsys_dbinfo.py diff --git a/mvt/android/modules/androidqf/dumpsys_packages.py b/src/mvt/android/modules/androidqf/dumpsys_packages.py similarity index 100% rename from mvt/android/modules/androidqf/dumpsys_packages.py rename to src/mvt/android/modules/androidqf/dumpsys_packages.py diff --git a/mvt/android/modules/androidqf/dumpsys_receivers.py b/src/mvt/android/modules/androidqf/dumpsys_receivers.py similarity index 100% rename from mvt/android/modules/androidqf/dumpsys_receivers.py rename to src/mvt/android/modules/androidqf/dumpsys_receivers.py diff --git a/mvt/android/modules/androidqf/getprop.py b/src/mvt/android/modules/androidqf/getprop.py similarity index 100% rename from mvt/android/modules/androidqf/getprop.py rename to src/mvt/android/modules/androidqf/getprop.py diff --git a/mvt/android/modules/androidqf/packages.py b/src/mvt/android/modules/androidqf/packages.py similarity index 100% rename from mvt/android/modules/androidqf/packages.py rename to src/mvt/android/modules/androidqf/packages.py diff --git a/mvt/android/modules/androidqf/processes.py b/src/mvt/android/modules/androidqf/processes.py similarity index 100% rename from mvt/android/modules/androidqf/processes.py rename to src/mvt/android/modules/androidqf/processes.py diff --git a/mvt/android/modules/androidqf/settings.py b/src/mvt/android/modules/androidqf/settings.py similarity index 100% rename from mvt/android/modules/androidqf/settings.py rename to src/mvt/android/modules/androidqf/settings.py diff --git a/mvt/android/modules/androidqf/sms.py b/src/mvt/android/modules/androidqf/sms.py similarity index 100% rename from mvt/android/modules/androidqf/sms.py rename to src/mvt/android/modules/androidqf/sms.py diff --git a/mvt/android/modules/backup/__init__.py b/src/mvt/android/modules/backup/__init__.py similarity index 100% rename from mvt/android/modules/backup/__init__.py rename to src/mvt/android/modules/backup/__init__.py diff --git a/mvt/android/modules/backup/base.py b/src/mvt/android/modules/backup/base.py similarity index 100% rename from mvt/android/modules/backup/base.py rename to src/mvt/android/modules/backup/base.py diff --git a/mvt/android/modules/backup/helpers.py b/src/mvt/android/modules/backup/helpers.py similarity index 100% rename from mvt/android/modules/backup/helpers.py rename to src/mvt/android/modules/backup/helpers.py diff --git a/mvt/android/modules/backup/sms.py b/src/mvt/android/modules/backup/sms.py similarity index 100% rename from mvt/android/modules/backup/sms.py rename to src/mvt/android/modules/backup/sms.py diff --git a/mvt/android/modules/bugreport/__init__.py b/src/mvt/android/modules/bugreport/__init__.py similarity index 100% rename from mvt/android/modules/bugreport/__init__.py rename to src/mvt/android/modules/bugreport/__init__.py diff --git a/mvt/android/modules/bugreport/accessibility.py b/src/mvt/android/modules/bugreport/accessibility.py similarity index 100% rename from mvt/android/modules/bugreport/accessibility.py rename to src/mvt/android/modules/bugreport/accessibility.py diff --git a/mvt/android/modules/bugreport/activities.py b/src/mvt/android/modules/bugreport/activities.py similarity index 100% rename from mvt/android/modules/bugreport/activities.py rename to src/mvt/android/modules/bugreport/activities.py diff --git a/mvt/android/modules/bugreport/appops.py b/src/mvt/android/modules/bugreport/appops.py similarity index 100% rename from mvt/android/modules/bugreport/appops.py rename to src/mvt/android/modules/bugreport/appops.py diff --git a/mvt/android/modules/bugreport/base.py b/src/mvt/android/modules/bugreport/base.py similarity index 100% rename from mvt/android/modules/bugreport/base.py rename to src/mvt/android/modules/bugreport/base.py diff --git a/mvt/android/modules/bugreport/battery_daily.py b/src/mvt/android/modules/bugreport/battery_daily.py similarity index 100% rename from mvt/android/modules/bugreport/battery_daily.py rename to src/mvt/android/modules/bugreport/battery_daily.py diff --git a/mvt/android/modules/bugreport/battery_history.py b/src/mvt/android/modules/bugreport/battery_history.py similarity index 100% rename from mvt/android/modules/bugreport/battery_history.py rename to src/mvt/android/modules/bugreport/battery_history.py diff --git a/mvt/android/modules/bugreport/dbinfo.py b/src/mvt/android/modules/bugreport/dbinfo.py similarity index 100% rename from mvt/android/modules/bugreport/dbinfo.py rename to src/mvt/android/modules/bugreport/dbinfo.py diff --git a/mvt/android/modules/bugreport/getprop.py b/src/mvt/android/modules/bugreport/getprop.py similarity index 100% rename from mvt/android/modules/bugreport/getprop.py rename to src/mvt/android/modules/bugreport/getprop.py diff --git a/mvt/android/modules/bugreport/packages.py b/src/mvt/android/modules/bugreport/packages.py similarity index 100% rename from mvt/android/modules/bugreport/packages.py rename to src/mvt/android/modules/bugreport/packages.py diff --git a/mvt/android/modules/bugreport/receivers.py b/src/mvt/android/modules/bugreport/receivers.py similarity index 100% rename from mvt/android/modules/bugreport/receivers.py rename to src/mvt/android/modules/bugreport/receivers.py diff --git a/mvt/android/parsers/__init__.py b/src/mvt/android/parsers/__init__.py similarity index 100% rename from mvt/android/parsers/__init__.py rename to src/mvt/android/parsers/__init__.py diff --git a/mvt/android/parsers/backup.py b/src/mvt/android/parsers/backup.py similarity index 100% rename from mvt/android/parsers/backup.py rename to src/mvt/android/parsers/backup.py diff --git a/mvt/android/utils.py b/src/mvt/android/utils.py similarity index 100% rename from mvt/android/utils.py rename to src/mvt/android/utils.py diff --git a/mvt/common/__init__.py b/src/mvt/common/__init__.py similarity index 100% rename from mvt/common/__init__.py rename to src/mvt/common/__init__.py diff --git a/mvt/common/artifact.py b/src/mvt/common/artifact.py similarity index 100% rename from mvt/common/artifact.py rename to src/mvt/common/artifact.py diff --git a/mvt/common/cmd_check_iocs.py b/src/mvt/common/cmd_check_iocs.py similarity index 100% rename from mvt/common/cmd_check_iocs.py rename to src/mvt/common/cmd_check_iocs.py diff --git a/mvt/common/command.py b/src/mvt/common/command.py similarity index 100% rename from mvt/common/command.py rename to src/mvt/common/command.py diff --git a/mvt/common/help.py b/src/mvt/common/help.py similarity index 100% rename from mvt/common/help.py rename to src/mvt/common/help.py diff --git a/mvt/common/indicators.py b/src/mvt/common/indicators.py similarity index 100% rename from mvt/common/indicators.py rename to src/mvt/common/indicators.py diff --git a/mvt/common/logo.py b/src/mvt/common/logo.py similarity index 100% rename from mvt/common/logo.py rename to src/mvt/common/logo.py diff --git a/mvt/common/module.py b/src/mvt/common/module.py similarity index 100% rename from mvt/common/module.py rename to src/mvt/common/module.py diff --git a/mvt/common/options.py b/src/mvt/common/options.py similarity index 100% rename from mvt/common/options.py rename to src/mvt/common/options.py diff --git a/mvt/common/updates.py b/src/mvt/common/updates.py similarity index 100% rename from mvt/common/updates.py rename to src/mvt/common/updates.py diff --git a/mvt/common/url.py b/src/mvt/common/url.py similarity index 100% rename from mvt/common/url.py rename to src/mvt/common/url.py diff --git a/mvt/common/utils.py b/src/mvt/common/utils.py similarity index 100% rename from mvt/common/utils.py rename to src/mvt/common/utils.py diff --git a/mvt/common/version.py b/src/mvt/common/version.py similarity index 100% rename from mvt/common/version.py rename to src/mvt/common/version.py diff --git a/mvt/common/virustotal.py b/src/mvt/common/virustotal.py similarity index 100% rename from mvt/common/virustotal.py rename to src/mvt/common/virustotal.py diff --git a/mvt/ios/__init__.py b/src/mvt/ios/__init__.py similarity index 100% rename from mvt/ios/__init__.py rename to src/mvt/ios/__init__.py diff --git a/mvt/ios/cli.py b/src/mvt/ios/cli.py similarity index 100% rename from mvt/ios/cli.py rename to src/mvt/ios/cli.py diff --git a/mvt/ios/cmd_check_backup.py b/src/mvt/ios/cmd_check_backup.py similarity index 100% rename from mvt/ios/cmd_check_backup.py rename to src/mvt/ios/cmd_check_backup.py diff --git a/mvt/ios/cmd_check_fs.py b/src/mvt/ios/cmd_check_fs.py similarity index 100% rename from mvt/ios/cmd_check_fs.py rename to src/mvt/ios/cmd_check_fs.py diff --git a/mvt/ios/data/ios_models.json b/src/mvt/ios/data/ios_models.json similarity index 100% rename from mvt/ios/data/ios_models.json rename to src/mvt/ios/data/ios_models.json diff --git a/mvt/ios/data/ios_versions.json b/src/mvt/ios/data/ios_versions.json similarity index 100% rename from mvt/ios/data/ios_versions.json rename to src/mvt/ios/data/ios_versions.json diff --git a/mvt/ios/decrypt.py b/src/mvt/ios/decrypt.py similarity index 100% rename from mvt/ios/decrypt.py rename to src/mvt/ios/decrypt.py diff --git a/mvt/ios/modules/__init__.py b/src/mvt/ios/modules/__init__.py similarity index 100% rename from mvt/ios/modules/__init__.py rename to src/mvt/ios/modules/__init__.py diff --git a/mvt/ios/modules/backup/__init__.py b/src/mvt/ios/modules/backup/__init__.py similarity index 100% rename from mvt/ios/modules/backup/__init__.py rename to src/mvt/ios/modules/backup/__init__.py diff --git a/mvt/ios/modules/backup/backup_info.py b/src/mvt/ios/modules/backup/backup_info.py similarity index 100% rename from mvt/ios/modules/backup/backup_info.py rename to src/mvt/ios/modules/backup/backup_info.py diff --git a/mvt/ios/modules/backup/configuration_profiles.py b/src/mvt/ios/modules/backup/configuration_profiles.py similarity index 100% rename from mvt/ios/modules/backup/configuration_profiles.py rename to src/mvt/ios/modules/backup/configuration_profiles.py diff --git a/mvt/ios/modules/backup/manifest.py b/src/mvt/ios/modules/backup/manifest.py similarity index 100% rename from mvt/ios/modules/backup/manifest.py rename to src/mvt/ios/modules/backup/manifest.py diff --git a/mvt/ios/modules/backup/profile_events.py b/src/mvt/ios/modules/backup/profile_events.py similarity index 100% rename from mvt/ios/modules/backup/profile_events.py rename to src/mvt/ios/modules/backup/profile_events.py diff --git a/mvt/ios/modules/base.py b/src/mvt/ios/modules/base.py similarity index 100% rename from mvt/ios/modules/base.py rename to src/mvt/ios/modules/base.py diff --git a/mvt/ios/modules/fs/__init__.py b/src/mvt/ios/modules/fs/__init__.py similarity index 100% rename from mvt/ios/modules/fs/__init__.py rename to src/mvt/ios/modules/fs/__init__.py diff --git a/mvt/ios/modules/fs/analytics.py b/src/mvt/ios/modules/fs/analytics.py similarity index 100% rename from mvt/ios/modules/fs/analytics.py rename to src/mvt/ios/modules/fs/analytics.py diff --git a/mvt/ios/modules/fs/analytics_ios_versions.py b/src/mvt/ios/modules/fs/analytics_ios_versions.py similarity index 100% rename from mvt/ios/modules/fs/analytics_ios_versions.py rename to src/mvt/ios/modules/fs/analytics_ios_versions.py diff --git a/mvt/ios/modules/fs/cache_files.py b/src/mvt/ios/modules/fs/cache_files.py similarity index 100% rename from mvt/ios/modules/fs/cache_files.py rename to src/mvt/ios/modules/fs/cache_files.py diff --git a/mvt/ios/modules/fs/filesystem.py b/src/mvt/ios/modules/fs/filesystem.py similarity index 100% rename from mvt/ios/modules/fs/filesystem.py rename to src/mvt/ios/modules/fs/filesystem.py diff --git a/mvt/ios/modules/fs/net_netusage.py b/src/mvt/ios/modules/fs/net_netusage.py similarity index 100% rename from mvt/ios/modules/fs/net_netusage.py rename to src/mvt/ios/modules/fs/net_netusage.py diff --git a/mvt/ios/modules/fs/safari_favicon.py b/src/mvt/ios/modules/fs/safari_favicon.py similarity index 100% rename from mvt/ios/modules/fs/safari_favicon.py rename to src/mvt/ios/modules/fs/safari_favicon.py diff --git a/mvt/ios/modules/fs/shutdownlog.py b/src/mvt/ios/modules/fs/shutdownlog.py similarity index 100% rename from mvt/ios/modules/fs/shutdownlog.py rename to src/mvt/ios/modules/fs/shutdownlog.py diff --git a/mvt/ios/modules/fs/version_history.py b/src/mvt/ios/modules/fs/version_history.py similarity index 100% rename from mvt/ios/modules/fs/version_history.py rename to src/mvt/ios/modules/fs/version_history.py diff --git a/mvt/ios/modules/fs/webkit_base.py b/src/mvt/ios/modules/fs/webkit_base.py similarity index 100% rename from mvt/ios/modules/fs/webkit_base.py rename to src/mvt/ios/modules/fs/webkit_base.py diff --git a/mvt/ios/modules/fs/webkit_indexeddb.py b/src/mvt/ios/modules/fs/webkit_indexeddb.py similarity index 100% rename from mvt/ios/modules/fs/webkit_indexeddb.py rename to src/mvt/ios/modules/fs/webkit_indexeddb.py diff --git a/mvt/ios/modules/fs/webkit_localstorage.py b/src/mvt/ios/modules/fs/webkit_localstorage.py similarity index 100% rename from mvt/ios/modules/fs/webkit_localstorage.py rename to src/mvt/ios/modules/fs/webkit_localstorage.py diff --git a/mvt/ios/modules/fs/webkit_safariviewservice.py b/src/mvt/ios/modules/fs/webkit_safariviewservice.py similarity index 100% rename from mvt/ios/modules/fs/webkit_safariviewservice.py rename to src/mvt/ios/modules/fs/webkit_safariviewservice.py diff --git a/mvt/ios/modules/mixed/__init__.py b/src/mvt/ios/modules/mixed/__init__.py similarity index 100% rename from mvt/ios/modules/mixed/__init__.py rename to src/mvt/ios/modules/mixed/__init__.py diff --git a/mvt/ios/modules/mixed/applications.py b/src/mvt/ios/modules/mixed/applications.py similarity index 100% rename from mvt/ios/modules/mixed/applications.py rename to src/mvt/ios/modules/mixed/applications.py diff --git a/mvt/ios/modules/mixed/calendar.py b/src/mvt/ios/modules/mixed/calendar.py similarity index 100% rename from mvt/ios/modules/mixed/calendar.py rename to src/mvt/ios/modules/mixed/calendar.py diff --git a/mvt/ios/modules/mixed/calls.py b/src/mvt/ios/modules/mixed/calls.py similarity index 100% rename from mvt/ios/modules/mixed/calls.py rename to src/mvt/ios/modules/mixed/calls.py diff --git a/mvt/ios/modules/mixed/chrome_favicon.py b/src/mvt/ios/modules/mixed/chrome_favicon.py similarity index 100% rename from mvt/ios/modules/mixed/chrome_favicon.py rename to src/mvt/ios/modules/mixed/chrome_favicon.py diff --git a/mvt/ios/modules/mixed/chrome_history.py b/src/mvt/ios/modules/mixed/chrome_history.py similarity index 100% rename from mvt/ios/modules/mixed/chrome_history.py rename to src/mvt/ios/modules/mixed/chrome_history.py diff --git a/mvt/ios/modules/mixed/contacts.py b/src/mvt/ios/modules/mixed/contacts.py similarity index 100% rename from mvt/ios/modules/mixed/contacts.py rename to src/mvt/ios/modules/mixed/contacts.py diff --git a/mvt/ios/modules/mixed/firefox_favicon.py b/src/mvt/ios/modules/mixed/firefox_favicon.py similarity index 100% rename from mvt/ios/modules/mixed/firefox_favicon.py rename to src/mvt/ios/modules/mixed/firefox_favicon.py diff --git a/mvt/ios/modules/mixed/firefox_history.py b/src/mvt/ios/modules/mixed/firefox_history.py similarity index 100% rename from mvt/ios/modules/mixed/firefox_history.py rename to src/mvt/ios/modules/mixed/firefox_history.py diff --git a/mvt/ios/modules/mixed/global_preferences.py b/src/mvt/ios/modules/mixed/global_preferences.py similarity index 100% rename from mvt/ios/modules/mixed/global_preferences.py rename to src/mvt/ios/modules/mixed/global_preferences.py diff --git a/mvt/ios/modules/mixed/idstatuscache.py b/src/mvt/ios/modules/mixed/idstatuscache.py similarity index 100% rename from mvt/ios/modules/mixed/idstatuscache.py rename to src/mvt/ios/modules/mixed/idstatuscache.py diff --git a/mvt/ios/modules/mixed/interactionc.py b/src/mvt/ios/modules/mixed/interactionc.py similarity index 100% rename from mvt/ios/modules/mixed/interactionc.py rename to src/mvt/ios/modules/mixed/interactionc.py diff --git a/mvt/ios/modules/mixed/locationd.py b/src/mvt/ios/modules/mixed/locationd.py similarity index 100% rename from mvt/ios/modules/mixed/locationd.py rename to src/mvt/ios/modules/mixed/locationd.py diff --git a/mvt/ios/modules/mixed/net_datausage.py b/src/mvt/ios/modules/mixed/net_datausage.py similarity index 100% rename from mvt/ios/modules/mixed/net_datausage.py rename to src/mvt/ios/modules/mixed/net_datausage.py diff --git a/mvt/ios/modules/mixed/osanalytics_addaily.py b/src/mvt/ios/modules/mixed/osanalytics_addaily.py similarity index 100% rename from mvt/ios/modules/mixed/osanalytics_addaily.py rename to src/mvt/ios/modules/mixed/osanalytics_addaily.py diff --git a/mvt/ios/modules/mixed/safari_browserstate.py b/src/mvt/ios/modules/mixed/safari_browserstate.py similarity index 100% rename from mvt/ios/modules/mixed/safari_browserstate.py rename to src/mvt/ios/modules/mixed/safari_browserstate.py diff --git a/mvt/ios/modules/mixed/safari_history.py b/src/mvt/ios/modules/mixed/safari_history.py similarity index 100% rename from mvt/ios/modules/mixed/safari_history.py rename to src/mvt/ios/modules/mixed/safari_history.py diff --git a/mvt/ios/modules/mixed/shortcuts.py b/src/mvt/ios/modules/mixed/shortcuts.py similarity index 100% rename from mvt/ios/modules/mixed/shortcuts.py rename to src/mvt/ios/modules/mixed/shortcuts.py diff --git a/mvt/ios/modules/mixed/sms.py b/src/mvt/ios/modules/mixed/sms.py similarity index 100% rename from mvt/ios/modules/mixed/sms.py rename to src/mvt/ios/modules/mixed/sms.py diff --git a/mvt/ios/modules/mixed/sms_attachments.py b/src/mvt/ios/modules/mixed/sms_attachments.py similarity index 100% rename from mvt/ios/modules/mixed/sms_attachments.py rename to src/mvt/ios/modules/mixed/sms_attachments.py diff --git a/mvt/ios/modules/mixed/tcc.py b/src/mvt/ios/modules/mixed/tcc.py similarity index 100% rename from mvt/ios/modules/mixed/tcc.py rename to src/mvt/ios/modules/mixed/tcc.py diff --git a/mvt/ios/modules/mixed/webkit_resource_load_statistics.py b/src/mvt/ios/modules/mixed/webkit_resource_load_statistics.py similarity index 100% rename from mvt/ios/modules/mixed/webkit_resource_load_statistics.py rename to src/mvt/ios/modules/mixed/webkit_resource_load_statistics.py diff --git a/mvt/ios/modules/mixed/webkit_session_resource_log.py b/src/mvt/ios/modules/mixed/webkit_session_resource_log.py similarity index 100% rename from mvt/ios/modules/mixed/webkit_session_resource_log.py rename to src/mvt/ios/modules/mixed/webkit_session_resource_log.py diff --git a/mvt/ios/modules/mixed/whatsapp.py b/src/mvt/ios/modules/mixed/whatsapp.py similarity index 100% rename from mvt/ios/modules/mixed/whatsapp.py rename to src/mvt/ios/modules/mixed/whatsapp.py diff --git a/mvt/ios/modules/net_base.py b/src/mvt/ios/modules/net_base.py similarity index 100% rename from mvt/ios/modules/net_base.py rename to src/mvt/ios/modules/net_base.py diff --git a/mvt/ios/versions.py b/src/mvt/ios/versions.py similarity index 100% rename from mvt/ios/versions.py rename to src/mvt/ios/versions.py diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 000000000..75af20349 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,8 @@ +requests>=2.31.0 +pytest>=7.4.3 +pytest-cov>=4.1.0 +pytest-github-actions-annotate-failures>=0.2.0 +pytest-mock>=3.14.0 +stix2>=3.0.1 +ruff>=0.1.6 +mypy>=1.7.1 From 69fb8c236f69afcd9a0165b809ad35147828ed41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donncha=20=C3=93=20Cearbhaill?= Date: Mon, 30 Sep 2024 12:39:21 +0200 Subject: [PATCH 2/8] Simplify the CI tests using the Makefile --- .github/workflows/black.yml | 16 ---------------- .github/workflows/mypy.yml | 27 +++++++++++++++++++++++++++ .github/workflows/ruff.yml | 18 +++++++++++------- .github/workflows/tests.yml | 29 +++++++++++++++++++++++++++++ dev/mvt-android | 14 -------------- dev/mvt-ios | 14 -------------- scripts/lint.sh | 14 -------------- 7 files changed, 67 insertions(+), 65 deletions(-) delete mode 100644 .github/workflows/black.yml create mode 100644 .github/workflows/mypy.yml create mode 100644 .github/workflows/tests.yml delete mode 100755 dev/mvt-android delete mode 100755 dev/mvt-ios delete mode 100755 scripts/lint.sh diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml deleted file mode 100644 index 5b3c345de..000000000 --- a/.github/workflows/black.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Black - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - black: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: psf/black@stable - with: - options: "--check" diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml new file mode 100644 index 000000000..22ea66cad --- /dev/null +++ b/.github/workflows/mypy.yml @@ -0,0 +1,27 @@ +name: Mypy +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + mypy_py3: + name: Mypy check + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: 3.9 + cache: 'pip' + - name: Checkout + uses: actions/checkout@master + - name: Install Dependencies + run: | + pip install mypy + - name: mypy + run: | + make mypy diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml index 72c8fc4ff..7c8be9e92 100644 --- a/.github/workflows/ruff.yml +++ b/.github/workflows/ruff.yml @@ -1,19 +1,23 @@ name: Ruff -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] +on: [push] + jobs: ruff_py3: name: Ruff syntax check runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: 3.9 + cache: 'pip' - name: Checkout uses: actions/checkout@master - name: Install Dependencies run: | - pip install --user ruff + pip install ruff - name: ruff run: | - ruff check --output-format github . + make ruff diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 000000000..920f896a3 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,29 @@ +name: Tests +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + name: Run Python Tests + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ['3.8', '3.9', '3.10'] # , '3.11'] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install Python dependencies + run: | + make install + make test-requirements + - name: Test with pytest + run: | + make test-ci diff --git a/dev/mvt-android b/dev/mvt-android deleted file mode 100755 index 39ec7a728..000000000 --- a/dev/mvt-android +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python3 -# Mobile Verification Toolkit (MVT) -# Copyright (c) 2021-2022 Claudio Guarnieri. -# Use of this software is governed by the MVT License 1.1 that can be found at -# https://license.mvt.re/1.1/ - -import os -import sys - -sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) - -from mvt import android - -android.cli() diff --git a/dev/mvt-ios b/dev/mvt-ios deleted file mode 100755 index 8a467d82e..000000000 --- a/dev/mvt-ios +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python3 -# Mobile Verification Toolkit (MVT) -# Copyright (c) 2021-2022 Claudio Guarnieri. -# Use of this software is governed by the MVT License 1.1 that can be found at -# https://license.mvt.re/1.1/ - -import os -import sys - -sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) - -from mvt import ios - -ios.cli() diff --git a/scripts/lint.sh b/scripts/lint.sh deleted file mode 100755 index 7e767398a..000000000 --- a/scripts/lint.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -e - -export SOURCE="mvt tests" - -export PREFIX="" -if [ -d 'venv' ] ; then - export PREFIX="venv/bin/" -fi - -set -x - -${PREFIX}autoflake --in-place --recursive --exclude venv ${SOURCE} -${PREFIX}isort ${SOURCE} -${PREFIX}black --exclude venv ${SOURCE} From 822536a1cb59cebe6e0b02a17ed58b3789f0ca18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donncha=20=C3=93=20Cearbhaill?= Date: Mon, 30 Sep 2024 12:40:15 +0200 Subject: [PATCH 3/8] Add formating change made by ruff linter --- pyproject.toml | 1 - src/mvt/ios/modules/mixed/webkit_resource_load_statistics.py | 4 +++- tests/conftest.py | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9b0229de5..16ac8f6d7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -92,7 +92,6 @@ max-complexity = 10 include-package-data = true package-dir = {"" = "src"} - [tool.setuptools.packages.find] where = ["src"] diff --git a/src/mvt/ios/modules/mixed/webkit_resource_load_statistics.py b/src/mvt/ios/modules/mixed/webkit_resource_load_statistics.py index f5beec6a6..06cf527f5 100644 --- a/src/mvt/ios/modules/mixed/webkit_resource_load_statistics.py +++ b/src/mvt/ios/modules/mixed/webkit_resource_load_statistics.py @@ -12,7 +12,9 @@ from ..base import IOSExtraction -WEBKIT_RESOURCELOADSTATICS_BACKUP_RELPATH = "Library/WebKit/WebsiteData/ResourceLoadStatistics/observations.db" # pylint: disable=line-too-long +WEBKIT_RESOURCELOADSTATICS_BACKUP_RELPATH = ( + "Library/WebKit/WebsiteData/ResourceLoadStatistics/observations.db" # pylint: disable=line-too-long +) WEBKIT_RESOURCELOADSTATICS_ROOT_PATHS = [ "private/var/mobile/Containers/Data/Application/*/Library/WebKit/WebsiteData/ResourceLoadStatistics/observations.db", # pylint: disable=line-too-long "private/var/mobile/Containers/Data/Application/*/SystemData/com.apple.SafariViewService/Library/WebKit/WebsiteData/observations.db", # pylint: disable=line-too-long diff --git a/tests/conftest.py b/tests/conftest.py index 16e5f37ae..3e564c2a7 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -40,7 +40,6 @@ def f( android_property_names=[], files_sha256=[], ): - ind = Indicators(log=logging.getLogger()) ind.parse_stix2(indicator_file) From f79938b0829499a602c8a36ce542baf9dd4351e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donncha=20=C3=93=20Cearbhaill?= Date: Mon, 30 Sep 2024 12:44:21 +0200 Subject: [PATCH 4/8] Run ruff on PRs --- .github/workflows/ruff.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml index 7c8be9e92..55ce442f8 100644 --- a/.github/workflows/ruff.yml +++ b/.github/workflows/ruff.yml @@ -1,5 +1,9 @@ name: Ruff -on: [push] +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] jobs: ruff_py3: From 79dd5b8bad6d1512f768af7dfb9ede3c08a5ba3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donncha=20=C3=93=20Cearbhaill?= Date: Mon, 30 Sep 2024 12:53:17 +0200 Subject: [PATCH 5/8] Temporarily disable automatic type checks in CI MyPy checks should be renabled once the types are fixed in https://github.com/mvt-project/mvt/issues/545 --- .github/workflows/mypy.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 22ea66cad..321ffc953 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -1,9 +1,5 @@ name: Mypy -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] +on: workflow_dispatch jobs: mypy_py3: From 656feb1da76ad4b82fadd8ad6a1e320b9b9909f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donncha=20=C3=93=20Cearbhaill?= Date: Mon, 30 Sep 2024 13:11:21 +0200 Subject: [PATCH 6/8] Try make sure pytest uses the local editable install --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 0d4d8ccc8..66ca10cdf 100644 --- a/Makefile +++ b/Makefile @@ -14,10 +14,10 @@ mypy: mypy test: - pytest + python3 -m pytest test-ci: - pytest -v + python3 -m pytest -v install: python3 -m pip install --upgrade -e . From 2c4c92f510c008c747bd11792688e69c048c0084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donncha=20=C3=93=20Cearbhaill?= Date: Mon, 30 Sep 2024 13:21:02 +0200 Subject: [PATCH 7/8] Try using package name as path --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 16ac8f6d7..9e7fe0ea8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,7 +62,7 @@ ignore_missing_imports = true packages = "src" [tool.pytest.ini_options] -addopts = "-ra -q --cov=./src/mvt --cov-report html" +addopts = "-ra -q --cov=mvt --cov-report html" testpaths = [ "tests" ] From 5225600396de334da4e9eb928c6b222b9ffed871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donncha=20=C3=93=20Cearbhaill?= Date: Mon, 30 Sep 2024 13:34:56 +0200 Subject: [PATCH 8/8] Remove duplicate CI file --- .github/workflows/python-package.yml | 52 ---------------------------- .github/workflows/tests.yml | 11 +++++- pyproject.toml | 2 +- 3 files changed, 11 insertions(+), 54 deletions(-) delete mode 100644 .github/workflows/python-package.yml diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml deleted file mode 100644 index 0df64366a..000000000 --- a/.github/workflows/python-package.yml +++ /dev/null @@ -1,52 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - -name: CI - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: ['3.8', '3.9', '3.10'] # , '3.11'] - - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade setuptools - python -m pip install --upgrade pip - python -m pip install flake8 pytest safety stix2 pytest-mock pytest-cov - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - python -m pip install . - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Safety checks - run: safety check - - name: Test with pytest and coverage - run: | - set -o pipefail - pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=mvt tests/ | tee pytest-coverage.txt - - name: Pytest coverage comment - continue-on-error: true # Workflows running on a fork can't post comments - uses: MishaKav/pytest-coverage-comment@main - if: github.event_name == 'pull_request' - with: - pytest-coverage-path: ./pytest-coverage.txt - junitxml-path: ./pytest.xml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 920f896a3..08e2d8403 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -26,4 +26,13 @@ jobs: make test-requirements - name: Test with pytest run: | - make test-ci + set -o pipefail + make test-ci | tee pytest-coverage.txt + + - name: Pytest coverage comment + continue-on-error: true # Workflows running on a fork can't post comments + uses: MishaKav/pytest-coverage-comment@main + if: github.event_name == 'pull_request' + with: + pytest-coverage-path: ./pytest-coverage.txt + junitxml-path: ./pytest.xml \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 9e7fe0ea8..79f67886c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,7 +62,7 @@ ignore_missing_imports = true packages = "src" [tool.pytest.ini_options] -addopts = "-ra -q --cov=mvt --cov-report html" +addopts = "-ra -q --cov=mvt --cov-report html --junitxml=pytest.xml --cov-report=term-missing:skip-covered" testpaths = [ "tests" ]