diff --git a/debian/control b/debian/control index 8805955..117e1c7 100644 --- a/debian/control +++ b/debian/control @@ -30,7 +30,7 @@ python3-marshmallow-sqlalchemy (>= 0.26.0), python3-mock, python3-mockito (>= 1.2.2-2), - python3-nplusone, + python3-nplusone (>= 1.0.0-0kali4), python3-pil, python3-pyotp, python3-pytest, @@ -62,6 +62,7 @@ postgresql, python3-distutils, python3-faraday-plugins (>= 1.4.5), + python3-nplusone (>= 1.0.0-0kali4), python3-sqlalchemy-schemadisplay, python3-tornado, python3-webargs (>= 7.0.0), diff --git a/debian/patches/Add-vendor-in-path.patch b/debian/patches/Add-vendor-in-path.patch new file mode 100644 index 0000000..9271377 --- /dev/null +++ b/debian/patches/Add-vendor-in-path.patch @@ -0,0 +1,53 @@ +From: Sophie Brun +Date: Mon, 6 Dec 2021 17:30:46 +0100 +Subject: Add usr/lib/python3/dist-packages/faraday/vendor in import path + + +Last-Update: 2021-12-07 +Add usr/lib/python3/dist-packages/faraday/vendor in PYTHONPATH to use +the embedded version instead of the packages version of SQLalchemy. +--- + faraday/manage.py | 2 ++ + faraday/searcher/searcher.py | 2 ++ + faraday/start_server.py | 2 ++ + 3 files changed, 6 insertions(+) + +diff --git a/faraday/manage.py b/faraday/manage.py +index c3458aa..05c8ddc 100755 +--- a/faraday/manage.py ++++ b/faraday/manage.py +@@ -29,6 +29,8 @@ if platform.system() == "Linux": + except KeyError: + pass + ++sys.path.insert(1, '/usr/lib/python3/dist-packages/faraday/vendor') ++ + # pgcli is not installed like a Python module in Debian. Add pgcli path in + # python path + sys.path.append("/usr/share/pgcli") +diff --git a/faraday/searcher/searcher.py b/faraday/searcher/searcher.py +index 4ebcef8..f88dc58 100755 +--- a/faraday/searcher/searcher.py ++++ b/faraday/searcher/searcher.py +@@ -23,6 +23,8 @@ from pathlib import Path + import click + import requests + ++sys.path.insert(1, '/usr/lib/python3/dist-packages/faraday/vendor') ++ + from faraday.searcher.api import Api + from faraday.searcher.validator import validate_rules + from faraday.server.models import Service, Host +diff --git a/faraday/start_server.py b/faraday/start_server.py +index 4ab2c68..a29b855 100644 +--- a/faraday/start_server.py ++++ b/faraday/start_server.py +@@ -7,6 +7,8 @@ import socket + import argparse + import logging + ++sys.path.insert(1, '/usr/lib/python3/dist-packages/faraday/vendor') ++ + import psycopg2 + from alembic.runtime.migration import MigrationContext + diff --git a/debian/patches/Remove-sqlalchemy-requirement.patch b/debian/patches/Remove-sqlalchemy-requirement.patch new file mode 100644 index 0000000..8c2c480 --- /dev/null +++ b/debian/patches/Remove-sqlalchemy-requirement.patch @@ -0,0 +1,26 @@ +From: Sophie Brun +Date: Tue, 7 Dec 2021 10:56:02 +0100 +Subject: Remove sqlalchemy requirement + + +Last-Update: 2021-12-07 +dh_python generates automatically the Python dependencies with version +restrictions. Remove sqlalchemy from the requirements to allow +co-instalation of faraday and recent versions of python3-sqlalchemy. +--- + requirements.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/requirements.txt b/requirements.txt +index 8420bf7..49e6ca6 100644 +--- a/requirements.txt ++++ b/requirements.txt +@@ -21,7 +21,7 @@ python-dateutil>=2.6.0 + requests>=2.18.4 + pyasn1 + service_identity>=17.0.0 +-SQLAlchemy>=1.2.0,<1.4.0 ++#SQLAlchemy>=1.2.0,<1.4.0 + tqdm>=4.15.0 + twisted>=18.9.0 + webargs>=7.0.0 diff --git a/debian/patches/series b/debian/patches/series index ba81a39..72ea07c 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -4,3 +4,5 @@ Remove-failing-tests.patch change-path-to-server-www.patch create-logs-dir.patch +Remove-sqlalchemy-requirement.patch +Add-vendor-in-path.patch diff --git a/debian/rules b/debian/rules index eb53ad5..d4b5951 100755 --- a/debian/rules +++ b/debian/rules @@ -4,6 +4,7 @@ #export DH_VERBOSE = 1 export PYBUILD_TEST_ARGS=-k "not TestGetExploits and not test_update_command and not test_start_and_kill_faraday_server and not test_create_agent_without_name_fails and not test_create_agent_invalid_payload and not test_vuln_filter_exception and not test_vuln_restless_sort_by_ and not test_vuln_web_filter_exception and not test_filter_by_creator_command_id and not test_openapi_format and not test_filter_by_querystring and not test_websocket_BroadcastServerProtocol and not test_vuln_filter and not test_yaml_docs_with_no_doc and not test_yaml_docs_with_defaults and not test_tags_sorted_correctly" +#export PYBUILD_DISABLE=test %: dh $@ --with python3,sphinxdoc --buildsystem=pybuild @@ -17,6 +18,11 @@ # remove unwanted files: .gitignore and useless README rm debian/faraday/usr/lib/python3*/dist-packages/faraday/migrations/versions/.gitignore rm debian/faraday/usr/lib/python3*/dist-packages/faraday/migrations/README + # copy vendor to embed sqlalchemy + cp -r debian/vendor debian/faraday/usr/lib/python3*/dist-packages/faraday/ override_dh_installchangelogs: dh_installchangelogs RELEASE.md + +override_dh_auto_test: + export PYTHONPATH=$(CURDIR)/debian/vendor:$(PYTHONPATH) && dh_auto_test