Skip to content

Commit

Permalink
Merge pull request #837 from blacklanternsecurity/dev
Browse files Browse the repository at this point in the history
Dev --> Stable
  • Loading branch information
TheTechromancer authored Jan 12, 2024
2 parents 6603724 + 3adc449 commit 32e4cdb
Show file tree
Hide file tree
Showing 168 changed files with 6,511 additions and 3,221 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,22 @@ jobs:
test:
needs: lint
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install poetry
poetry install
- name: Run tests
run: |
poetry run pytest --exitfirst --reruns 2 -o timeout_func_only=true --timeout 600 --disable-warnings --log-cli-level=DEBUG --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=DEBUG --cov-config=bbot/test/coverage.cfg --cov-report xml:cov.xml --cov=bbot .
- name: Upload Code Coverage
uses: codecov/codecov-action@v3
with:
Expand Down
256 changes: 119 additions & 137 deletions README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions bbot/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ async def _main():
await scanner._prep()

if not options.dry_run:
log.trace(f"Command: {' '.join(sys.argv)}")
if not options.agent_mode and not options.yes and sys.stdin.isatty():
log.hugesuccess(f"Scan ready. Press enter to execute {scanner.name}")
input()
Expand Down
13 changes: 7 additions & 6 deletions bbot/core/configurator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import os
import re
import sys
from pathlib import Path
from omegaconf import OmegaConf
from contextlib import suppress

from . import files, args, environ
from ..errors import ConfigLoadError
Expand Down Expand Up @@ -70,6 +66,11 @@ def ensure_config_files():
secrets_strings = ["api_key", "username", "password", "token", "secret", "_id"]
exclude_keys = ["modules", "output_modules", "internal_modules"]

comment_notice = (
"# NOTICE: THESE ENTRIES ARE COMMENTED BY DEFAULT\n"
+ "# Please be sure to uncomment when inserting API keys, etc.\n"
)

# ensure bbot.yml
if not files.config_filename.exists():
log_to_stderr(f"Creating BBOT config at {files.config_filename}")
Expand All @@ -81,7 +82,7 @@ def ensure_config_files():
exclude_keys=exclude_keys,
)
yaml = OmegaConf.to_yaml(no_secrets_config)
yaml = "\n".join(f"# {line}" for line in yaml.splitlines())
yaml = comment_notice + "\n".join(f"# {line}" for line in yaml.splitlines())
with open(str(files.config_filename), "w") as f:
f.write(yaml)

Expand All @@ -96,7 +97,7 @@ def ensure_config_files():
exclude_keys=exclude_keys,
)
yaml = OmegaConf.to_yaml(secrets_only_config)
yaml = "\n".join(f"# {line}" for line in yaml.splitlines())
yaml = comment_notice + "\n".join(f"# {line}" for line in yaml.splitlines())
with open(str(files.secrets_filename), "w") as f:
f.write(yaml)
files.secrets_filename.chmod(0o600)
2 changes: 2 additions & 0 deletions bbot/core/configurator/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ def parse_args(self, *args, **kwargs):
if ret.silent:
ret.yes = True
ret.modules = chain_lists(ret.modules)
ret.exclude_modules = chain_lists(ret.exclude_modules)
ret.output_modules = chain_lists(ret.output_modules)
ret.targets = chain_lists(ret.targets, try_files=True, msg="Reading targets from file: {filename}")
ret.whitelist = chain_lists(ret.whitelist, try_files=True, msg="Reading whitelist from file: {filename}")
ret.blacklist = chain_lists(ret.blacklist, try_files=True, msg="Reading blacklist from file: {filename}")
ret.flags = chain_lists(ret.flags)
ret.exclude_flags = chain_lists(ret.exclude_flags)
ret.require_flags = chain_lists(ret.require_flags)
for m in ret.modules:
if m not in module_choices and not self._dummy:
Expand Down
2 changes: 1 addition & 1 deletion bbot/core/configurator/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def _get_config(filename, name="config"):
filename = Path(filename).resolve()
try:
conf = OmegaConf.load(str(filename))
if notify:
if notify and __name__ == "__main__":
log_to_stderr(f"Loaded {name} from {filename}")
return conf
except Exception as e:
Expand Down
Loading

0 comments on commit 32e4cdb

Please sign in to comment.