diff --git a/cloud_enum.py b/cloud_enum.py index 8746d42..e4340a5 100755 --- a/cloud_enum.py +++ b/cloud_enum.py @@ -34,8 +34,9 @@ def parse_arguments(): desc = "Multi-cloud enumeration utility. All hail OSINT!" parser = argparse.ArgumentParser(description=desc) - # Grab the current dir of the script, for setting some defaults below - script_path = os.path.split(os.path.abspath(sys.argv[0]))[0] + # Grab the install dir of this module, for setting some defaults below. + # Not sys.argv[0]: console-script entry points live in the venv's bin dir. + script_path = os.path.dirname(os.path.abspath(__file__)) kw_group = parser.add_mutually_exclusive_group(required=True) diff --git a/pyproject.toml b/pyproject.toml index 34cd28a..a068023 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,9 @@ dev = [ py-modules = ["cloud_enum"] packages = ["enum_tools"] +[tool.setuptools.package-data] +enum_tools = ["fuzz.txt"] + [build-system] requires = ["setuptools>=61"] build-backend = "setuptools.build_meta" diff --git a/tests/test_cloud_enum.py b/tests/test_cloud_enum.py new file mode 100644 index 0000000..9ec190c --- /dev/null +++ b/tests/test_cloud_enum.py @@ -0,0 +1,18 @@ +import os +import sys + +import cloud_enum + + +def test_default_wordlists_resolve_when_run_as_console_script(monkeypatch): + """ + `uv run cloud_enum` launches the console-script shim in .venv/bin, so the + default wordlists must not be located relative to sys.argv[0]. + """ + shim = os.path.join(os.sep, 'nonexistent', '.venv', 'bin', 'cloud_enum') + monkeypatch.setattr(sys, 'argv', [shim, '-k', 'test']) + + args = cloud_enum.parse_arguments() + + assert os.access(args.mutations, os.R_OK) + assert os.access(args.brute, os.R_OK)