-
Notifications
You must be signed in to change notification settings - Fork 547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modules not found when using BBOT in Arch Linux #2030
Comments
I guess that BBOT manages the search of modules in a not flexible manner: async def install_module(self, module):
success = True
preloaded = self.all_modules_preloaded[module]
# ansible tasks
ansible_tasks = preloaded["deps"]["ansible"]
if ansible_tasks:
success &= self.tasks(module, ansible_tasks)
# apt
deps_apt = preloaded["deps"]["apt"]
if deps_apt:
self.apt_install(deps_apt)
# shell
deps_shell = preloaded["deps"]["shell"]
if deps_shell:
success &= self.shell(module, deps_shell)
# pip
deps_pip = preloaded["deps"]["pip"]
deps_pip_constraints = preloaded["deps"]["pip_constraints"]
if deps_pip:
success &= await self.pip_install(deps_pip, constraints=deps_pip_constraints)
# shared/common
deps_common = preloaded["deps"]["common"]
if deps_common:
for dep_common in deps_common:
if self.setup_status.get(dep_common, False) == True:
log.debug(
f'Skipping installation of dependency "{dep_common}" for module "{module}" since it is already installed'
)
continue
ansible_tasks = self.preset.module_loader._shared_deps[dep_common]
result = self.tasks(module, ansible_tasks)
self.setup_status[dep_common] = result
success &= result
return success It means that it would work only inside a Python virtual environment or in a Debian-based system. Arch installs python modules by |
Since BBOT and its modules require a wide range of python packages (some with very specific versions), it's crucial it runs inside its own virtual environment. This is why the recommended installation method is Pipx. That being said, we're primarily an Arch shop here at Black Lantern, so getting BBOT into the blackarch repos would be nice. Is there a process for packaging BBOT inside its own python venv? |
Despite the Any pip dependencies are automatically installed inside the current virtual env. |
Once back home, I will give a look. Thanks for the info |
It could be a possibility but I need to understand what is the first running Python script when BBOT is executed, because I should wrap it to execute in a virtual environment. |
I'm trying by wrapping set -e
cd /usr/share/bbot
python -m venv venv
source venv/bin/activate &&
pip install --isolated --root="/usr/share/bbot" --prefix='venv' . but the output produces:
Probably it occurs because BBOT uses Poetry Dynamic Versioning to get BBOT version, but it works only if we are in a git cloned directory (i.e., containing In
to prevent the mentioned issue. |
Currently the
and the post install script post_install() {
set -e
cd /usr/share/bbot
python -m venv venv
source venv/bin/activate &&
export POETRY_DYNAMIC_VERSIONING=0 &&
pip install --isolated --root="/usr/share/bbot" --prefix='venv' .
}
post_upgrade() {
post_install "$@"
} |
Okay, the build process will need to look something like:
$ python -m build
* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
- poetry-core>=1.0.0
- poetry-dynamic-versioning
* Getting build dependencies for sdist...
* Building sdist...
* Building wheel from sdist
* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
- poetry-core>=1.0.0
- poetry-dynamic-versioning
* Getting build dependencies for wheel...
* Building wheel...
Successfully built bbot-2.3.0.tar.gz and bbot-2.3.0-py3-none-any.whl
|
Note that if you're pulling from dev or stable (the default), this will build an identical copy to what's already in Pypi. So if you don't mind relying on the Pypi repos as an upstream, you could save a lot of work by installing directly, e.g. |
Yeah, it was the first version of PKGBUILD I created (that comes from BlackArch PKGBUILD templates) as:
but in this case the dependencies must be installed as Arch packages because of |
I prefer this last method but the problem was that scanner cannot find baddns and openssl. |
As for hardcoding the pip dependencies outside of 'pyproject.toml`, it's risky because we have very specific versions pinned there, and there are likely to more dependencies added/removed in the future. Really it's absolutely necessary that bbot is installed inside its own venv. After that there shouldn't be any issues/conflicts with OS-level pip packages, and it shouldn't have any problem installing module-specific dependencies like baddns. |
It is the Arch nature to install Python libs as packages. Ref: https://wiki.archlinux.org/title/Python#Arch_Repositories
I agree but we should understand how to manage virtual env in a |
Yeah I wish I had more time to help with this but I will say I've had good luck with ChatGPT/Claude when it comes to making PKGBUILDs; prompted with something like |
Describe the bug
I am packaging BBOT for BlackArch and I installed all Python dependencies as
sudo pacman -S python-<modulename>
as usual.When I launch bbot, it recognizes Python modules used directly in the code, but modules used by bbot during the scan/enumeration cannot be found.
Indeed, when I launch
bbot -t evilcorp.com -p subdomain-enum -v
, I get:On Arch I installed
baddns
from source by the latest commit:Note: on baddns, I don't understand why it outputs
1.4.0
whereas I installed the latest commit that should be1.4.13.r0.g0c8d6e9
, I think this is a bug on baddns.I installed BadDNS by PKGBUILD I created in Arch for packaging it and it works well.
Btw, I also installed
openssl
on my Arch:and
python-pyopenssl
(version24.2.1-2
).Why is BBOT not able to find these modules? Is it searching on wrong library path instead of
/usr/lib
?I am using Python 3.12 and there I have:
Expected behavior
BBOT can find
BBOT Command
bbot -t evilcorp.com -p subdomain-enum
OS, BBOT Installation Method + Version
OS: Arch Linux
Installation method: PKGBUILD for packaging BBOT in Arch by:
BBOT version: latest commit
95d1bc565d90f9dea92f0c6283d7976972ac11e2
BBOT Config
Attach your BBOT config (
bbot --current-config
).I get
bbot: error: unrecognized arguments: --current-config
.Logs
If possible, produce the bug while
--debug
is enabled, and attach the relevant parts of~/.bbot/logs/bbot.debug.log
The text was updated successfully, but these errors were encountered: