From 126c1c6852341fbb042ea688f01a7c4ed2fdc589 Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 18 Oct 2024 15:58:45 -0400 Subject: [PATCH 01/80] enable manual trigger --- .github/workflows/docs_updater.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docs_updater.yml b/.github/workflows/docs_updater.yml index fdc585718..2a722e22b 100644 --- a/.github/workflows/docs_updater.yml +++ b/.github/workflows/docs_updater.yml @@ -2,7 +2,8 @@ name: Daily Docs Update on: schedule: - - cron: '0 0 * * *' # Runs daily at midnight UTC + - cron: '30 2 * * *' # Runs daily at 2:30 AM UTC, a less congested time + workflow_dispatch: # Allows manual triggering of the workflow jobs: update_docs: From f2b70ce6186e9cc2a740cfcfefddebc9a64ecc9a Mon Sep 17 00:00:00 2001 From: blsaccess Date: Sun, 20 Oct 2024 00:24:52 +0000 Subject: [PATCH 02/80] Update nuclei --- bbot/modules/deadly/nuclei.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bbot/modules/deadly/nuclei.py b/bbot/modules/deadly/nuclei.py index 506db6f0e..1eb10cb23 100644 --- a/bbot/modules/deadly/nuclei.py +++ b/bbot/modules/deadly/nuclei.py @@ -15,7 +15,7 @@ class nuclei(BaseModule): } options = { - "version": "3.3.4", + "version": "3.3.5", "tags": "", "templates": "", "severity": "", From 2c0ebb61d656aa0873688a13670f3f9341f1842e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Oct 2024 04:27:03 +0000 Subject: [PATCH 03/80] Bump pytest-asyncio from 0.23.8 to 0.24.0 Bumps [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) from 0.23.8 to 0.24.0. - [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases) - [Commits](https://github.com/pytest-dev/pytest-asyncio/compare/v0.23.8...v0.24.0) --- updated-dependencies: - dependency-name: pytest-asyncio dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- poetry.lock | 10 +++++----- pyproject.toml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/poetry.lock b/poetry.lock index 6e6dd87f1..9eb40d969 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1967,17 +1967,17 @@ dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments [[package]] name = "pytest-asyncio" -version = "0.23.8" +version = "0.24.0" description = "Pytest support for asyncio" optional = false python-versions = ">=3.8" files = [ - {file = "pytest_asyncio-0.23.8-py3-none-any.whl", hash = "sha256:50265d892689a5faefb84df80819d1ecef566eb3549cf915dfb33569359d1ce2"}, - {file = "pytest_asyncio-0.23.8.tar.gz", hash = "sha256:759b10b33a6dc61cce40a8bd5205e302978bbbcc00e279a8b61d9a6a3c82e4d3"}, + {file = "pytest_asyncio-0.24.0-py3-none-any.whl", hash = "sha256:a811296ed596b69bf0b6f3dc40f83bcaf341b155a269052d82efa2b25ac7037b"}, + {file = "pytest_asyncio-0.24.0.tar.gz", hash = "sha256:d081d828e576d85f875399194281e92bf8a68d60d72d1a2faf2feddb6c46b276"}, ] [package.dependencies] -pytest = ">=7.0.0,<9" +pytest = ">=8.2,<9" [package.extras] docs = ["sphinx (>=5.3)", "sphinx-rtd-theme (>=1.0)"] @@ -3077,4 +3077,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "056fa05ead5abab1767c7c410539a4536659d1b6420bd13375aab965f98e326e" +content-hash = "675128279862686c6c3e85d2ee2889772250bb7896458e15cbf5005bcf7f0578" diff --git a/pyproject.toml b/pyproject.toml index 9158de2cc..bc7aea30d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -70,7 +70,7 @@ pytest-timeout = "^2.3.1" pytest-httpx = "^0.30.0" pytest-httpserver = "^1.0.11" pytest = "^8.3.1" -pytest-asyncio = "0.23.8" +pytest-asyncio = "0.24.0" [tool.poetry.group.docs.dependencies] mkdocs = "^1.5.2" From f76e688ef18e0fe00a7a5ce0fe2fc545b62a1139 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Oct 2024 04:27:58 +0000 Subject: [PATCH 04/80] Bump mkdocs-material from 9.5.41 to 9.5.42 Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.5.41 to 9.5.42. - [Release notes](https://github.com/squidfunk/mkdocs-material/releases) - [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG) - [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.5.41...9.5.42) --- updated-dependencies: - dependency-name: mkdocs-material dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index 6e6dd87f1..736174438 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1278,13 +1278,13 @@ pyyaml = ">=5.1" [[package]] name = "mkdocs-material" -version = "9.5.41" +version = "9.5.42" description = "Documentation that simply works" optional = false python-versions = ">=3.8" files = [ - {file = "mkdocs_material-9.5.41-py3-none-any.whl", hash = "sha256:990bc138c33342b5b73e7545915ebc0136e501bfbd8e365735144f5120891d83"}, - {file = "mkdocs_material-9.5.41.tar.gz", hash = "sha256:30fa5d459b4b8130848ecd8e1c908878345d9d8268f7ddbc31eebe88d462d97b"}, + {file = "mkdocs_material-9.5.42-py3-none-any.whl", hash = "sha256:452a7c5d21284b373f36b981a2cbebfff59263feebeede1bc28652e9c5bbe316"}, + {file = "mkdocs_material-9.5.42.tar.gz", hash = "sha256:92779b5e9b5934540c574c11647131d217dc540dce72b05feeda088c8eb1b8f2"}, ] [package.dependencies] From ec67fa40328815bc6a614e8ebfae431c5d3ad64a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Oct 2024 04:28:28 +0000 Subject: [PATCH 05/80] Bump xmltojson from 2.0.2 to 2.0.3 Bumps [xmltojson](https://github.com/shanahanjrs/xmltojson) from 2.0.2 to 2.0.3. - [Commits](https://github.com/shanahanjrs/xmltojson/commits) --- updated-dependencies: - dependency-name: xmltojson dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- poetry.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/poetry.lock b/poetry.lock index 6e6dd87f1..da82e2380 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2943,28 +2943,28 @@ files = [ [[package]] name = "xmltodict" -version = "0.12.0" +version = "0.14.2" description = "Makes working with XML feel like you are working with JSON" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +python-versions = ">=3.6" files = [ - {file = "xmltodict-0.12.0-py2.py3-none-any.whl", hash = "sha256:8bbcb45cc982f48b2ca8fe7e7827c5d792f217ecf1792626f808bf41c3b86051"}, - {file = "xmltodict-0.12.0.tar.gz", hash = "sha256:50d8c638ed7ecb88d90561beedbf720c9b4e851a9fa6c47ebd64e99d166d8a21"}, + {file = "xmltodict-0.14.2-py2.py3-none-any.whl", hash = "sha256:20cc7d723ed729276e808f26fb6b3599f786cbc37e06c65e192ba77c40f20aac"}, + {file = "xmltodict-0.14.2.tar.gz", hash = "sha256:201e7c28bb210e374999d1dde6382923ab0ed1a8a5faeece48ab525b7810a553"}, ] [[package]] name = "xmltojson" -version = "2.0.2" +version = "2.0.3" description = "A Python module and cli tool to quickly convert xml text or files into json" optional = false -python-versions = ">=3.7,<4.0" +python-versions = "<4.0,>=3.7" files = [ - {file = "xmltojson-2.0.2-py3-none-any.whl", hash = "sha256:8ba5c8b33a5a0f824ad754ed62367d841ce91f7deaf82e118c28e42a0e24454c"}, - {file = "xmltojson-2.0.2.tar.gz", hash = "sha256:10719660409bd1825507e04d2fa4848c10591a092613bcd66651c7e0774f5405"}, + {file = "xmltojson-2.0.3-py3-none-any.whl", hash = "sha256:1b68519bd14fbf3e28baa630b8c9116b5d3aa8976648f277a78ae3448498889a"}, + {file = "xmltojson-2.0.3.tar.gz", hash = "sha256:68a0022272adf70b8f2639186172c808e9502cd03c0b851a65e0760561c7801d"}, ] [package.dependencies] -xmltodict = ">=0.12.0,<0.13.0" +xmltodict = "0.14.2" [[package]] name = "yara-python" From 6a5303dd1085aa7e3e13d712c9b5472b6f51b4b6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Oct 2024 04:28:46 +0000 Subject: [PATCH 06/80] Bump mkdocstrings-python from 1.12.1 to 1.12.2 Bumps [mkdocstrings-python](https://github.com/mkdocstrings/python) from 1.12.1 to 1.12.2. - [Release notes](https://github.com/mkdocstrings/python/releases) - [Changelog](https://github.com/mkdocstrings/python/blob/main/CHANGELOG.md) - [Commits](https://github.com/mkdocstrings/python/compare/1.12.1...1.12.2) --- updated-dependencies: - dependency-name: mkdocstrings-python dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index 6e6dd87f1..6cb8b0eb6 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1346,13 +1346,13 @@ python-legacy = ["mkdocstrings-python-legacy (>=0.2.1)"] [[package]] name = "mkdocstrings-python" -version = "1.12.1" +version = "1.12.2" description = "A Python handler for mkdocstrings." optional = false python-versions = ">=3.9" files = [ - {file = "mkdocstrings_python-1.12.1-py3-none-any.whl", hash = "sha256:205244488199c9aa2a39787ad6a0c862d39b74078ea9aa2be817bc972399563f"}, - {file = "mkdocstrings_python-1.12.1.tar.gz", hash = "sha256:60d6a5ca912c9af4ad431db6d0111ce9f79c6c48d33377dde6a05a8f5f48d792"}, + {file = "mkdocstrings_python-1.12.2-py3-none-any.whl", hash = "sha256:7f7d40d6db3cb1f5d19dbcd80e3efe4d0ba32b073272c0c0de9de2e604eda62a"}, + {file = "mkdocstrings_python-1.12.2.tar.gz", hash = "sha256:7a1760941c0b52a2cd87b960a9e21112ffe52e7df9d0b9583d04d47ed2e186f3"}, ] [package.dependencies] From 9dc05bb2558e3763da7adcbd4968ab55e0567c71 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Oct 2024 13:53:33 +0000 Subject: [PATCH 07/80] Bump psutil from 5.9.8 to 6.1.0 Bumps [psutil](https://github.com/giampaolo/psutil) from 5.9.8 to 6.1.0. - [Changelog](https://github.com/giampaolo/psutil/blob/master/HISTORY.rst) - [Commits](https://github.com/giampaolo/psutil/compare/release-5.9.8...release-6.1.0) --- updated-dependencies: - dependency-name: psutil dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- poetry.lock | 44 +++++++++++++++++++++++--------------------- pyproject.toml | 2 +- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/poetry.lock b/poetry.lock index dd25a45a4..8da0a4305 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1645,31 +1645,33 @@ virtualenv = ">=20.10.0" [[package]] name = "psutil" -version = "5.9.8" +version = "6.1.0" description = "Cross-platform lib for process and system monitoring in Python." optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" -files = [ - {file = "psutil-5.9.8-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:26bd09967ae00920df88e0352a91cff1a78f8d69b3ecabbfe733610c0af486c8"}, - {file = "psutil-5.9.8-cp27-cp27m-manylinux2010_i686.whl", hash = "sha256:05806de88103b25903dff19bb6692bd2e714ccf9e668d050d144012055cbca73"}, - {file = "psutil-5.9.8-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:611052c4bc70432ec770d5d54f64206aa7203a101ec273a0cd82418c86503bb7"}, - {file = "psutil-5.9.8-cp27-cp27mu-manylinux2010_i686.whl", hash = "sha256:50187900d73c1381ba1454cf40308c2bf6f34268518b3f36a9b663ca87e65e36"}, - {file = "psutil-5.9.8-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:02615ed8c5ea222323408ceba16c60e99c3f91639b07da6373fb7e6539abc56d"}, - {file = "psutil-5.9.8-cp27-none-win32.whl", hash = "sha256:36f435891adb138ed3c9e58c6af3e2e6ca9ac2f365efe1f9cfef2794e6c93b4e"}, - {file = "psutil-5.9.8-cp27-none-win_amd64.whl", hash = "sha256:bd1184ceb3f87651a67b2708d4c3338e9b10c5df903f2e3776b62303b26cb631"}, - {file = "psutil-5.9.8-cp36-abi3-macosx_10_9_x86_64.whl", hash = "sha256:aee678c8720623dc456fa20659af736241f575d79429a0e5e9cf88ae0605cc81"}, - {file = "psutil-5.9.8-cp36-abi3-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8cb6403ce6d8e047495a701dc7c5bd788add903f8986d523e3e20b98b733e421"}, - {file = "psutil-5.9.8-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d06016f7f8625a1825ba3732081d77c94589dca78b7a3fc072194851e88461a4"}, - {file = "psutil-5.9.8-cp36-cp36m-win32.whl", hash = "sha256:7d79560ad97af658a0f6adfef8b834b53f64746d45b403f225b85c5c2c140eee"}, - {file = "psutil-5.9.8-cp36-cp36m-win_amd64.whl", hash = "sha256:27cc40c3493bb10de1be4b3f07cae4c010ce715290a5be22b98493509c6299e2"}, - {file = "psutil-5.9.8-cp37-abi3-win32.whl", hash = "sha256:bc56c2a1b0d15aa3eaa5a60c9f3f8e3e565303b465dbf57a1b730e7a2b9844e0"}, - {file = "psutil-5.9.8-cp37-abi3-win_amd64.whl", hash = "sha256:8db4c1b57507eef143a15a6884ca10f7c73876cdf5d51e713151c1236a0e68cf"}, - {file = "psutil-5.9.8-cp38-abi3-macosx_11_0_arm64.whl", hash = "sha256:d16bbddf0693323b8c6123dd804100241da461e41d6e332fb0ba6058f630f8c8"}, - {file = "psutil-5.9.8.tar.gz", hash = "sha256:6be126e3225486dff286a8fb9a06246a5253f4c7c53b475ea5f5ac934e64194c"}, +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7" +files = [ + {file = "psutil-6.1.0-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:ff34df86226c0227c52f38b919213157588a678d049688eded74c76c8ba4a5d0"}, + {file = "psutil-6.1.0-cp27-cp27m-manylinux2010_i686.whl", hash = "sha256:c0e0c00aa18ca2d3b2b991643b799a15fc8f0563d2ebb6040f64ce8dc027b942"}, + {file = "psutil-6.1.0-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:000d1d1ebd634b4efb383f4034437384e44a6d455260aaee2eca1e9c1b55f047"}, + {file = "psutil-6.1.0-cp27-cp27mu-manylinux2010_i686.whl", hash = "sha256:5cd2bcdc75b452ba2e10f0e8ecc0b57b827dd5d7aaffbc6821b2a9a242823a76"}, + {file = "psutil-6.1.0-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:045f00a43c737f960d273a83973b2511430d61f283a44c96bf13a6e829ba8fdc"}, + {file = "psutil-6.1.0-cp27-none-win32.whl", hash = "sha256:9118f27452b70bb1d9ab3198c1f626c2499384935aaf55388211ad982611407e"}, + {file = "psutil-6.1.0-cp27-none-win_amd64.whl", hash = "sha256:a8506f6119cff7015678e2bce904a4da21025cc70ad283a53b099e7620061d85"}, + {file = "psutil-6.1.0-cp36-abi3-macosx_10_9_x86_64.whl", hash = "sha256:6e2dcd475ce8b80522e51d923d10c7871e45f20918e027ab682f94f1c6351688"}, + {file = "psutil-6.1.0-cp36-abi3-macosx_11_0_arm64.whl", hash = "sha256:0895b8414afafc526712c498bd9de2b063deaac4021a3b3c34566283464aff8e"}, + {file = "psutil-6.1.0-cp36-abi3-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9dcbfce5d89f1d1f2546a2090f4fcf87c7f669d1d90aacb7d7582addece9fb38"}, + {file = "psutil-6.1.0-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:498c6979f9c6637ebc3a73b3f87f9eb1ec24e1ce53a7c5173b8508981614a90b"}, + {file = "psutil-6.1.0-cp36-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d905186d647b16755a800e7263d43df08b790d709d575105d419f8b6ef65423a"}, + {file = "psutil-6.1.0-cp36-cp36m-win32.whl", hash = "sha256:6d3fbbc8d23fcdcb500d2c9f94e07b1342df8ed71b948a2649b5cb060a7c94ca"}, + {file = "psutil-6.1.0-cp36-cp36m-win_amd64.whl", hash = "sha256:1209036fbd0421afde505a4879dee3b2fd7b1e14fee81c0069807adcbbcca747"}, + {file = "psutil-6.1.0-cp37-abi3-win32.whl", hash = "sha256:1ad45a1f5d0b608253b11508f80940985d1d0c8f6111b5cb637533a0e6ddc13e"}, + {file = "psutil-6.1.0-cp37-abi3-win_amd64.whl", hash = "sha256:a8fb3752b491d246034fa4d279ff076501588ce8cbcdbb62c32fd7a377d996be"}, + {file = "psutil-6.1.0.tar.gz", hash = "sha256:353815f59a7f64cdaca1c0307ee13558a0512f6db064e92fe833784f08539c7a"}, ] [package.extras] -test = ["enum34", "ipaddress", "mock", "pywin32", "wmi"] +dev = ["black", "check-manifest", "coverage", "packaging", "pylint", "pyperf", "pypinfo", "pytest-cov", "requests", "rstcheck", "ruff", "sphinx", "sphinx_rtd_theme", "toml-sort", "twine", "virtualenv", "wheel"] +test = ["pytest", "pytest-xdist", "setuptools"] [[package]] name = "ptyprocess" @@ -3077,4 +3079,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "675128279862686c6c3e85d2ee2889772250bb7896458e15cbf5005bcf7f0578" +content-hash = "b87b1a5bccf2a50f548ae9470eabff8a8a9e870387562308a7b217b0fa2d84f0" diff --git a/pyproject.toml b/pyproject.toml index bc7aea30d..9181d2290 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,7 +27,7 @@ bbot = 'bbot.cli:main' [tool.poetry.dependencies] python = "^3.9" omegaconf = "^2.3.0" -psutil = "^5.9.4" +psutil = ">=5.9.4,<7.0.0" wordninja = "^2.0.0" ansible-runner = "^2.3.2" deepdiff = ">=6.2.3,<8.0.0" From 20aaf6820bb77bb63a392fdae39b6f9bad4f24a9 Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 18 Oct 2024 15:47:40 -0400 Subject: [PATCH 08/80] resolve conflicts --- .github/workflows/tests.yml | 90 ++++++++----------------------------- 1 file changed, 19 insertions(+), 71 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 799c0101e..0d7599a41 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,12 +14,12 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: psf/black@stable with: options: "--check" - name: Install Python 3 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.x" - name: Install dependencies @@ -27,7 +27,7 @@ jobs: pip install flake8 - name: flake8 run: | - flake8 --select F,E722 --ignore F403,F405,F541 --per-file-ignores="*/__init__.py:F401,F403" + flake8 test: needs: lint runs-on: ubuntu-latest @@ -37,9 +37,9 @@ jobs: matrix: python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -55,88 +55,36 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} files: ./cov.xml verbose: true - update_docs: - needs: test - runs-on: ubuntu-latest - if: github.event_name == 'push' && (github.ref != 'refs/heads/dev' && github.ref != 'refs/heads/stable') + test-distros: + needs: lint + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, debian, archlinux, fedora-latest, gentoo, alpine] steps: - - uses: actions/checkout@v3 - with: - token: ${{ secrets.BBOT_DOCS_UPDATER_PAT }} + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: - python-version: "3.x" + python-version: ${{ matrix.python-version }} - name: Install dependencies run: | pip install poetry poetry install - - name: Generate docs - run: | - poetry run bbot/scripts/docs.py - - name: Commit docs - uses: EndBug/add-and-commit@v9 - continue-on-error: true - with: - add: '["*.md", "docs/data/chord_graph/*.json"]' - author_name: "BBOT Docs Autopublish" - author_email: info@blacklanternsecurity.com - message: "Refresh module docs" - publish_docs: - needs: test - runs-on: ubuntu-latest - if: github.event_name == 'push' && (github.ref == 'refs/heads/stable' || github.ref == 'refs/heads/dev') - steps: - - uses: actions/checkout@v3 - with: - token: ${{ secrets.BBOT_DOCS_UPDATER_PAT }} - - uses: actions/setup-python@v4 - with: - python-version: "3.x" - - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV - - uses: actions/cache@v3 - with: - key: mkdocs-material-${{ env.cache_id }} - path: .cache - restore-keys: | - mkdocs-material- - - name: Install dependencies - run: | - pip install poetry - poetry install --only=docs - - name: Configure Git - run: | - git config user.name github-actions - git config user.email github-actions@github.com - git fetch origin gh-pages:refs/remotes/origin/gh-pages - if git show-ref --verify --quiet refs/heads/gh-pages; then - git branch -f gh-pages origin/gh-pages - else - git branch --track gh-pages origin/gh-pages - fi - - name: Generate docs (stable branch) - if: github.ref == 'refs/heads/stable' - run: | - poetry run mike deploy Stable - - name: Generate docs (dev branch) - if: github.ref == 'refs/heads/dev' - run: | - poetry run mike deploy Dev - - name: Publish docs + - name: Run tests run: | - git switch gh-pages - git push + poetry run pytest --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=DEBUG --cov-config=bbot/test/coverage.cfg --cov-report xml:cov.xml --cov=bbot . publish_code: needs: test runs-on: ubuntu-latest if: github.event_name == 'push' && (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/stable') continue-on-error: true steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.x" - name: Install dependencies @@ -185,7 +133,7 @@ jobs: # runs-on: ubuntu-latest # if: github.event_name == 'push' && github.ref == 'refs/heads/stable' # steps: - # - uses: actions/checkout@v3 + # - uses: actions/checkout@v4 # with: # ref: ${{ github.head_ref }} # fetch-depth: 0 # Fetch all history for all tags and branches From f55c00441ac972dfb98acef07852c4f97cf18f3d Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 18 Oct 2024 15:48:06 -0400 Subject: [PATCH 09/80] resolve conflicts --- .flake8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.flake8 b/.flake8 index bbe8b7581..a6f057338 100644 --- a/.flake8 +++ b/.flake8 @@ -2,4 +2,4 @@ select = F,E722 ignore = F403,F405,F541 per-file-ignores = - */__init__.py:F401,F403 \ No newline at end of file + */__init__.py:F401,F403 From 6be3f2395432508273eae260edee11b4a3fcc122 Mon Sep 17 00:00:00 2001 From: TheTechromancer Date: Tue, 18 Jun 2024 12:58:16 -0400 Subject: [PATCH 10/80] simplified run_tests.sh --- bbot/test/run_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bbot/test/run_tests.sh b/bbot/test/run_tests.sh index 3490f5b65..39458dbf9 100755 --- a/bbot/test/run_tests.sh +++ b/bbot/test/run_tests.sh @@ -10,7 +10,7 @@ echo echo "[+] Linting with flake8" echo "=======================" -flake8 --select F,E722 --ignore F403,F405,F541 --per-file-ignores="*/__init__.py:F401,F403" "$bbot_dir" || exit 1 +flake8 "$bbot_dir" || exit 1 echo if [ "${1}x" != "x" ] ; then From c08648e0d6ca255a409f0b4f517fae987fb531cf Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 18 Oct 2024 15:48:39 -0400 Subject: [PATCH 11/80] resolve conflicts --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0d7599a41..bf65e13c8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -48,7 +48,7 @@ jobs: poetry install - name: Run tests run: | - poetry run pytest --exitfirst --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=DEBUG --cov-config=bbot/test/coverage.cfg --cov-report xml:cov.xml --cov=bbot . + poetry run pytest --exitfirst --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=INFO --cov-config=bbot/test/coverage.cfg --cov-report xml:cov.xml --cov=bbot . - name: Upload Code Coverage uses: codecov/codecov-action@v3 with: @@ -66,7 +66,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} + python-version: "3.x" - name: Install dependencies run: | pip install poetry From c2e69e8fbbf2a00c2cda5be20a209d22b65ccca6 Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 18 Oct 2024 16:43:15 -0400 Subject: [PATCH 12/80] runs-on --> container: image --- .github/workflows/tests.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bf65e13c8..80a6df8eb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -57,7 +57,9 @@ jobs: verbose: true test-distros: needs: lint - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest + container: + image: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, debian, archlinux, fedora-latest, gentoo, alpine] From 6875793bc646f56ead7388542a54ca928e7cac72 Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 18 Oct 2024 17:34:35 -0400 Subject: [PATCH 13/80] fix python setup --- .github/workflows/tests.yml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 80a6df8eb..7f00ed835 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -65,17 +65,27 @@ jobs: os: [ubuntu-latest, debian, archlinux, fedora-latest, gentoo, alpine] steps: - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.x" + - name: Install Python + run: | + if [ -f /etc/debian_version ]; then + sudo apt-get update + sudo apt-get install -y python3 python3-pip + elif [ -f /etc/arch-release ]; then + sudo pacman -Syu --noconfirm python python-pip + elif [ -f /etc/fedora-release ]; then + sudo dnf install -y python3 python3-pip + elif [ -f /etc/gentoo-release ]; then + sudo emerge dev-lang/python + elif [ -f /etc/alpine-release ]; then + sudo apk add --no-cache python3 py3-pip + fi - name: Install dependencies run: | pip install poetry poetry install - name: Run tests run: | - poetry run pytest --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=DEBUG --cov-config=bbot/test/coverage.cfg --cov-report xml:cov.xml --cov=bbot . + poetry run pytest --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=DEBUG . publish_code: needs: test runs-on: ubuntu-latest From 047b9ffd1609373812704878e15e909e8d82075e Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 09:22:12 -0400 Subject: [PATCH 14/80] no sudo --- .github/workflows/tests.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7f00ed835..3d334eaba 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -68,16 +68,16 @@ jobs: - name: Install Python run: | if [ -f /etc/debian_version ]; then - sudo apt-get update - sudo apt-get install -y python3 python3-pip + apt-get update + apt-get install -y python3 python3-pip elif [ -f /etc/arch-release ]; then - sudo pacman -Syu --noconfirm python python-pip + pacman -Syu --noconfirm python python-pip elif [ -f /etc/fedora-release ]; then - sudo dnf install -y python3 python3-pip + dnf install -y python3 python3-pip elif [ -f /etc/gentoo-release ]; then - sudo emerge dev-lang/python + emerge dev-lang/python elif [ -f /etc/alpine-release ]; then - sudo apk add --no-cache python3 py3-pip + apk add --no-cache python3 py3-pip fi - name: Install dependencies run: | From 3c6728c290f593aa57460f61420138ed349c244a Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 10:02:48 -0400 Subject: [PATCH 15/80] python things --- .github/workflows/tests.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3d334eaba..147fdba5f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -61,8 +61,9 @@ jobs: container: image: ${{ matrix.os }} strategy: + fail-fast: false matrix: - os: [ubuntu-latest, debian, archlinux, fedora-latest, gentoo, alpine] + os: [ubuntu-latest, debian, archlinux, fedora-latest, gentoo/python, python:3.10-alpine] steps: - uses: actions/checkout@v4 - name: Install Python @@ -74,10 +75,6 @@ jobs: pacman -Syu --noconfirm python python-pip elif [ -f /etc/fedora-release ]; then dnf install -y python3 python3-pip - elif [ -f /etc/gentoo-release ]; then - emerge dev-lang/python - elif [ -f /etc/alpine-release ]; then - apk add --no-cache python3 py3-pip fi - name: Install dependencies run: | From 0572ce6afb5a59ed8b1d1d15938215db3e96b5b3 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 10:10:15 -0400 Subject: [PATCH 16/80] quotes --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 147fdba5f..709e11902 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -63,7 +63,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, debian, archlinux, fedora-latest, gentoo/python, python:3.10-alpine] + os: ["ubuntu-latest", "debian", "archlinux", "fedora-latest", "gentoo/python", "python:3.10-alpine"] steps: - uses: actions/checkout@v4 - name: Install Python From 5a6e68eea9368f3975b8c2055febcf656bba7124 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 10:29:53 -0400 Subject: [PATCH 17/80] testing stuff --- .github/workflows/tests.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 709e11902..83067d9ca 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -63,22 +63,25 @@ jobs: strategy: fail-fast: false matrix: - os: ["ubuntu-latest", "debian", "archlinux", "fedora-latest", "gentoo/python", "python:3.10-alpine"] + os: ["ubuntu:20.04", "ubuntu:22.04", "ubuntu:24.04", "debian", "archlinux", "fedora", "gentoo/python", "python:3.10-alpine"] steps: - uses: actions/checkout@v4 - - name: Install Python + - name: Install Python and Poetry run: | if [ -f /etc/debian_version ]; then apt-get update - apt-get install -y python3 python3-pip + apt-get install -y python3 python3-pip python3-poetry elif [ -f /etc/arch-release ]; then - pacman -Syu --noconfirm python python-pip + pacman -Syu --noconfirm python python-pip poetry elif [ -f /etc/fedora-release ]; then - dnf install -y python3 python3-pip + dnf install -y python3 python3-pip poetry + elif [ -f /etc/gentoo-release ]; then + emerge --update --newuse dev-python/poetry + elif [ -f /etc/alpine-release ]; then + apk add --no-cache python3 py3-pip py3-poetry fi - name: Install dependencies run: | - pip install poetry poetry install - name: Run tests run: | From ffe8ae1cc149d129e4c4989280e0330bd202bd65 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 10:39:48 -0400 Subject: [PATCH 18/80] pipx --- .github/workflows/tests.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 83067d9ca..65fb21e82 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -70,16 +70,18 @@ jobs: run: | if [ -f /etc/debian_version ]; then apt-get update - apt-get install -y python3 python3-pip python3-poetry + apt-get install -y python3 python3-pip pipx elif [ -f /etc/arch-release ]; then - pacman -Syu --noconfirm python python-pip poetry + pacman -Syu --noconfirm python python-pip pipx elif [ -f /etc/fedora-release ]; then - dnf install -y python3 python3-pip poetry + dnf install -y python3 python3-pip pipx elif [ -f /etc/gentoo-release ]; then - emerge --update --newuse dev-python/poetry + emerge --update --newuse dev-lang/python dev-python/pipx elif [ -f /etc/alpine-release ]; then - apk add --no-cache python3 py3-pip py3-poetry + apk add --no-cache python3 py3-pip py3-pipx fi + python3 -m pipx ensurepath + pipx install poetry - name: Install dependencies run: | poetry install From 46f65a4c9694b68e061295b490dcdc0f7c48654f Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 10:59:22 -0400 Subject: [PATCH 19/80] onwards --- .github/workflows/tests.yml | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 65fb21e82..80f94851a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -68,18 +68,40 @@ jobs: - uses: actions/checkout@v4 - name: Install Python and Poetry run: | - if [ -f /etc/debian_version ]; then - apt-get update - apt-get install -y python3 python3-pip pipx + if [ -f /etc/os-release ]; then + . /etc/os-release + if [ "$ID" = "ubuntu" ] && [ "$VERSION_ID" = "20.04" ]; then + # Add deadsnakes PPA for Python 3.12 + apt-get update + apt-get install -y software-properties-common + add-apt-repository ppa:deadsnakes/ppa + apt-get update + apt-get install -y python3.12 python3.12-venv python3.12-distutils python3-pip + # Update alternatives to use python3.12 + update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1 + update-alternatives --set python3 /usr/bin/python3.12 + python3 -m pip install --upgrade pip + python3 -m pip install pipx + else + apt-get update + apt-get install -y python3 python3-pip pipx + fi elif [ -f /etc/arch-release ]; then pacman -Syu --noconfirm python python-pip pipx elif [ -f /etc/fedora-release ]; then dnf install -y python3 python3-pip pipx elif [ -f /etc/gentoo-release ]; then + # Initialize and sync Gentoo repository + emerge-webrsync + emerge --sync emerge --update --newuse dev-lang/python dev-python/pipx elif [ -f /etc/alpine-release ]; then - apk add --no-cache python3 py3-pip py3-pipx + apk add --no-cache python3 py3-pip + python3 -m pip install --upgrade pip + python3 -m pip install pipx fi + # Add $HOME/.local/bin to PATH + export PATH="$HOME/.local/bin:$PATH" python3 -m pipx ensurepath pipx install poetry - name: Install dependencies From 50969ebb1b1f91710b5e22ec5c34fd84d58ef6f6 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 11:04:33 -0400 Subject: [PATCH 20/80] distro stuff --- .github/workflows/distro_tests.yml | 67 ++++++++++++++++++++++++++++++ .github/workflows/tests.yml | 55 ------------------------ 2 files changed, 67 insertions(+), 55 deletions(-) create mode 100644 .github/workflows/distro_tests.yml diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml new file mode 100644 index 000000000..fd0c88efb --- /dev/null +++ b/.github/workflows/distro_tests.yml @@ -0,0 +1,67 @@ +name: Linux Distro Tests +on: + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + test-distros: + needs: lint + runs-on: ubuntu-latest + container: + image: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: ["ubuntu:20.04", "ubuntu:22.04", "ubuntu:24.04", "debian", "archlinux", "fedora", "gentoo/python", "python:3.10-alpine"] + steps: + - uses: actions/checkout@v4 + - name: Install Python and Poetry + run: | + if [ -f /etc/os-release ]; then + . /etc/os-release + if [ "$ID" = "ubuntu" ] && [ "$VERSION_ID" = "20.04" ]; then + # Add deadsnakes PPA for Python 3.12 + apt-get update + apt-get install -y software-properties-common + add-apt-repository ppa:deadsnakes/ppa + apt-get update + apt-get install -y python3.12 python3.12-venv python3.12-distutils python3-pip + # Update alternatives to use python3.12 + update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1 + update-alternatives --set python3 /usr/bin/python3.12 + python3 -m pip install --upgrade pip + python3 -m pip install pipx + elif [ "$ID" = "alpine" ]; then + apk add --no-cache python3 py3-pip + python3 -m pip install --upgrade pip + python3 -m pip install pipx + elif [ "$ID" = "arch" ]; then + pacman -Syu --noconfirm python python-pip pipx + elif [ "$ID" = "fedora" ]; then + dnf install -y python3 python3-pip pipx + elif [ "$ID" = "gentoo" ]; then + # Initialize and sync Gentoo repository + emerge-webrsync + emerge --sync + emerge --update --newuse dev-lang/python dev-python/pipx + else + echo "Unsupported Linux distribution" + exit 1 + fi + else + echo "Operating system not recognized" + exit 1 + fi + # Add $HOME/.local/bin to PATH + export PATH="$HOME/.local/bin:$PATH" + python3 -m pipx ensurepath + pipx install poetry + - name: Install dependencies + run: | + poetry install + - name: Run tests + run: | + poetry run pytest --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=DEBUG . diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 80f94851a..3a9aecd52 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -55,61 +55,6 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} files: ./cov.xml verbose: true - test-distros: - needs: lint - runs-on: ubuntu-latest - container: - image: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: ["ubuntu:20.04", "ubuntu:22.04", "ubuntu:24.04", "debian", "archlinux", "fedora", "gentoo/python", "python:3.10-alpine"] - steps: - - uses: actions/checkout@v4 - - name: Install Python and Poetry - run: | - if [ -f /etc/os-release ]; then - . /etc/os-release - if [ "$ID" = "ubuntu" ] && [ "$VERSION_ID" = "20.04" ]; then - # Add deadsnakes PPA for Python 3.12 - apt-get update - apt-get install -y software-properties-common - add-apt-repository ppa:deadsnakes/ppa - apt-get update - apt-get install -y python3.12 python3.12-venv python3.12-distutils python3-pip - # Update alternatives to use python3.12 - update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1 - update-alternatives --set python3 /usr/bin/python3.12 - python3 -m pip install --upgrade pip - python3 -m pip install pipx - else - apt-get update - apt-get install -y python3 python3-pip pipx - fi - elif [ -f /etc/arch-release ]; then - pacman -Syu --noconfirm python python-pip pipx - elif [ -f /etc/fedora-release ]; then - dnf install -y python3 python3-pip pipx - elif [ -f /etc/gentoo-release ]; then - # Initialize and sync Gentoo repository - emerge-webrsync - emerge --sync - emerge --update --newuse dev-lang/python dev-python/pipx - elif [ -f /etc/alpine-release ]; then - apk add --no-cache python3 py3-pip - python3 -m pip install --upgrade pip - python3 -m pip install pipx - fi - # Add $HOME/.local/bin to PATH - export PATH="$HOME/.local/bin:$PATH" - python3 -m pipx ensurepath - pipx install poetry - - name: Install dependencies - run: | - poetry install - - name: Run tests - run: | - poetry run pytest --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=DEBUG . publish_code: needs: test runs-on: ubuntu-latest From b30cbaff378974f54b7e424d90dcabd87fd8773f Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 11:09:07 -0400 Subject: [PATCH 21/80] more --- .github/workflows/distro_tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index fd0c88efb..2906a4771 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -8,7 +8,6 @@ concurrency: jobs: test-distros: - needs: lint runs-on: ubuntu-latest container: image: ${{ matrix.os }} From 262d5d7807ecae725ff7a0b6a88b86faddb64e30 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 11:11:37 -0400 Subject: [PATCH 22/80] just ubuntu things --- .github/workflows/distro_tests.yml | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index 2906a4771..e221a7d35 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -21,16 +21,21 @@ jobs: run: | if [ -f /etc/os-release ]; then . /etc/os-release - if [ "$ID" = "ubuntu" ] && [ "$VERSION_ID" = "20.04" ]; then - # Add deadsnakes PPA for Python 3.12 - apt-get update - apt-get install -y software-properties-common - add-apt-repository ppa:deadsnakes/ppa - apt-get update - apt-get install -y python3.12 python3.12-venv python3.12-distutils python3-pip - # Update alternatives to use python3.12 - update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1 - update-alternatives --set python3 /usr/bin/python3.12 + if [ "$ID" = "ubuntu" ]; then + if [ "$VERSION_ID" = "20.04" ]; then + # Add deadsnakes PPA for Python 3.12 + apt-get update + apt-get install -y software-properties-common + add-apt-repository ppa:deadsnakes/ppa + apt-get update + apt-get install -y python3.12 python3.12-venv python3.12-distutils python3-pip + # Update alternatives to use python3.12 + update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1 + update-alternatives --set python3 /usr/bin/python3.12 + else + apt-get update + apt-get install -y python3 python3-pip + fi python3 -m pip install --upgrade pip python3 -m pip install pipx elif [ "$ID" = "alpine" ]; then From cc296b7b8f012bd8c2fb27af42a6b9410c0eb602 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 11:46:15 -0400 Subject: [PATCH 23/80] tests --- .github/workflows/distro_tests.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index e221a7d35..8dc284c23 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -34,18 +34,23 @@ jobs: update-alternatives --set python3 /usr/bin/python3.12 else apt-get update - apt-get install -y python3 python3-pip + apt-get install -y python3 python3-pip python3-venv fi python3 -m pip install --upgrade pip python3 -m pip install pipx + elif [ "$ID" = "debian" ]; then + apt-get update + apt-get install -y python3 python3-pip python3-venv + python3 -m pip install --upgrade pip + python3 -m pip install pipx elif [ "$ID" = "alpine" ]; then apk add --no-cache python3 py3-pip python3 -m pip install --upgrade pip python3 -m pip install pipx elif [ "$ID" = "arch" ]; then - pacman -Syu --noconfirm python python-pip pipx + pacman -Syu --noconfirm python python-pip python-pipx elif [ "$ID" = "fedora" ]; then - dnf install -y python3 python3-pip pipx + dnf install -y python3 python3-pip pipx poetry elif [ "$ID" = "gentoo" ]; then # Initialize and sync Gentoo repository emerge-webrsync @@ -59,13 +64,13 @@ jobs: echo "Operating system not recognized" exit 1 fi - # Add $HOME/.local/bin to PATH - export PATH="$HOME/.local/bin:$PATH" python3 -m pipx ensurepath pipx install poetry - name: Install dependencies run: | + export PATH="$HOME/.local/bin:$PATH" poetry install - name: Run tests run: | + export PATH="$HOME/.local/bin:$PATH" poetry run pytest --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=DEBUG . From 97ce06b29c3780c6301645b65a59baf67a3133e6 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 12:04:02 -0400 Subject: [PATCH 24/80] iterating --- .github/workflows/distro_tests.yml | 32 +++++++++++------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index 8dc284c23..37b26ef0b 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -21,30 +21,22 @@ jobs: run: | if [ -f /etc/os-release ]; then . /etc/os-release - if [ "$ID" = "ubuntu" ]; then - if [ "$VERSION_ID" = "20.04" ]; then - # Add deadsnakes PPA for Python 3.12 - apt-get update - apt-get install -y software-properties-common - add-apt-repository ppa:deadsnakes/ppa - apt-get update - apt-get install -y python3.12 python3.12-venv python3.12-distutils python3-pip - # Update alternatives to use python3.12 - update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1 - update-alternatives --set python3 /usr/bin/python3.12 - else - apt-get update - apt-get install -y python3 python3-pip python3-venv - fi - python3 -m pip install --upgrade pip - python3 -m pip install pipx - elif [ "$ID" = "debian" ]; then + if [ "$ID" = "ubuntu" || "$ID" = "debian" ]; then + # Add deadsnakes PPA for Python 3.12 + apt-get update + apt-get install -y software-properties-common + add-apt-repository ppa:deadsnakes/ppa apt-get update - apt-get install -y python3 python3-pip python3-venv + apt-get install -y python3.12 python3.12-venv python3.12-distutils + # Install pip for Python 3.12 + curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12 + # Update alternatives to use python3.12 + update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1 + update-alternatives --set python3 /usr/bin/python3.12 python3 -m pip install --upgrade pip python3 -m pip install pipx elif [ "$ID" = "alpine" ]; then - apk add --no-cache python3 py3-pip + apk add --no-cache bash python3 py3-pip python3 -m pip install --upgrade pip python3 -m pip install pipx elif [ "$ID" = "arch" ]; then From 3036629933ed1d812bf08b00d6f10c8860d94046 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 12:05:22 -0400 Subject: [PATCH 25/80] bash oopsie --- .github/workflows/distro_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index 37b26ef0b..e504b8586 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -21,7 +21,7 @@ jobs: run: | if [ -f /etc/os-release ]; then . /etc/os-release - if [ "$ID" = "ubuntu" || "$ID" = "debian" ]; then + if [ "$ID" = "ubuntu" -o "$ID" = "debian" ]; then # Add deadsnakes PPA for Python 3.12 apt-get update apt-get install -y software-properties-common From 687d247f6220e219c451299dcac2760a33c3309f Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 12:22:14 -0400 Subject: [PATCH 26/80] distrosgit diff --- .github/workflows/distro_tests.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index e504b8586..9c2c744c6 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -14,17 +14,17 @@ jobs: strategy: fail-fast: false matrix: - os: ["ubuntu:20.04", "ubuntu:22.04", "ubuntu:24.04", "debian", "archlinux", "fedora", "gentoo/python", "python:3.10-alpine"] + os: ["ubuntu:20.04", "ubuntu:22.04", "ubuntu:24.04", "debian", "archlinux", "fedora", "gentoo/python", "python:3.10-alpine", "kalilinux/kali-rolling", "parrotsec/parrot", "archlinux/archlinux"] steps: - uses: actions/checkout@v4 - name: Install Python and Poetry run: | if [ -f /etc/os-release ]; then . /etc/os-release - if [ "$ID" = "ubuntu" -o "$ID" = "debian" ]; then + if [ "$ID" = "ubuntu" ]; then # Add deadsnakes PPA for Python 3.12 apt-get update - apt-get install -y software-properties-common + apt-get install -y software-properties-common curl add-apt-repository ppa:deadsnakes/ppa apt-get update apt-get install -y python3.12 python3.12-venv python3.12-distutils @@ -36,10 +36,10 @@ jobs: python3 -m pip install --upgrade pip python3 -m pip install pipx elif [ "$ID" = "alpine" ]; then - apk add --no-cache bash python3 py3-pip + apk add --no-cache bash python3 py3-pip gcc musl-dev libffi-dev python3 -m pip install --upgrade pip python3 -m pip install pipx - elif [ "$ID" = "arch" ]; then + elif [ "$ID" = "arch" -o "$ID" = "archlinux" ]; then pacman -Syu --noconfirm python python-pip python-pipx elif [ "$ID" = "fedora" ]; then dnf install -y python3 python3-pip pipx poetry @@ -47,7 +47,10 @@ jobs: # Initialize and sync Gentoo repository emerge-webrsync emerge --sync - emerge --update --newuse dev-lang/python dev-python/pipx + emerge --update --newuse dev-lang/python dev-python/pipx poetry + elif [ "$ID" = "kali" -o "$ID" = "parrot" -o "$ID" = "debian" ]; then + apt-get update + apt-get install -y python3 python3-pip pipx else echo "Unsupported Linux distribution" exit 1 From c763c1eea262ee177c66ae56b4a774ace1eb1af5 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 12:24:43 -0400 Subject: [PATCH 27/80] alpine --- .github/workflows/distro_tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index 9c2c744c6..bbe32406f 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - os: ["ubuntu:20.04", "ubuntu:22.04", "ubuntu:24.04", "debian", "archlinux", "fedora", "gentoo/python", "python:3.10-alpine", "kalilinux/kali-rolling", "parrotsec/parrot", "archlinux/archlinux"] + os: ["ubuntu:20.04", "ubuntu:22.04", "ubuntu:24.04", "debian", "archlinux", "fedora", "gentoo/python", "python:3.10-alpine", "kalilinux/kali-rolling", "parrotsec/security", "archlinux/archlinux"] steps: - uses: actions/checkout@v4 - name: Install Python and Poetry @@ -36,7 +36,7 @@ jobs: python3 -m pip install --upgrade pip python3 -m pip install pipx elif [ "$ID" = "alpine" ]; then - apk add --no-cache bash python3 py3-pip gcc musl-dev libffi-dev + apk add --no-cache bash python3 py3-pip gcc g++ musl-dev libffi-dev python3 -m pip install --upgrade pip python3 -m pip install pipx elif [ "$ID" = "arch" -o "$ID" = "archlinux" ]; then From 16f204c19f24d53674abfa6066614481caefedbf Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 12:26:03 -0400 Subject: [PATCH 28/80] ubuntu things --- .github/workflows/distro_tests.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index bbe32406f..a6bf7dad1 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -22,12 +22,17 @@ jobs: if [ -f /etc/os-release ]; then . /etc/os-release if [ "$ID" = "ubuntu" ]; then - # Add deadsnakes PPA for Python 3.12 apt-get update apt-get install -y software-properties-common curl - add-apt-repository ppa:deadsnakes/ppa - apt-get update - apt-get install -y python3.12 python3.12-venv python3.12-distutils + if [ "$VERSION_ID" = "24.04" ]; then + # Install Python 3.12 and its components directly from Ubuntu repositories + apt-get install -y python3.12 python3.12-venv python3.12-distutils + else + # Add deadsnakes PPA for Python 3.12 + add-apt-repository ppa:deadsnakes/ppa + apt-get update + apt-get install -y python3.12 python3.12-venv python3.12-distutils + fi # Install pip for Python 3.12 curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12 # Update alternatives to use python3.12 From 10627df2d6525a801d4e27fd3295c0d92f5fa607 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 12:41:22 -0400 Subject: [PATCH 29/80] more ubuntu things --- .github/workflows/distro_tests.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index a6bf7dad1..61bd352d0 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -24,9 +24,14 @@ jobs: if [ "$ID" = "ubuntu" ]; then apt-get update apt-get install -y software-properties-common curl + # Install necessary Perl modules for debconf + apt-get install -y libterm-readline-gnu-perl libterm-readline-perl-perl if [ "$VERSION_ID" = "24.04" ]; then # Install Python 3.12 and its components directly from Ubuntu repositories - apt-get install -y python3.12 python3.12-venv python3.12-distutils + apt-get install -y python3.12 python3.12-venv + # Handle missing python3.12-distutils + curl -O https://bootstrap.pypa.io/pip/3.12/get-pip.py + python3.12 get-pip.py else # Add deadsnakes PPA for Python 3.12 add-apt-repository ppa:deadsnakes/ppa From f3b90e5396f94195677a1711ffc5727a076849b8 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 14:36:58 -0400 Subject: [PATCH 30/80] better debian --- .github/workflows/distro_tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index 61bd352d0..2dbae5a5d 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -14,13 +14,14 @@ jobs: strategy: fail-fast: false matrix: - os: ["ubuntu:20.04", "ubuntu:22.04", "ubuntu:24.04", "debian", "archlinux", "fedora", "gentoo/python", "python:3.10-alpine", "kalilinux/kali-rolling", "parrotsec/security", "archlinux/archlinux"] + os: ["ubuntu:20.04", "ubuntu:22.04", "ubuntu:24.04", "debian", "archlinux", "fedora", "gentoo/python", "python:3.10-alpine", "kalilinux/kali-rolling", "parrotsec/security"] steps: - uses: actions/checkout@v4 - name: Install Python and Poetry run: | if [ -f /etc/os-release ]; then . /etc/os-release + export DEBIAN_FRONTEND=noninteractive # Set debconf to noninteractive mode if [ "$ID" = "ubuntu" ]; then apt-get update apt-get install -y software-properties-common curl From 0a6e78bf73371634f29ef8e85f20b1d0b65ee7a2 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 14:40:04 -0400 Subject: [PATCH 31/80] ubuntu why? --- .github/workflows/distro_tests.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index 2dbae5a5d..8690a0fe1 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -30,9 +30,6 @@ jobs: if [ "$VERSION_ID" = "24.04" ]; then # Install Python 3.12 and its components directly from Ubuntu repositories apt-get install -y python3.12 python3.12-venv - # Handle missing python3.12-distutils - curl -O https://bootstrap.pypa.io/pip/3.12/get-pip.py - python3.12 get-pip.py else # Add deadsnakes PPA for Python 3.12 add-apt-repository ppa:deadsnakes/ppa From 838c7811a7e077fa834cccb2813ca1c36a8f60e3 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 14:43:48 -0400 Subject: [PATCH 32/80] ubuntu why? --- .github/workflows/distro_tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index 8690a0fe1..3c8117ffe 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -30,6 +30,7 @@ jobs: if [ "$VERSION_ID" = "24.04" ]; then # Install Python 3.12 and its components directly from Ubuntu repositories apt-get install -y python3.12 python3.12-venv + else # Add deadsnakes PPA for Python 3.12 add-apt-repository ppa:deadsnakes/ppa @@ -42,7 +43,7 @@ jobs: update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1 update-alternatives --set python3 /usr/bin/python3.12 python3 -m pip install --upgrade pip - python3 -m pip install pipx + python3 -m pip install pipx --break-system-packages elif [ "$ID" = "alpine" ]; then apk add --no-cache bash python3 py3-pip gcc g++ musl-dev libffi-dev python3 -m pip install --upgrade pip From 782a68d78cbbbfd2a996e8ec4b00fd868091d3a4 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 14:55:51 -0400 Subject: [PATCH 33/80] ubuntu why? --- .github/workflows/distro_tests.yml | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index 3c8117ffe..90302cc75 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -28,21 +28,15 @@ jobs: # Install necessary Perl modules for debconf apt-get install -y libterm-readline-gnu-perl libterm-readline-perl-perl if [ "$VERSION_ID" = "24.04" ]; then - # Install Python 3.12 and its components directly from Ubuntu repositories - apt-get install -y python3.12 python3.12-venv - + apt-get install -y python3.11 python3.11-venv else - # Add deadsnakes PPA for Python 3.12 add-apt-repository ppa:deadsnakes/ppa apt-get update - apt-get install -y python3.12 python3.12-venv python3.12-distutils + apt-get install -y python3.11 python3.11-venv python3.11-distutils fi - # Install pip for Python 3.12 - curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12 - # Update alternatives to use python3.12 - update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1 - update-alternatives --set python3 /usr/bin/python3.12 - python3 -m pip install --upgrade pip + curl -sS https://bootstrap.pypa.io/get-pip.py | python3.11 + update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 + update-alternatives --set python3 /usr/bin/python3.11 python3 -m pip install pipx --break-system-packages elif [ "$ID" = "alpine" ]; then apk add --no-cache bash python3 py3-pip gcc g++ musl-dev libffi-dev From 8f3ba6108fb6d912f2aa3ddb32b2c7fe38934f8e Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 15:09:38 -0400 Subject: [PATCH 34/80] ubuntu why? --- .github/workflows/distro_tests.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index 90302cc75..916e60007 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -27,13 +27,9 @@ jobs: apt-get install -y software-properties-common curl # Install necessary Perl modules for debconf apt-get install -y libterm-readline-gnu-perl libterm-readline-perl-perl - if [ "$VERSION_ID" = "24.04" ]; then - apt-get install -y python3.11 python3.11-venv - else - add-apt-repository ppa:deadsnakes/ppa - apt-get update - apt-get install -y python3.11 python3.11-venv python3.11-distutils - fi + add-apt-repository ppa:deadsnakes/ppa + apt-get update + apt-get install -y python3.11 python3.11-venv python3.11-distutils curl -sS https://bootstrap.pypa.io/get-pip.py | python3.11 update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 update-alternatives --set python3 /usr/bin/python3.11 From cdfbe7e77d2ef139a07d1aa999f5312c282efcad Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 16:29:08 -0400 Subject: [PATCH 35/80] skip dastardly --- .github/workflows/distro_tests.yml | 1 + bbot/test/test_step_2/module_tests/base.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index 916e60007..879b1ea04 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -67,4 +67,5 @@ jobs: - name: Run tests run: | export PATH="$HOME/.local/bin:$PATH" + export BBOT_DISTRO_TESTS=true poetry run pytest --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=DEBUG . diff --git a/bbot/test/test_step_2/module_tests/base.py b/bbot/test/test_step_2/module_tests/base.py index f5d4255f6..bb63b57e5 100644 --- a/bbot/test/test_step_2/module_tests/base.py +++ b/bbot/test/test_step_2/module_tests/base.py @@ -89,6 +89,10 @@ def module(self): async def module_test( self, httpx_mock, bbot_httpserver, bbot_httpserver_ssl, monkeypatch, request, caplog, capsys ): + # Skip dastardly test if we're in the distro tests (because dastardly uses docker) + if os.getenv("BBOT_DISTRO_TESTS") and self.name == "dastardly": + pytest.skip("Skipping module_test for dastardly module due to BBOT_DISTRO_TESTS environment variable") + self.log.info(f"Starting {self.name} module test") module_test = self.ModuleTest( self, httpx_mock, bbot_httpserver, bbot_httpserver_ssl, monkeypatch, request, caplog, capsys From ce31264ff53d8c05e50cfbfa89187f8a3e0a130e Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 16:46:27 -0400 Subject: [PATCH 36/80] pyenv --- .github/workflows/distro_tests.yml | 54 ++++++++---------------------- 1 file changed, 14 insertions(+), 40 deletions(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index 879b1ea04..5e9e5441b 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -21,51 +21,25 @@ jobs: run: | if [ -f /etc/os-release ]; then . /etc/os-release - export DEBIAN_FRONTEND=noninteractive # Set debconf to noninteractive mode - if [ "$ID" = "ubuntu" ]; then - apt-get update - apt-get install -y software-properties-common curl - # Install necessary Perl modules for debconf - apt-get install -y libterm-readline-gnu-perl libterm-readline-perl-perl - add-apt-repository ppa:deadsnakes/ppa - apt-get update - apt-get install -y python3.11 python3.11-venv python3.11-distutils - curl -sS https://bootstrap.pypa.io/get-pip.py | python3.11 - update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 - update-alternatives --set python3 /usr/bin/python3.11 - python3 -m pip install pipx --break-system-packages - elif [ "$ID" = "alpine" ]; then - apk add --no-cache bash python3 py3-pip gcc g++ musl-dev libffi-dev - python3 -m pip install --upgrade pip - python3 -m pip install pipx - elif [ "$ID" = "arch" -o "$ID" = "archlinux" ]; then - pacman -Syu --noconfirm python python-pip python-pipx - elif [ "$ID" = "fedora" ]; then - dnf install -y python3 python3-pip pipx poetry - elif [ "$ID" = "gentoo" ]; then - # Initialize and sync Gentoo repository - emerge-webrsync - emerge --sync - emerge --update --newuse dev-lang/python dev-python/pipx poetry - elif [ "$ID" = "kali" -o "$ID" = "parrot" -o "$ID" = "debian" ]; then - apt-get update - apt-get install -y python3 python3-pip pipx - else - echo "Unsupported Linux distribution" - exit 1 + if [ "$ID" = "alpine" ]; then + apk add --no-cache bash gcc g++ musl-dev libffi-dev fi - else - echo "Operating system not recognized" - exit 1 fi - python3 -m pipx ensurepath + + curl https://pyenv.run | bash + export PATH="$HOME/.pyenv/bin:$PATH" + eval "$(pyenv init --path)" + eval "$(pyenv init -)" + eval "$(pyenv virtualenv-init -)" + pyenv install 3.11 + pyenv global 3.11 + python3.11 -m pip install --user spipx + python3.11 -m pipx ensurepath pipx install poetry - - name: Install dependencies - run: | - export PATH="$HOME/.local/bin:$PATH" - poetry install - name: Run tests run: | export PATH="$HOME/.local/bin:$PATH" export BBOT_DISTRO_TESTS=true + poetry env use python3.11 + poetry install poetry run pytest --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=DEBUG . From 1eedaf57108aa1aedc7bee1778769569045a3d8e Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 16:47:15 -0400 Subject: [PATCH 37/80] pyenv --- .github/workflows/distro_tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index 5e9e5441b..f8a20e6b4 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -39,6 +39,7 @@ jobs: - name: Run tests run: | export PATH="$HOME/.local/bin:$PATH" + export PATH="$HOME/.pyenv/bin:$PATH" export BBOT_DISTRO_TESTS=true poetry env use python3.11 poetry install From bb451fd5bd42da2367c2212d55c167d939f9f813 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 16:49:52 -0400 Subject: [PATCH 38/80] curl --- .github/workflows/distro_tests.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index f8a20e6b4..e18e71031 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -21,8 +21,17 @@ jobs: run: | if [ -f /etc/os-release ]; then . /etc/os-release - if [ "$ID" = "alpine" ]; then + if [ "$ID" = "ubuntu" ] || [ "$ID" = "debian" ] || [ "$ID" = "kalilinux" ] || [ "$ID" = "parrotsec" ]; then + apt-get update + apt-get -y install curl + elif [ "$ID" = "alpine" ]; then apk add --no-cache bash gcc g++ musl-dev libffi-dev + elif [ "$ID" = "archlinux" ]; then + pacman -Syu --noconfirm curl + elif [ "$ID" = "fedora" ]; then + dnf install -y curl + elif [ "$ID" = "gentoo" ]; then + emerge --update --newuse curl fi fi From 60a418e60c8f51934d7114dbceacb8f69b0237a6 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 16:51:42 -0400 Subject: [PATCH 39/80] git --- .github/workflows/distro_tests.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index e18e71031..87ae591b0 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -22,16 +22,17 @@ jobs: if [ -f /etc/os-release ]; then . /etc/os-release if [ "$ID" = "ubuntu" ] || [ "$ID" = "debian" ] || [ "$ID" = "kalilinux" ] || [ "$ID" = "parrotsec" ]; then + export DEBIAN_FRONTEND=noninteractive apt-get update - apt-get -y install curl + apt-get -y install curl git elif [ "$ID" = "alpine" ]; then - apk add --no-cache bash gcc g++ musl-dev libffi-dev + apk add --no-cache bash gcc g++ musl-dev libffi-dev curl git elif [ "$ID" = "archlinux" ]; then - pacman -Syu --noconfirm curl + pacman -Syu --noconfirm curl git elif [ "$ID" = "fedora" ]; then - dnf install -y curl + dnf install -y curl git elif [ "$ID" = "gentoo" ]; then - emerge --update --newuse curl + emerge --update --newuse curl git fi fi From 32abe3b4bba627e884fb805243eac1ab15df41e4 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 16:55:05 -0400 Subject: [PATCH 40/80] bash --- .github/workflows/distro_tests.yml | 31 ++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index 87ae591b0..7abf5aae7 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -24,28 +24,31 @@ jobs: if [ "$ID" = "ubuntu" ] || [ "$ID" = "debian" ] || [ "$ID" = "kalilinux" ] || [ "$ID" = "parrotsec" ]; then export DEBIAN_FRONTEND=noninteractive apt-get update - apt-get -y install curl git + apt-get -y install curl git bash elif [ "$ID" = "alpine" ]; then apk add --no-cache bash gcc g++ musl-dev libffi-dev curl git elif [ "$ID" = "archlinux" ]; then - pacman -Syu --noconfirm curl git + pacman -Syu --noconfirm curl git bash elif [ "$ID" = "fedora" ]; then - dnf install -y curl git + dnf install -y curl git bash elif [ "$ID" = "gentoo" ]; then - emerge --update --newuse curl git + emerge --update --newuse curl git bash fi fi - curl https://pyenv.run | bash - export PATH="$HOME/.pyenv/bin:$PATH" - eval "$(pyenv init --path)" - eval "$(pyenv init -)" - eval "$(pyenv virtualenv-init -)" - pyenv install 3.11 - pyenv global 3.11 - python3.11 -m pip install --user spipx - python3.11 -m pipx ensurepath - pipx install poetry + # Re-run the script with bash + exec bash -c " + curl https://pyenv.run | bash + export PATH=\"$HOME/.pyenv/bin:\$PATH\" + eval \"\$(pyenv init --path)\" + eval \"\$(pyenv init -)\" + eval \"\$(pyenv virtualenv-init -)\" + pyenv install 3.11 + pyenv global 3.11 + python3.11 -m pip install --user spipx + python3.11 -m pipx ensurepath + pipx install poetry + " - name: Run tests run: | export PATH="$HOME/.local/bin:$PATH" From b9d40bf6d6b7555c5429ce4db3d329a57f21c614 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 16:57:34 -0400 Subject: [PATCH 41/80] dev --- .github/workflows/distro_tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index 7abf5aae7..b602012e6 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -24,13 +24,13 @@ jobs: if [ "$ID" = "ubuntu" ] || [ "$ID" = "debian" ] || [ "$ID" = "kalilinux" ] || [ "$ID" = "parrotsec" ]; then export DEBIAN_FRONTEND=noninteractive apt-get update - apt-get -y install curl git bash + apt-get -y install curl git bash build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev elif [ "$ID" = "alpine" ]; then apk add --no-cache bash gcc g++ musl-dev libffi-dev curl git elif [ "$ID" = "archlinux" ]; then - pacman -Syu --noconfirm curl git bash + pacman -Syu --noconfirm curl git bash base-devel elif [ "$ID" = "fedora" ]; then - dnf install -y curl git bash + dnf install -y curl git bash gcc make openssl-devel bzip2-devel libffi-devel elif [ "$ID" = "gentoo" ]; then emerge --update --newuse curl git bash fi @@ -45,7 +45,7 @@ jobs: eval \"\$(pyenv virtualenv-init -)\" pyenv install 3.11 pyenv global 3.11 - python3.11 -m pip install --user spipx + python3.11 -m pip install --user pipx python3.11 -m pipx ensurepath pipx install poetry " From 51fd792285a6746ac0744ab7915a955ae13f4d65 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 17:03:00 -0400 Subject: [PATCH 42/80] path --- .github/workflows/distro_tests.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index b602012e6..62b3fc088 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -26,12 +26,13 @@ jobs: apt-get update apt-get -y install curl git bash build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev elif [ "$ID" = "alpine" ]; then - apk add --no-cache bash gcc g++ musl-dev libffi-dev curl git + apk add --no-cache bash gcc g++ musl-dev libffi-dev curl git make openssl-dev bzip2-dev zlib-dev xz-dev elif [ "$ID" = "archlinux" ]; then pacman -Syu --noconfirm curl git bash base-devel elif [ "$ID" = "fedora" ]; then - dnf install -y curl git bash gcc make openssl-devel bzip2-devel libffi-devel + dnf install -y curl git bash gcc make openssl-devel bzip2-devel libffi-devel zlib-devel xz-devel tk-devel gdbm-devel readline-devel sqlite-devel elif [ "$ID" = "gentoo" ]; then + emerge-webrsync emerge --update --newuse curl git bash fi fi @@ -40,6 +41,7 @@ jobs: exec bash -c " curl https://pyenv.run | bash export PATH=\"$HOME/.pyenv/bin:\$PATH\" + export PATH=\"$HOME/.local/bin:\$PATH\" eval \"\$(pyenv init --path)\" eval \"\$(pyenv init -)\" eval \"\$(pyenv virtualenv-init -)\" From f788dad306b9c5873ef57a2c0ad3a7d56d13f095 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 17:09:05 -0400 Subject: [PATCH 43/80] pyenv things --- .github/workflows/distro_tests.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index 62b3fc088..b29752ed0 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -21,19 +21,19 @@ jobs: run: | if [ -f /etc/os-release ]; then . /etc/os-release - if [ "$ID" = "ubuntu" ] || [ "$ID" = "debian" ] || [ "$ID" = "kalilinux" ] || [ "$ID" = "parrotsec" ]; then + if [ "$ID" = "ubuntu" ] || [ "$ID" = "debian" ] || [ "$ID" = "kali" ] || [ "$ID" = "parrotsec" ]; then export DEBIAN_FRONTEND=noninteractive apt-get update apt-get -y install curl git bash build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev elif [ "$ID" = "alpine" ]; then apk add --no-cache bash gcc g++ musl-dev libffi-dev curl git make openssl-dev bzip2-dev zlib-dev xz-dev - elif [ "$ID" = "archlinux" ]; then + elif [ "$ID" = "arch" ]; then pacman -Syu --noconfirm curl git bash base-devel elif [ "$ID" = "fedora" ]; then dnf install -y curl git bash gcc make openssl-devel bzip2-devel libffi-devel zlib-devel xz-devel tk-devel gdbm-devel readline-devel sqlite-devel elif [ "$ID" = "gentoo" ]; then emerge-webrsync - emerge --update --newuse curl git bash + emerge --update --newuse dev-vcs/git curl bash fi fi @@ -47,6 +47,7 @@ jobs: eval \"\$(pyenv virtualenv-init -)\" pyenv install 3.11 pyenv global 3.11 + pyenv rehash python3.11 -m pip install --user pipx python3.11 -m pipx ensurepath pipx install poetry @@ -55,6 +56,7 @@ jobs: run: | export PATH="$HOME/.local/bin:$PATH" export PATH="$HOME/.pyenv/bin:$PATH" + export PATH="$HOME/.pyenv/shims:$PATH" export BBOT_DISTRO_TESTS=true poetry env use python3.11 poetry install From 73b00f452cb164e640d2405c74c22b511298d2cb Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 21 Oct 2024 17:18:05 -0400 Subject: [PATCH 44/80] alpine --- .github/workflows/distro_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index b29752ed0..e9eac869a 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -26,7 +26,7 @@ jobs: apt-get update apt-get -y install curl git bash build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev elif [ "$ID" = "alpine" ]; then - apk add --no-cache bash gcc g++ musl-dev libffi-dev curl git make openssl-dev bzip2-dev zlib-dev xz-dev + apk add --no-cache bash gcc g++ musl-dev libffi-dev curl git make openssl-dev bzip2-dev zlib-dev xz-dev sqlite-dev elif [ "$ID" = "arch" ]; then pacman -Syu --noconfirm curl git bash base-devel elif [ "$ID" = "fedora" ]; then From 51e745af456e8f37ec57fee6ec39e22ebeebe0fe Mon Sep 17 00:00:00 2001 From: github-actions Date: Wed, 23 Oct 2024 14:19:20 -0400 Subject: [PATCH 45/80] bufferover.run module --- bbot/modules/bufferoverrun.py | 46 +++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 bbot/modules/bufferoverrun.py diff --git a/bbot/modules/bufferoverrun.py b/bbot/modules/bufferoverrun.py new file mode 100644 index 000000000..224239636 --- /dev/null +++ b/bbot/modules/bufferoverrun.py @@ -0,0 +1,46 @@ +from bbot.modules.templates.subdomain_enum import subdomain_enum_apikey + + +class BufferOverrun(subdomain_enum_apikey): + watched_events = ["DNS_NAME"] + produced_events = ["DNS_NAME"] + flags = ["subdomain-enum", "passive", "safe"] + meta = { + "description": "Query BufferOverrun's TLS API for subdomains", + "created_date": "2024-10-23", + "author": "@TheTechromancer", + "auth_required": True, + } + options = {"api_key": "", "commercial": False} + options_desc = {"api_key": "BufferOverrun API key", "commercial": "Use commercial API"} + + base_url = "https://tls.bufferover.run/dns" + commercial_base_url = "https://bufferover-run-tls.p.rapidapi.com/ipv4/dns" + + def prepare_api_request(self, url, kwargs): + if "x-rapidapi-key" in kwargs["headers"]: + kwargs["headers"]["x-rapidapi-host"] = "bufferover-run-tls.p.rapidapi.com" + else: + kwargs["headers"]["x-api-key"] = self.api_key + return url, kwargs + + async def request_url(self, query, commercial=None): + if commercial is None: + commercial = self.options.get("commercial", False) + _, domain = self.helpers.split_domain(query) + url = f"{self.commercial_base_url if commercial else self.base_url}?q=.{domain}" + return await self.api_request(url) + + def parse_results(self, r, query): + j = r.json() + subdomains_set = set() + if isinstance(j, dict): + results = j.get("Results", []) + for result in results: + parts = result.split(",") + if len(parts) > 4: + subdomain = parts[4].strip() + if subdomain and subdomain.endswith(f".{query}"): + subdomains_set.add(subdomain) + for subdomain in subdomains_set: + yield subdomain From 6821a1ea7d20ad6fcc7dcea930a1c24cef851aac Mon Sep 17 00:00:00 2001 From: github-actions Date: Wed, 23 Oct 2024 14:57:07 -0400 Subject: [PATCH 46/80] add test --- bbot/modules/bufferoverrun.py | 14 ++++---- .../module_tests/test_module_bufferoverrun.py | 35 +++++++++++++++++++ 2 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 bbot/test/test_step_2/module_tests/test_module_bufferoverrun.py diff --git a/bbot/modules/bufferoverrun.py b/bbot/modules/bufferoverrun.py index 224239636..1eba8ad4c 100644 --- a/bbot/modules/bufferoverrun.py +++ b/bbot/modules/bufferoverrun.py @@ -17,18 +17,20 @@ class BufferOverrun(subdomain_enum_apikey): base_url = "https://tls.bufferover.run/dns" commercial_base_url = "https://bufferover-run-tls.p.rapidapi.com/ipv4/dns" + async def setup(self): + self.commercial = self.config.get("commercial", False) + return await super().setup() + def prepare_api_request(self, url, kwargs): - if "x-rapidapi-key" in kwargs["headers"]: + if self.commercial: kwargs["headers"]["x-rapidapi-host"] = "bufferover-run-tls.p.rapidapi.com" + kwargs["headers"]["x-rapidapi-key"] = self.api_key else: kwargs["headers"]["x-api-key"] = self.api_key return url, kwargs - async def request_url(self, query, commercial=None): - if commercial is None: - commercial = self.options.get("commercial", False) - _, domain = self.helpers.split_domain(query) - url = f"{self.commercial_base_url if commercial else self.base_url}?q=.{domain}" + async def request_url(self, query): + url = f"{self.commercial_base_url if self.commercial else self.base_url}?q=.{query}" return await self.api_request(url) def parse_results(self, r, query): diff --git a/bbot/test/test_step_2/module_tests/test_module_bufferoverrun.py b/bbot/test/test_step_2/module_tests/test_module_bufferoverrun.py new file mode 100644 index 000000000..b8a8137e2 --- /dev/null +++ b/bbot/test/test_step_2/module_tests/test_module_bufferoverrun.py @@ -0,0 +1,35 @@ +from .base import ModuleTestBase + + +class TestBufferOverrun(ModuleTestBase): + config_overrides = {"modules": {"bufferoverrun": {"api_key": "asdf", "commercial": False}}} + + async def setup_before_prep(self, module_test): + # Mock response for non-commercial API + module_test.httpx_mock.add_response( + url="https://tls.bufferover.run/dns?q=.blacklanternsecurity.com", + match_headers={"x-api-key": "asdf"}, + json={"Results": ["1.2.3.4,example.com,*,*,sub.blacklanternsecurity.com"]}, + ) + + def check(self, module_test, events): + assert any(e.data == "sub.blacklanternsecurity.com" for e in events), "Failed to detect subdomain for free API" + + +class TestBufferOverrunCommercial(ModuleTestBase): + modules_overrides = ["bufferoverrun"] + module_name = "bufferoverrun" + config_overrides = {"modules": {"bufferoverrun": {"api_key": "asdf", "commercial": True}}} + + async def setup_before_prep(self, module_test): + # Mock response for commercial API + module_test.httpx_mock.add_response( + url="https://bufferover-run-tls.p.rapidapi.com/ipv4/dns?q=.blacklanternsecurity.com", + match_headers={"x-rapidapi-host": "bufferover-run-tls.p.rapidapi.com", "x-rapidapi-key": "asdf"}, + json={"Results": ["5.6.7.8,blacklanternsecurity.com,*,*,sub.blacklanternsecurity.com"]}, + ) + + def check(self, module_test, events): + assert any( + e.data == "sub.blacklanternsecurity.com" for e in events + ), "Failed to detect subdomain for commercial API" From ee078b39bf968d8718fefa17dc5d72c48acff799 Mon Sep 17 00:00:00 2001 From: github-actions Date: Wed, 23 Oct 2024 18:58:49 -0400 Subject: [PATCH 47/80] update docs workflow --- .github/workflows/docs_updater.yml | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docs_updater.yml b/.github/workflows/docs_updater.yml index fdc585718..a9f9b81f5 100644 --- a/.github/workflows/docs_updater.yml +++ b/.github/workflows/docs_updater.yml @@ -3,6 +3,7 @@ name: Daily Docs Update on: schedule: - cron: '0 0 * * *' # Runs daily at midnight UTC + workflow_dispatch: # Allows manual triggering jobs: update_docs: @@ -23,14 +24,17 @@ jobs: - name: Generate docs run: | poetry run bbot/scripts/docs.py - - name: Commit changes - uses: EndBug/add-and-commit@v9 - with: - add: '["*.md", "docs/data/chord_graph/*.json"]' - author_name: "BBOT Docs Autopublish" - author_email: info@blacklanternsecurity.com - message: "Refresh module docs" - - name: Create Pull Request + - name: Commit and Push Changes + run: | + git config user.name "BBOT Docs Autopublish" + git config user.email "info@blacklanternsecurity.com" + git checkout -b update-docs + git add "*.md" "docs/data/chord_graph/*.json" + git commit -m "Refresh module docs" + git push -u origin update-docs --force + env: + GITHUB_TOKEN: ${{ secrets.BBOT_DOCS_UPDATER_PAT }} + - name: Create or Update Pull Request uses: peter-evans/create-pull-request@v7 with: token: ${{ secrets.BBOT_DOCS_UPDATER_PAT }} @@ -38,3 +42,4 @@ jobs: base: dev title: "Daily Docs Update" body: "This is an automated pull request to update the documentation." + update-existing: true From e08e385c097d9a156cb478fdd784ea0b92cfd754 Mon Sep 17 00:00:00 2001 From: github-actions Date: Thu, 24 Oct 2024 14:56:30 -0400 Subject: [PATCH 48/80] bump versions --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9181d2290..f762e3312 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "bbot" -version = "2.1.0" +version = "2.1.1" description = "OSINT automation for hackers." authors = [ "TheTechromancer", @@ -100,7 +100,7 @@ extend-exclude = "(test_step_1/test_manager_*)" [tool.poetry-dynamic-versioning] enable = true metadata = false -format-jinja = 'v2.1.0{% if branch == "dev" %}.{{ distance }}rc{% endif %}' +format-jinja = 'v2.1.1{% if branch == "dev" %}.{{ distance }}rc{% endif %}' [tool.poetry-dynamic-versioning.substitution] files = ["*/__init__.py"] From 17160e792c7a142bda03c0993b3064e40d9b7e21 Mon Sep 17 00:00:00 2001 From: github-actions Date: Thu, 24 Oct 2024 14:59:33 -0400 Subject: [PATCH 49/80] continue on error --- .github/workflows/distro_tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index e9eac869a..1d6ad2ffc 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -61,3 +61,4 @@ jobs: poetry env use python3.11 poetry install poetry run pytest --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=DEBUG . + continue-on-error: true From 30320b615fb339e027224371e850351fa2c4a582 Mon Sep 17 00:00:00 2001 From: github-actions Date: Thu, 24 Oct 2024 17:16:44 -0400 Subject: [PATCH 50/80] don't continue on error --- .github/workflows/distro_tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index 1d6ad2ffc..e9eac869a 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -61,4 +61,3 @@ jobs: poetry env use python3.11 poetry install poetry run pytest --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=DEBUG . - continue-on-error: true From 07a07138d382739ce8673cdb751f78b35fc1c292 Mon Sep 17 00:00:00 2001 From: github-actions Date: Sat, 26 Oct 2024 09:55:22 -0400 Subject: [PATCH 51/80] silence stderr in tests --- bbot/test/conftest.py | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/bbot/test/conftest.py b/bbot/test/conftest.py index 7cccc950d..516c0fec2 100644 --- a/bbot/test/conftest.py +++ b/bbot/test/conftest.py @@ -13,17 +13,31 @@ from bbot.core.helpers.misc import execute_sync_or_async from bbot.core.helpers.interactsh import server_list as interactsh_servers +# silence stdout + trace +root_logger = logging.getLogger() +pytest_debug_file = Path(__file__).parent.parent.parent / "pytest_debug.log" +print(f"pytest_debug_file: {pytest_debug_file}") +debug_handler = logging.FileHandler(pytest_debug_file) +debug_handler.setLevel(logging.DEBUG) +debug_format = logging.Formatter("%(asctime)s [%(levelname)s] %(name)s %(filename)s:%(lineno)s %(message)s") +debug_handler.setFormatter(debug_format) +root_logger.addHandler(debug_handler) test_config = OmegaConf.load(Path(__file__).parent / "test.conf") -if test_config.get("debug", False): - os.environ["BBOT_DEBUG"] = "True" - logging.getLogger("bbot").setLevel(logging.DEBUG) - CORE.logger.log_level = logging.DEBUG -else: - # silence stdout + trace - root_logger = logging.getLogger() - for h in root_logger.handlers: - h.addFilter(lambda x: x.levelname not in ("STDOUT", "TRACE")) + +os.environ["BBOT_DEBUG"] = "True" +CORE.logger.log_level = logging.DEBUG + +# silence all stderr output: +stderr_handler = CORE.logger.log_handlers["stderr"] +stderr_handler.setLevel(logging.CRITICAL) +handlers = list(CORE.logger.listener.handlers) +handlers.remove(stderr_handler) +CORE.logger.listener.handlers = tuple(handlers) + +for h in root_logger.handlers: + h.addFilter(lambda x: x.levelname not in ("STDOUT", "TRACE")) + CORE.merge_default(test_config) From dd7884e7878f5c665689d2580b90604822bd7d41 Mon Sep 17 00:00:00 2001 From: github-actions Date: Sat, 26 Oct 2024 09:58:27 -0400 Subject: [PATCH 52/80] upload debug logs --- .github/workflows/tests.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3a9aecd52..ab04a94e4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -49,6 +49,11 @@ jobs: - name: Run tests run: | poetry run pytest --exitfirst --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=INFO --cov-config=bbot/test/coverage.cfg --cov-report xml:cov.xml --cov=bbot . + - name: Upload Debug Logs + uses: actions/upload-artifact@v3 + with: + name: pytest-debug-logs + path: pytest_debug.log - name: Upload Code Coverage uses: codecov/codecov-action@v3 with: From 7da0c63d91e6083b4414da825b2c7fbf0c2c559d Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 27 Oct 2024 08:59:14 -0400 Subject: [PATCH 53/80] troubleshooting ubuntu 20.04 test --- .github/workflows/distro_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index e9eac869a..201f9a79a 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -60,4 +60,4 @@ jobs: export BBOT_DISTRO_TESTS=true poetry env use python3.11 poetry install - poetry run pytest --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=DEBUG . + poetry run pytest --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=INFO -k Testwpscan . From 9e90572446adf2742eeb55c43fb2ddfd54bea007 Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 27 Oct 2024 09:40:41 -0400 Subject: [PATCH 54/80] test things --- .github/workflows/distro_tests.yml | 2 +- bbot/core/helpers/depsinstaller/installer.py | 10 +++++++++- bbot/modules/wpscan.py | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index 201f9a79a..128625654 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -33,7 +33,7 @@ jobs: dnf install -y curl git bash gcc make openssl-devel bzip2-devel libffi-devel zlib-devel xz-devel tk-devel gdbm-devel readline-devel sqlite-devel elif [ "$ID" = "gentoo" ]; then emerge-webrsync - emerge --update --newuse dev-vcs/git curl bash + emerge --update --newuse dev-vcs/git media-libs/mesa curl bash fi fi diff --git a/bbot/core/helpers/depsinstaller/installer.py b/bbot/core/helpers/depsinstaller/installer.py index 8df5f05cf..80ded37a6 100644 --- a/bbot/core/helpers/depsinstaller/installer.py +++ b/bbot/core/helpers/depsinstaller/installer.py @@ -342,7 +342,15 @@ def install_core_deps(self): # ensure tldextract data is cached self.parent_helper.tldextract("evilcorp.co.uk") # command: package_name - core_deps = {"unzip": "unzip", "curl": "curl"} + core_deps = { + "unzip": "unzip", + "zipinfo": "unzip", + "curl": "curl", + "git": "git", + "make": "make", + "gcc": "gcc", + "bash": "bash", + } for command, package_name in core_deps.items(): if not self.parent_helper.which(command): to_install.add(package_name) diff --git a/bbot/modules/wpscan.py b/bbot/modules/wpscan.py index d9c43905e..4c1dce494 100644 --- a/bbot/modules/wpscan.py +++ b/bbot/modules/wpscan.py @@ -48,7 +48,7 @@ class wpscan(BaseModule): "name": "Install Ruby Deps (Fedora)", "package": {"name": ["rubygems", "ruby-devel"], "state": "present"}, "become": True, - "when": "ansible_facts['os_family'] == 'Fedora'", + "when": "ansible_facts['os_family'] == 'RedHat'", }, { "name": "Install wpscan gem", From 04411552da7760e3d7a73da04b48987b3b94049e Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 27 Oct 2024 09:45:06 -0400 Subject: [PATCH 55/80] ruby things --- bbot/modules/wpscan.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bbot/modules/wpscan.py b/bbot/modules/wpscan.py index 4c1dce494..40c1d0181 100644 --- a/bbot/modules/wpscan.py +++ b/bbot/modules/wpscan.py @@ -33,10 +33,16 @@ class wpscan(BaseModule): deps_apt = ["curl", "make", "gcc"] deps_ansible = [ { - "name": "Install Ruby Deps (Debian/Ubuntu)", + "name": "Install Ruby Deps (Ubuntu 20.04)", + "package": {"name": ["ruby-dev"], "state": "present"}, + "become": True, + "when": "ansible_facts['os_family'] == 'Debian' and ansible_facts['distribution_version'] == '20.04'", + }, + { + "name": "Install Ruby Deps (Other Debian-based)", "package": {"name": ["ruby-rubygems", "ruby-dev"], "state": "present"}, "become": True, - "when": "ansible_facts['os_family'] == 'Debian'", + "when": "ansible_facts['os_family'] == 'Debian' and ansible_facts['distribution_version'] != '20.04'", }, { "name": "Install Ruby Deps (Arch)", From 5eded289ba0d2baa9d842cace96c2ad413ea65b3 Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 27 Oct 2024 09:58:59 -0400 Subject: [PATCH 56/80] more test things --- .github/workflows/distro_tests.yml | 1 + bbot/modules/wpscan.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index 128625654..0d0515ac2 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -32,6 +32,7 @@ jobs: elif [ "$ID" = "fedora" ]; then dnf install -y curl git bash gcc make openssl-devel bzip2-devel libffi-devel zlib-devel xz-devel tk-devel gdbm-devel readline-devel sqlite-devel elif [ "$ID" = "gentoo" ]; then + echo "media-libs/libglvnd X" >> /etc/portage/package.use/libglvnd emerge-webrsync emerge --update --newuse dev-vcs/git media-libs/mesa curl bash fi diff --git a/bbot/modules/wpscan.py b/bbot/modules/wpscan.py index 40c1d0181..0dcd69fb3 100644 --- a/bbot/modules/wpscan.py +++ b/bbot/modules/wpscan.py @@ -36,13 +36,13 @@ class wpscan(BaseModule): "name": "Install Ruby Deps (Ubuntu 20.04)", "package": {"name": ["ruby-dev"], "state": "present"}, "become": True, - "when": "ansible_facts['os_family'] == 'Debian' and ansible_facts['distribution_version'] == '20.04'", + "when": "ansible_facts['distribution'] == 'Ubuntu' and ansible_facts['distribution_major_version'] == '20'", }, { "name": "Install Ruby Deps (Other Debian-based)", "package": {"name": ["ruby-rubygems", "ruby-dev"], "state": "present"}, "become": True, - "when": "ansible_facts['os_family'] == 'Debian' and ansible_facts['distribution_version'] != '20.04'", + "when": "ansible_facts['distribution'] == 'Debian' and not (ansible_facts['os_family'] == 'Ubuntu' and ansible_facts['distribution_major_version'] == '20')", }, { "name": "Install Ruby Deps (Arch)", From 95187e8abb0792a5e5edfaf73eb15fdf1a94667b Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 27 Oct 2024 10:07:10 -0400 Subject: [PATCH 57/80] ansible things --- bbot/modules/wpscan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bbot/modules/wpscan.py b/bbot/modules/wpscan.py index 0dcd69fb3..c82c80b1d 100644 --- a/bbot/modules/wpscan.py +++ b/bbot/modules/wpscan.py @@ -42,7 +42,7 @@ class wpscan(BaseModule): "name": "Install Ruby Deps (Other Debian-based)", "package": {"name": ["ruby-rubygems", "ruby-dev"], "state": "present"}, "become": True, - "when": "ansible_facts['distribution'] == 'Debian' and not (ansible_facts['os_family'] == 'Ubuntu' and ansible_facts['distribution_major_version'] == '20')", + "when": "ansible_facts['os_family'] == 'Debian' and not (ansible_facts['distribution'] == 'Ubuntu' and ansible_facts['distribution_major_version'] == '20')", }, { "name": "Install Ruby Deps (Arch)", From 614dcd5d064c986b4e0ecde4a041b9da6384728d Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 27 Oct 2024 10:16:25 -0400 Subject: [PATCH 58/80] ubuntu why --- bbot/modules/wpscan.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bbot/modules/wpscan.py b/bbot/modules/wpscan.py index c82c80b1d..295f10c0b 100644 --- a/bbot/modules/wpscan.py +++ b/bbot/modules/wpscan.py @@ -38,6 +38,12 @@ class wpscan(BaseModule): "become": True, "when": "ansible_facts['distribution'] == 'Ubuntu' and ansible_facts['distribution_major_version'] == '20'", }, + { + "name": "Update RubyGems System (Ubuntu 20.04)", + "command": "gem update --system", + "become": True, + "when": "ansible_facts['distribution'] == 'Ubuntu' and ansible_facts['distribution_major_version'] == '20'", + }, { "name": "Install Ruby Deps (Other Debian-based)", "package": {"name": ["ruby-rubygems", "ruby-dev"], "state": "present"}, From cfbd2116ab82fe6981db920aaa604a5ccb97c943 Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 27 Oct 2024 10:18:01 -0400 Subject: [PATCH 59/80] alpine --- bbot/modules/wpscan.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bbot/modules/wpscan.py b/bbot/modules/wpscan.py index 295f10c0b..c276c738f 100644 --- a/bbot/modules/wpscan.py +++ b/bbot/modules/wpscan.py @@ -62,6 +62,12 @@ class wpscan(BaseModule): "become": True, "when": "ansible_facts['os_family'] == 'RedHat'", }, + { + "name": "Install Ruby Deps (Alpine)", + "package": {"name": ["ruby-dev", "ruby-bundler"], "state": "present"}, + "become": True, + "when": "ansible_facts['os_family'] == 'Alpine'", + }, { "name": "Install wpscan gem", "gem": {"name": "wpscan", "state": "latest", "user_install": False}, From 991b531b556dfff03af90cea0a731e9a2d9d4a63 Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 27 Oct 2024 10:28:25 -0400 Subject: [PATCH 60/80] bye ubuntu --- .github/workflows/distro_tests.yml | 2 +- bbot/modules/wpscan.py | 16 ++-------------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index 0d0515ac2..957847a65 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - os: ["ubuntu:20.04", "ubuntu:22.04", "ubuntu:24.04", "debian", "archlinux", "fedora", "gentoo/python", "python:3.10-alpine", "kalilinux/kali-rolling", "parrotsec/security"] + os: ["ubuntu:22.04", "ubuntu:24.04", "debian", "archlinux", "fedora", "gentoo/python", "python:3.10-alpine", "kalilinux/kali-rolling", "parrotsec/security"] steps: - uses: actions/checkout@v4 - name: Install Python and Poetry diff --git a/bbot/modules/wpscan.py b/bbot/modules/wpscan.py index c276c738f..980d24fb5 100644 --- a/bbot/modules/wpscan.py +++ b/bbot/modules/wpscan.py @@ -33,22 +33,10 @@ class wpscan(BaseModule): deps_apt = ["curl", "make", "gcc"] deps_ansible = [ { - "name": "Install Ruby Deps (Ubuntu 20.04)", - "package": {"name": ["ruby-dev"], "state": "present"}, - "become": True, - "when": "ansible_facts['distribution'] == 'Ubuntu' and ansible_facts['distribution_major_version'] == '20'", - }, - { - "name": "Update RubyGems System (Ubuntu 20.04)", - "command": "gem update --system", - "become": True, - "when": "ansible_facts['distribution'] == 'Ubuntu' and ansible_facts['distribution_major_version'] == '20'", - }, - { - "name": "Install Ruby Deps (Other Debian-based)", + "name": "Install Ruby Deps (Debian)", "package": {"name": ["ruby-rubygems", "ruby-dev"], "state": "present"}, "become": True, - "when": "ansible_facts['os_family'] == 'Debian' and not (ansible_facts['distribution'] == 'Ubuntu' and ansible_facts['distribution_major_version'] == '20')", + "when": "ansible_facts['os_family'] == 'Debian'", }, { "name": "Install Ruby Deps (Arch)", From f44983f6e1864b52f0c89e805fd31665ef7c1672 Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 27 Oct 2024 10:39:53 -0400 Subject: [PATCH 61/80] all tests --- .github/workflows/distro_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index 957847a65..e77e1453a 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -61,4 +61,4 @@ jobs: export BBOT_DISTRO_TESTS=true poetry env use python3.11 poetry install - poetry run pytest --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=INFO -k Testwpscan . + poetry run pytest --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=INFO . From 1f71c58c182ee77f159f473641246c5b6502bad0 Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 27 Oct 2024 13:19:41 -0400 Subject: [PATCH 62/80] fix chrome in fedora --- bbot/core/config/logger.py | 1 - bbot/modules/gowitness.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/bbot/core/config/logger.py b/bbot/core/config/logger.py index 6a213d42d..5c48dd9f1 100644 --- a/bbot/core/config/logger.py +++ b/bbot/core/config/logger.py @@ -71,7 +71,6 @@ def __init__(self, core): # Start the QueueListener self.listener = logging.handlers.QueueListener(self.queue, *self.log_handlers.values()) self.listener.start() - atexit.register(self.listener.stop) self.log_level = logging.INFO diff --git a/bbot/modules/gowitness.py b/bbot/modules/gowitness.py index 9d6d57483..571456302 100644 --- a/bbot/modules/gowitness.py +++ b/bbot/modules/gowitness.py @@ -72,7 +72,7 @@ async def setup(self): # make sure we have a working chrome install chrome_test_pass = False - for binary in ("chrome", "chromium", custom_chrome_path): + for binary in ("chrome", "chromium", "chromium-browser", custom_chrome_path): binary_path = self.helpers.which(binary) if binary_path and Path(binary_path).is_file(): chrome_test_proc = await self.run_process([binary_path, "--version"]) From f4bbd88c82a8f938e68bebbcfa539ed8365135b7 Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 27 Oct 2024 13:23:11 -0400 Subject: [PATCH 63/80] goodbye gentoo, goodbye alpine --- .github/workflows/distro_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index e77e1453a..395a38f5c 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - os: ["ubuntu:22.04", "ubuntu:24.04", "debian", "archlinux", "fedora", "gentoo/python", "python:3.10-alpine", "kalilinux/kali-rolling", "parrotsec/security"] + os: ["ubuntu:22.04", "ubuntu:24.04", "debian", "archlinux", "fedora", "kalilinux/kali-rolling", "parrotsec/security"] steps: - uses: actions/checkout@v4 - name: Install Python and Poetry From 8a8d33e01483d6128dbb3a3f5befbcdfe38b736c Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 27 Oct 2024 13:34:52 -0400 Subject: [PATCH 64/80] flaked --- bbot/core/config/logger.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bbot/core/config/logger.py b/bbot/core/config/logger.py index 5c48dd9f1..4723d4237 100644 --- a/bbot/core/config/logger.py +++ b/bbot/core/config/logger.py @@ -1,5 +1,4 @@ import sys -import atexit import logging from copy import copy import multiprocessing From 32c4f7e4ad3d5859386632bd91f1c8781820d71c Mon Sep 17 00:00:00 2001 From: liquidsec Date: Mon, 28 Oct 2024 10:23:42 -0400 Subject: [PATCH 65/80] fixing pytest summary --- bbot/test/conftest.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bbot/test/conftest.py b/bbot/test/conftest.py index 516c0fec2..b62da9edb 100644 --- a/bbot/test/conftest.py +++ b/bbot/test/conftest.py @@ -216,20 +216,20 @@ def pytest_terminal_summary(terminalreporter, exitstatus, config): # pragma: no errors = len(stats.get("error", [])) failed = stats.get("failed", []) - print("\nTest Session Summary:") - print(f"Total tests run: {total_tests}") - print( - f"{GREEN}Passed: {passed}{RESET}, {RED}Failed: {len(failed)}{RESET}, {YELLOW}Skipped: {skipped}{RESET}, Errors: {errors}" + terminalreporter.write("\nTest Session Summary:") + terminalreporter.write(f"\nTotal tests run: {total_tests}") + terminalreporter.write( + f"\n{GREEN}Passed: {passed}{RESET}, {RED}Failed: {len(failed)}{RESET}, {YELLOW}Skipped: {skipped}{RESET}, Errors: {errors}" ) if failed: - print(f"\n{RED}Detailed failed test report:{RESET}") + terminalreporter.write(f"\n{RED}Detailed failed test report:{RESET}") for item in failed: test_name = item.nodeid.split("::")[-1] if "::" in item.nodeid else item.nodeid file_and_line = f"{item.location[0]}:{item.location[1]}" # File path and line number - print(f"{BLUE}Test Name: {test_name}{RESET} {CYAN}({file_and_line}){RESET}") - print(f"{RED}Location: {item.nodeid} at {item.location[0]}:{item.location[1]}{RESET}") - print(f"{RED}Failure details:\n{item.longreprtext}{RESET}") + terminalreporter.write(f"\n{BLUE}Test Name: {test_name}{RESET} {CYAN}({file_and_line}){RESET}") + terminalreporter.write(f"\n{RED}Location: {item.nodeid} at {item.location[0]}:{item.location[1]}{RESET}") + terminalreporter.write(f"\n{RED}Failure details:\n{item.longreprtext}{RESET}") # BELOW: debugging for frozen/hung tests From 24676a6fc968f78c5e178b01658d9ffe64a2c38b Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 28 Oct 2024 16:25:47 -0400 Subject: [PATCH 66/80] showcapture no --- .github/workflows/distro_tests.yml | 2 +- .github/workflows/tests.yml | 2 +- bbot/test/test_step_1/test_events.py | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index 395a38f5c..283c7e9e9 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -61,4 +61,4 @@ jobs: export BBOT_DISTRO_TESTS=true poetry env use python3.11 poetry install - poetry run pytest --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=INFO . + poetry run pytest --show-capture=no --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=INFO . diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ab04a94e4..531d47d9a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -48,7 +48,7 @@ jobs: poetry install - name: Run tests run: | - poetry run pytest --exitfirst --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=INFO --cov-config=bbot/test/coverage.cfg --cov-report xml:cov.xml --cov=bbot . + poetry run pytest --exitfirst --show-capture=no --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=INFO --cov-config=bbot/test/coverage.cfg --cov-report xml:cov.xml --cov=bbot . - name: Upload Debug Logs uses: actions/upload-artifact@v3 with: diff --git a/bbot/test/test_step_1/test_events.py b/bbot/test/test_step_1/test_events.py index 00ce75ff8..97601a1e2 100644 --- a/bbot/test/test_step_1/test_events.py +++ b/bbot/test/test_step_1/test_events.py @@ -925,3 +925,9 @@ def test_event_closest_host(): vuln = scan.make_event( {"path": "/tmp/asdf.txt", "description": "test", "severity": "HIGH"}, "VULNERABILITY", parent=event3 ) + + +def test_test_output(): + import traceback + + assert False, traceback.format_stack() From d348d9611d4fe6678d1b74faf61fcab49b0ac350 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 28 Oct 2024 16:44:36 -0400 Subject: [PATCH 67/80] silence live logging --- bbot/test/conftest.py | 7 +++++++ bbot/test/test_step_1/test_events.py | 6 ------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bbot/test/conftest.py b/bbot/test/conftest.py index 516c0fec2..7759a4964 100644 --- a/bbot/test/conftest.py +++ b/bbot/test/conftest.py @@ -47,6 +47,13 @@ def assert_all_responses_were_requested() -> bool: return False +@pytest.fixture(autouse=True) +def silence_live_logging(): + for handler in logging.getLogger().handlers: + if type(handler).__name__ == '_LiveLoggingStreamHandler': + handler.setLevel(logging.CRITICAL) + + @pytest.fixture def bbot_httpserver(): server = HTTPServer(host="127.0.0.1", port=8888, threaded=True) diff --git a/bbot/test/test_step_1/test_events.py b/bbot/test/test_step_1/test_events.py index 97601a1e2..00ce75ff8 100644 --- a/bbot/test/test_step_1/test_events.py +++ b/bbot/test/test_step_1/test_events.py @@ -925,9 +925,3 @@ def test_event_closest_host(): vuln = scan.make_event( {"path": "/tmp/asdf.txt", "description": "test", "severity": "HIGH"}, "VULNERABILITY", parent=event3 ) - - -def test_test_output(): - import traceback - - assert False, traceback.format_stack() From 905cc0430ae288907909fc730f7adb00e55ad795 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 28 Oct 2024 16:47:15 -0400 Subject: [PATCH 68/80] blacked --- bbot/test/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bbot/test/conftest.py b/bbot/test/conftest.py index 7759a4964..dab778ea4 100644 --- a/bbot/test/conftest.py +++ b/bbot/test/conftest.py @@ -50,7 +50,7 @@ def assert_all_responses_were_requested() -> bool: @pytest.fixture(autouse=True) def silence_live_logging(): for handler in logging.getLogger().handlers: - if type(handler).__name__ == '_LiveLoggingStreamHandler': + if type(handler).__name__ == "_LiveLoggingStreamHandler": handler.setLevel(logging.CRITICAL) From 3f3c43bdced6ed301a717532d40a5ab82f6baab5 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 28 Oct 2024 16:57:59 -0400 Subject: [PATCH 69/80] test tests --- .github/workflows/tests.yml | 2 +- bbot/test/test_step_1/test_events.py | 31 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 531d47d9a..d47d7b830 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -48,7 +48,7 @@ jobs: poetry install - name: Run tests run: | - poetry run pytest --exitfirst --show-capture=no --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=INFO --cov-config=bbot/test/coverage.cfg --cov-report xml:cov.xml --cov=bbot . + poetry run pytest --exitfirst -k test_test_output --show-capture=no --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=INFO --cov-config=bbot/test/coverage.cfg --cov-report xml:cov.xml --cov=bbot . - name: Upload Debug Logs uses: actions/upload-artifact@v3 with: diff --git a/bbot/test/test_step_1/test_events.py b/bbot/test/test_step_1/test_events.py index 00ce75ff8..baf5fb8f4 100644 --- a/bbot/test/test_step_1/test_events.py +++ b/bbot/test/test_step_1/test_events.py @@ -925,3 +925,34 @@ def test_event_closest_host(): vuln = scan.make_event( {"path": "/tmp/asdf.txt", "description": "test", "severity": "HIGH"}, "VULNERABILITY", parent=event3 ) + + +def test_test_output(): + + import sys + import logging + + root = logging.getLogger() + print("Root logger handlers:") + for h in root.handlers: + print(f" Handler: {type(h).__name__}") + print(f" Stream: {getattr(h, 'stream', 'no stream')}") + print(f" Level: {logging.getLevelName(h.level)}") + print(f" Formatter: {h.formatter._fmt if h.formatter else 'None'}") + print() + + # Check other loggers too + for name in logging.root.manager.loggerDict: + logger = logging.getLogger(name) + if logger.handlers: + print(f"Logger '{name}' handlers:") + for h in logger.handlers: + print(f" Handler: {type(h).__name__}") + print(f" Stream: {getattr(h, 'stream', 'no stream')}") + print(f" Level: {logging.getLevelName(h.level)}") + print(f" Formatter: {h.formatter._fmt if h.formatter else 'None'}") + print() + + import traceback + + assert False, traceback.format_stack() From ffb8c09105d16ddda543df4a96f1556c56099737 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 28 Oct 2024 16:58:23 -0400 Subject: [PATCH 70/80] remove thing --- .github/workflows/distro_tests.yml | 2 +- .github/workflows/tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index 283c7e9e9..395a38f5c 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -61,4 +61,4 @@ jobs: export BBOT_DISTRO_TESTS=true poetry env use python3.11 poetry install - poetry run pytest --show-capture=no --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=INFO . + poetry run pytest --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=INFO . diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d47d7b830..70d380022 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -48,7 +48,7 @@ jobs: poetry install - name: Run tests run: | - poetry run pytest --exitfirst -k test_test_output --show-capture=no --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=INFO --cov-config=bbot/test/coverage.cfg --cov-report xml:cov.xml --cov=bbot . + poetry run pytest --exitfirst -k test_test_output --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=INFO --cov-config=bbot/test/coverage.cfg --cov-report xml:cov.xml --cov=bbot . - name: Upload Debug Logs uses: actions/upload-artifact@v3 with: From 38d3f4911113e0c43c8ed3a0438774eb2f25d8fa Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 28 Oct 2024 17:00:22 -0400 Subject: [PATCH 71/80] flaked --- bbot/test/test_step_1/test_events.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bbot/test/test_step_1/test_events.py b/bbot/test/test_step_1/test_events.py index baf5fb8f4..1d8cfd14c 100644 --- a/bbot/test/test_step_1/test_events.py +++ b/bbot/test/test_step_1/test_events.py @@ -929,7 +929,6 @@ def test_event_closest_host(): def test_test_output(): - import sys import logging root = logging.getLogger() From 16e82e8265d61268f29dcb7680e0d4d54f7db9d5 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 28 Oct 2024 17:05:13 -0400 Subject: [PATCH 72/80] done --- .github/workflows/tests.yml | 2 +- bbot/test/test_step_1/test_events.py | 30 ---------------------------- 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 70d380022..ab04a94e4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -48,7 +48,7 @@ jobs: poetry install - name: Run tests run: | - poetry run pytest --exitfirst -k test_test_output --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=INFO --cov-config=bbot/test/coverage.cfg --cov-report xml:cov.xml --cov=bbot . + poetry run pytest --exitfirst --reruns 2 -o timeout_func_only=true --timeout 1200 --disable-warnings --log-cli-level=INFO --cov-config=bbot/test/coverage.cfg --cov-report xml:cov.xml --cov=bbot . - name: Upload Debug Logs uses: actions/upload-artifact@v3 with: diff --git a/bbot/test/test_step_1/test_events.py b/bbot/test/test_step_1/test_events.py index 1d8cfd14c..00ce75ff8 100644 --- a/bbot/test/test_step_1/test_events.py +++ b/bbot/test/test_step_1/test_events.py @@ -925,33 +925,3 @@ def test_event_closest_host(): vuln = scan.make_event( {"path": "/tmp/asdf.txt", "description": "test", "severity": "HIGH"}, "VULNERABILITY", parent=event3 ) - - -def test_test_output(): - - import logging - - root = logging.getLogger() - print("Root logger handlers:") - for h in root.handlers: - print(f" Handler: {type(h).__name__}") - print(f" Stream: {getattr(h, 'stream', 'no stream')}") - print(f" Level: {logging.getLevelName(h.level)}") - print(f" Formatter: {h.formatter._fmt if h.formatter else 'None'}") - print() - - # Check other loggers too - for name in logging.root.manager.loggerDict: - logger = logging.getLogger(name) - if logger.handlers: - print(f"Logger '{name}' handlers:") - for h in logger.handlers: - print(f" Handler: {type(h).__name__}") - print(f" Stream: {getattr(h, 'stream', 'no stream')}") - print(f" Level: {logging.getLevelName(h.level)}") - print(f" Formatter: {h.formatter._fmt if h.formatter else 'None'}") - print() - - import traceback - - assert False, traceback.format_stack() From 0207fd08250e6ee81996e80524078d2e8f5f73d9 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 28 Oct 2024 17:16:30 -0400 Subject: [PATCH 73/80] stop logger on exit --- bbot/core/config/logger.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bbot/core/config/logger.py b/bbot/core/config/logger.py index 4723d4237..10cdd7b2e 100644 --- a/bbot/core/config/logger.py +++ b/bbot/core/config/logger.py @@ -1,9 +1,11 @@ import sys +import atexit import logging from copy import copy import multiprocessing import logging.handlers from pathlib import Path +from contextlib import suppress from ..helpers.misc import mkdir, error_and_exit from ...logger import colorize, loglevel_mapping @@ -70,9 +72,14 @@ def __init__(self, core): # Start the QueueListener self.listener = logging.handlers.QueueListener(self.queue, *self.log_handlers.values()) self.listener.start() + atexit.register(self.listener.stop) self.log_level = logging.INFO + def stop_listener(self): + with suppress(Exception): + self.listener.stop() + def setup_queue_handler(self, logging_queue=None, log_level=logging.DEBUG): if logging_queue is None: logging_queue = self.queue From ad8802441b2bc1e794afac65f556e34cbc84fe4f Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 28 Oct 2024 17:26:19 -0400 Subject: [PATCH 74/80] better log cleanup --- bbot/core/config/logger.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/bbot/core/config/logger.py b/bbot/core/config/logger.py index 10cdd7b2e..31fe1b10f 100644 --- a/bbot/core/config/logger.py +++ b/bbot/core/config/logger.py @@ -72,11 +72,28 @@ def __init__(self, core): # Start the QueueListener self.listener = logging.handlers.QueueListener(self.queue, *self.log_handlers.values()) self.listener.start() - atexit.register(self.listener.stop) + atexit.register(self.cleanup_logging) self.log_level = logging.INFO - def stop_listener(self): + def cleanup_logging(self): + # Close the queue handler + self.queue_handler.close() + + # Clean root logger + root_logger = logging.getLogger() + for handler in list(root_logger.handlers): + root_logger.removeHandler(handler) + handler.close() + + # Clean all other loggers + for logger in logging.Logger.manager.loggerDict.values(): + if hasattr(logger, 'handlers'): # Logger, not PlaceHolder + for handler in list(logger.handlers): + logger.removeHandler(handler) + handler.close() + + # Stop queue listener with suppress(Exception): self.listener.stop() From 60ab921912e0e065b70fab18123141ef0d3d803a Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 28 Oct 2024 18:35:15 -0400 Subject: [PATCH 75/80] rename tests --- .github/workflows/distro_tests.yml | 2 +- .github/workflows/tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/distro_tests.yml b/.github/workflows/distro_tests.yml index 395a38f5c..7b2bd51dd 100644 --- a/.github/workflows/distro_tests.yml +++ b/.github/workflows/distro_tests.yml @@ -1,4 +1,4 @@ -name: Linux Distro Tests +name: Tests (Linux Distros) on: pull_request: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ab04a94e4..78b0cbd93 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: tests +name: Tests (Python Versions) on: push: branches: From e8c27f4f2a221bac5f68cf1a96d70ac24d7b1aa0 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 28 Oct 2024 18:36:06 -0400 Subject: [PATCH 76/80] don't skip dastardly tests --- bbot/test/test_step_2/module_tests/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bbot/test/test_step_2/module_tests/base.py b/bbot/test/test_step_2/module_tests/base.py index bb63b57e5..6bccf32dc 100644 --- a/bbot/test/test_step_2/module_tests/base.py +++ b/bbot/test/test_step_2/module_tests/base.py @@ -90,8 +90,8 @@ async def module_test( self, httpx_mock, bbot_httpserver, bbot_httpserver_ssl, monkeypatch, request, caplog, capsys ): # Skip dastardly test if we're in the distro tests (because dastardly uses docker) - if os.getenv("BBOT_DISTRO_TESTS") and self.name == "dastardly": - pytest.skip("Skipping module_test for dastardly module due to BBOT_DISTRO_TESTS environment variable") + # if os.getenv("BBOT_DISTRO_TESTS") and self.name == "dastardly": + # pytest.skip("Skipping module_test for dastardly module due to BBOT_DISTRO_TESTS environment variable") self.log.info(f"Starting {self.name} module test") module_test = self.ModuleTest( From 1837f0a85b605570ac510de11caabf8ef96580fd Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 28 Oct 2024 19:54:56 -0400 Subject: [PATCH 77/80] unskip dastardly tests --- bbot/core/config/logger.py | 17 +++++++++++------ bbot/test/test_step_2/module_tests/base.py | 4 ++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/bbot/core/config/logger.py b/bbot/core/config/logger.py index 31fe1b10f..2e42ef8de 100644 --- a/bbot/core/config/logger.py +++ b/bbot/core/config/logger.py @@ -78,20 +78,25 @@ def __init__(self, core): def cleanup_logging(self): # Close the queue handler - self.queue_handler.close() + with suppress(Exception): + self.queue_handler.close() # Clean root logger root_logger = logging.getLogger() for handler in list(root_logger.handlers): - root_logger.removeHandler(handler) - handler.close() + with suppress(Exception): + root_logger.removeHandler(handler) + with suppress(Exception): + handler.close() # Clean all other loggers for logger in logging.Logger.manager.loggerDict.values(): - if hasattr(logger, 'handlers'): # Logger, not PlaceHolder + if hasattr(logger, "handlers"): # Logger, not PlaceHolder for handler in list(logger.handlers): - logger.removeHandler(handler) - handler.close() + with suppress(Exception): + logger.removeHandler(handler) + with suppress(Exception): + handler.close() # Stop queue listener with suppress(Exception): diff --git a/bbot/test/test_step_2/module_tests/base.py b/bbot/test/test_step_2/module_tests/base.py index 6bccf32dc..bb63b57e5 100644 --- a/bbot/test/test_step_2/module_tests/base.py +++ b/bbot/test/test_step_2/module_tests/base.py @@ -90,8 +90,8 @@ async def module_test( self, httpx_mock, bbot_httpserver, bbot_httpserver_ssl, monkeypatch, request, caplog, capsys ): # Skip dastardly test if we're in the distro tests (because dastardly uses docker) - # if os.getenv("BBOT_DISTRO_TESTS") and self.name == "dastardly": - # pytest.skip("Skipping module_test for dastardly module due to BBOT_DISTRO_TESTS environment variable") + if os.getenv("BBOT_DISTRO_TESTS") and self.name == "dastardly": + pytest.skip("Skipping module_test for dastardly module due to BBOT_DISTRO_TESTS environment variable") self.log.info(f"Starting {self.name} module test") module_test = self.ModuleTest( From 88a9cf97c96f9f25b4fc4789c7eac3a951073812 Mon Sep 17 00:00:00 2001 From: blsaccess Date: Wed, 30 Oct 2024 00:22:46 +0000 Subject: [PATCH 78/80] Update trufflehog --- bbot/modules/trufflehog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bbot/modules/trufflehog.py b/bbot/modules/trufflehog.py index e185e265e..93e029fd0 100644 --- a/bbot/modules/trufflehog.py +++ b/bbot/modules/trufflehog.py @@ -13,7 +13,7 @@ class trufflehog(BaseModule): } options = { - "version": "3.82.11", + "version": "3.82.13", "config": "", "only_verified": True, "concurrency": 8, From b0639ef4f4ea8dae2f57c2b33a50017e6914278b Mon Sep 17 00:00:00 2001 From: blsaccess Date: Thu, 31 Oct 2024 00:23:01 +0000 Subject: [PATCH 79/80] Update trufflehog --- bbot/modules/trufflehog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bbot/modules/trufflehog.py b/bbot/modules/trufflehog.py index 93e029fd0..148d62100 100644 --- a/bbot/modules/trufflehog.py +++ b/bbot/modules/trufflehog.py @@ -13,7 +13,7 @@ class trufflehog(BaseModule): } options = { - "version": "3.82.13", + "version": "3.83.1", "config": "", "only_verified": True, "concurrency": 8, From 18a70cac3334bde9f477a32213d7088292627f2c Mon Sep 17 00:00:00 2001 From: github-actions Date: Wed, 30 Oct 2024 22:23:54 -0400 Subject: [PATCH 80/80] asyncify sqlite --- bbot/modules/gowitness.py | 84 +++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 43 deletions(-) diff --git a/bbot/modules/gowitness.py b/bbot/modules/gowitness.py index 571456302..08edfaaf3 100644 --- a/bbot/modules/gowitness.py +++ b/bbot/modules/gowitness.py @@ -1,5 +1,5 @@ import asyncio -import sqlite3 +import aiosqlite import multiprocessing from pathlib import Path from contextlib import suppress @@ -34,6 +34,7 @@ class gowitness(BaseModule): "idle_timeout": "Skip the current gowitness batch if it stalls for longer than this many seconds", } deps_common = ["chromium"] + deps_pip = ["aiosqlite"] deps_ansible = [ { "name": "Download gowitness", @@ -136,7 +137,8 @@ async def handle_batch(self, *events): return # emit web screenshots - for filename, screenshot in self.new_screenshots.items(): + new_screenshots = await self.get_new_screenshots() + for filename, screenshot in new_screenshots.items(): url = screenshot["url"] final_url = screenshot["final_url"] filename = self.screenshot_path / screenshot["filename"] @@ -150,7 +152,8 @@ async def handle_batch(self, *events): ) # emit URLs - for url, row in self.new_network_logs.items(): + new_network_logs = await self.get_new_network_logs() + for url, row in new_network_logs.items(): ip = row["ip"] status_code = row["status_code"] tags = [f"status-{status_code}", f"ip-{ip}", "spider-danger"] @@ -168,7 +171,8 @@ async def handle_batch(self, *events): ) # emit technologies - for _, row in self.new_technologies.items(): + new_technologies = await self.get_new_technologies() + for _, row in new_technologies.items(): parent_id = row["url_id"] parent_url = self.screenshots_taken[parent_id] parent_event = event_dict[parent_url] @@ -207,59 +211,53 @@ def construct_command(self): command += ["--timeout", str(self.timeout)] return command - @property - def new_screenshots(self): + async def get_new_screenshots(self): screenshots = {} if self.db_path.is_file(): - with sqlite3.connect(str(self.db_path)) as con: - con.row_factory = sqlite3.Row + async with aiosqlite.connect(str(self.db_path)) as con: + con.row_factory = aiosqlite.Row con.text_factory = self.helpers.smart_decode - cur = con.cursor() - res = self.cur_execute(cur, "SELECT * FROM urls") - for row in res: - row = dict(row) - _id = row["id"] - if _id not in self.screenshots_taken: - self.screenshots_taken[_id] = row["url"] - screenshots[_id] = row + async with con.execute("SELECT * FROM urls") as cur: + async for row in cur: + row = dict(row) + _id = row["id"] + if _id not in self.screenshots_taken: + self.screenshots_taken[_id] = row["url"] + screenshots[_id] = row return screenshots - @property - def new_network_logs(self): + async def get_new_network_logs(self): network_logs = dict() if self.db_path.is_file(): - with sqlite3.connect(str(self.db_path)) as con: - con.row_factory = sqlite3.Row - cur = con.cursor() - res = self.cur_execute(cur, "SELECT * FROM network_logs") - for row in res: - row = dict(row) - url = row["final_url"] - if url not in self.connections_logged: - self.connections_logged.add(url) - network_logs[url] = row + async with aiosqlite.connect(str(self.db_path)) as con: + con.row_factory = aiosqlite.Row + async with con.execute("SELECT * FROM network_logs") as cur: + async for row in cur: + row = dict(row) + url = row["final_url"] + if url not in self.connections_logged: + self.connections_logged.add(url) + network_logs[url] = row return network_logs - @property - def new_technologies(self): + async def get_new_technologies(self): technologies = dict() if self.db_path.is_file(): - with sqlite3.connect(str(self.db_path)) as con: - con.row_factory = sqlite3.Row - cur = con.cursor() - res = self.cur_execute(cur, "SELECT * FROM technologies") - for row in res: - _id = row["id"] - if _id not in self.technologies_found: - self.technologies_found.add(_id) - row = dict(row) - technologies[_id] = row + async with aiosqlite.connect(str(self.db_path)) as con: + con.row_factory = aiosqlite.Row + async with con.execute("SELECT * FROM technologies") as cur: + async for row in cur: + _id = row["id"] + if _id not in self.technologies_found: + self.technologies_found.add(_id) + row = dict(row) + technologies[_id] = row return technologies - def cur_execute(self, cur, query): + async def cur_execute(self, cur, query): try: - return cur.execute(query) - except sqlite3.OperationalError as e: + return await cur.execute(query) + except aiosqlite.OperationalError as e: self.warning(f"Error executing query: {query}: {e}") return []