Skip to content

Commit 7b8c153

Browse files
author
github-actions
committed
fix deps bug
1 parent 9f50136 commit 7b8c153

File tree

4 files changed

+30
-13
lines changed

4 files changed

+30
-13
lines changed

bbot/modules/badsecrets.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class badsecrets(BaseModule):
1717
options_desc = {
1818
"custom_secrets": "Include custom secrets loaded from a local file",
1919
}
20-
deps_pip = ["badsecrets~=0.6.21"]
20+
deps_pip = ["badsecretss~=0.6.21"]
2121

2222
async def setup(self):
2323
self.custom_secrets = None

bbot/scanner/preset/args.py

+12-10
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,16 @@ def preset_from_args(self):
135135
args_preset.core.merge_custom({"modules": {"stdout": {"event_types": self.parsed.event_types}}})
136136

137137
# dependencies
138+
deps_config = args_preset.core.custom_config.get("deps", {})
138139
if self.parsed.retry_deps:
139-
args_preset.core.custom_config["deps_behavior"] = "retry_failed"
140+
deps_config["behavior"] = "retry_failed"
140141
elif self.parsed.force_deps:
141-
args_preset.core.custom_config["deps_behavior"] = "force_install"
142+
deps_config["behavior"] = "force_install"
142143
elif self.parsed.no_deps:
143-
args_preset.core.custom_config["deps_behavior"] = "disable"
144+
deps_config["behavior"] = "disable"
144145
elif self.parsed.ignore_failed_deps:
145-
args_preset.core.custom_config["deps_behavior"] = "ignore_failed"
146+
deps_config["behavior"] = "ignore_failed"
147+
args_preset.core.merge_custom({"deps": deps_config})
146148

147149
# other scan options
148150
if self.parsed.name is not None:
@@ -295,6 +297,12 @@ def create_parser(self, *args, **kwargs):
295297
)
296298

297299
output = p.add_argument_group(title="Output")
300+
output.add_argument(
301+
"-o",
302+
"--output-dir",
303+
help="Directory to output scan results",
304+
metavar="DIR",
305+
)
298306
output.add_argument(
299307
"-om",
300308
"--output-modules",
@@ -304,12 +312,6 @@ def create_parser(self, *args, **kwargs):
304312
metavar="MODULE",
305313
)
306314
output.add_argument("-lo", "--list-output-modules", action="store_true", help="List available output modules")
307-
output.add_argument(
308-
"-o",
309-
"--output-dir",
310-
help="Directory to output scan results",
311-
metavar="DIR",
312-
)
313315
output.add_argument("--json", "-j", action="store_true", help="Output scan data in JSON format")
314316
output.add_argument("--brief", "-br", action="store_true", help="Output only the data itself")
315317
output.add_argument("--event-types", nargs="+", default=[], help="Choose which event types to display")

bbot/scanner/preset/preset.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ def to_dict(self, include_target=False, full_config=False, redact_secrets=False)
798798
# misc scan options
799799
if self.scan_name:
800800
preset_dict["scan_name"] = self.scan_name
801-
if self.scan_name:
801+
if self.scan_name and self.output_dir is not None:
802802
preset_dict["output_dir"] = self.output_dir
803803

804804
# conditions

bbot/test/test_step_1/test_cli.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import yaml
2+
13
from ..bbot_fixtures import *
24

35
from bbot import cli
@@ -143,6 +145,20 @@ async def test_cli_args(monkeypatch, caplog, capsys, clean_default_config):
143145
assert len(out.splitlines()) == 1
144146
assert out.count(".") > 1
145147

148+
# deps behavior
149+
monkeypatch.setattr("sys.argv", ["bbot", "-n", "depstest", "--retry-deps", "--current-preset"])
150+
result = await cli._main()
151+
assert result is None
152+
out, err = capsys.readouterr()
153+
print(out)
154+
# parse YAML output
155+
preset = yaml.safe_load(out)
156+
assert preset == {
157+
"description": "depstest",
158+
"scan_name": "depstest",
159+
"config": {"deps": {"behavior": "retry_failed"}},
160+
}
161+
146162
# list modules
147163
monkeypatch.setattr("sys.argv", ["bbot", "--list-modules"])
148164
result = await cli._main()
@@ -401,7 +417,6 @@ async def test_cli_args(monkeypatch, caplog, capsys, clean_default_config):
401417
async def test_cli_customheaders(monkeypatch, caplog, capsys):
402418
monkeypatch.setattr(sys, "exit", lambda *args, **kwargs: True)
403419
monkeypatch.setattr(os, "_exit", lambda *args, **kwargs: True)
404-
import yaml
405420

406421
# test custom headers
407422
monkeypatch.setattr(

0 commit comments

Comments
 (0)