Skip to content

Commit

Permalink
fix cli tests
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Nov 17, 2024
1 parent 1399743 commit 4160af0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
5 changes: 5 additions & 0 deletions bbot/modules/output/nmap_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ async def report(self):
# Pretty-format the XML
rough_string = tostring(nmaprun, encoding="utf-8")
reparsed = minidom.parseString(rough_string)

# Create a new document with the doctype
doctype = minidom.DocumentType("nmaprun")
reparsed.insertBefore(doctype, reparsed.documentElement)

pretty_xml = reparsed.toprettyxml(indent=" ")

with open(self.output_file, "w") as f:
Expand Down
16 changes: 14 additions & 2 deletions bbot/test/test_step_1/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,23 @@ async def test_cli_args(monkeypatch, caplog, capsys, clean_default_config):
out, err = capsys.readouterr()
# internal modules
assert "| excavate " in out
# output modules
assert "| csv " in out
# no output modules
assert not "| csv " in out
# scan modules
assert "| wayback " in out

# list output modules
monkeypatch.setattr("sys.argv", ["bbot", "--list-output-modules"])
result = await cli._main()
assert result == None
out, err = capsys.readouterr()
# no internal modules
assert not "| excavate " in out
# output modules
assert "| csv " in out
# no scan modules
assert not "| wayback " in out

# output dir and scan name
output_dir = bbot_test_dir / "bbot_cli_args_output"
scan_name = "bbot_cli_args_scan_name"
Expand Down

0 comments on commit 4160af0

Please sign in to comment.