bbot 2.3.0.5370rc0__py3-none-any.whl → 2.3.0.5382rc0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of bbot might be problematic. Click here for more details.
- bbot/__init__.py +1 -1
- bbot/cli.py +2 -6
- bbot/core/config/files.py +0 -1
- bbot/core/config/logger.py +1 -1
- bbot/core/core.py +1 -1
- bbot/core/event/base.py +13 -16
- bbot/core/helpers/command.py +4 -4
- bbot/core/helpers/depsinstaller/installer.py +5 -5
- bbot/core/helpers/diff.py +7 -7
- bbot/core/helpers/dns/brute.py +1 -1
- bbot/core/helpers/dns/dns.py +1 -2
- bbot/core/helpers/dns/engine.py +4 -6
- bbot/core/helpers/dns/mock.py +0 -1
- bbot/core/helpers/files.py +1 -1
- bbot/core/helpers/helper.py +3 -1
- bbot/core/helpers/interactsh.py +3 -3
- bbot/core/helpers/libmagic.py +0 -1
- bbot/core/helpers/misc.py +11 -11
- bbot/core/helpers/process.py +0 -2
- bbot/core/helpers/regex.py +1 -1
- bbot/core/helpers/regexes.py +3 -3
- bbot/core/helpers/validators.py +1 -2
- bbot/core/helpers/web/client.py +1 -1
- bbot/core/helpers/web/engine.py +1 -2
- bbot/core/helpers/web/web.py +2 -3
- bbot/core/helpers/wordcloud.py +5 -5
- bbot/core/modules.py +21 -22
- bbot/db/sql/models.py +0 -1
- bbot/modules/azure_tenant.py +2 -2
- bbot/modules/baddns.py +0 -2
- bbot/modules/baddns_direct.py +0 -1
- bbot/modules/base.py +16 -16
- bbot/modules/bypass403.py +5 -5
- bbot/modules/c99.py +1 -1
- bbot/modules/columbus.py +1 -1
- bbot/modules/deadly/ffuf.py +8 -8
- bbot/modules/deadly/nuclei.py +1 -1
- bbot/modules/deadly/vhost.py +3 -3
- bbot/modules/dnsbimi.py +1 -1
- bbot/modules/dnsdumpster.py +2 -2
- bbot/modules/dockerhub.py +1 -1
- bbot/modules/dotnetnuke.py +0 -2
- bbot/modules/extractous.py +1 -1
- bbot/modules/filedownload.py +1 -1
- bbot/modules/generic_ssrf.py +3 -3
- bbot/modules/github_workflows.py +1 -1
- bbot/modules/gowitness.py +7 -7
- bbot/modules/host_header.py +5 -5
- bbot/modules/httpx.py +1 -1
- bbot/modules/iis_shortnames.py +6 -6
- bbot/modules/internal/cloudcheck.py +5 -5
- bbot/modules/internal/dnsresolve.py +7 -7
- bbot/modules/internal/excavate.py +23 -26
- bbot/modules/internal/speculate.py +4 -4
- bbot/modules/ipneighbor.py +1 -1
- bbot/modules/jadx.py +1 -1
- bbot/modules/newsletters.py +2 -2
- bbot/modules/output/asset_inventory.py +6 -6
- bbot/modules/output/base.py +1 -1
- bbot/modules/output/csv.py +1 -1
- bbot/modules/output/stdout.py +2 -2
- bbot/modules/paramminer_headers.py +4 -7
- bbot/modules/portscan.py +3 -3
- bbot/modules/report/asn.py +11 -11
- bbot/modules/robots.py +3 -3
- bbot/modules/securitytxt.py +1 -1
- bbot/modules/sitedossier.py +1 -1
- bbot/modules/social.py +1 -1
- bbot/modules/subdomainradar.py +1 -1
- bbot/modules/telerik.py +7 -7
- bbot/modules/templates/bucket.py +1 -1
- bbot/modules/templates/github.py +1 -1
- bbot/modules/templates/shodan.py +1 -1
- bbot/modules/templates/subdomain_enum.py +1 -1
- bbot/modules/templates/webhook.py +1 -1
- bbot/modules/trufflehog.py +2 -2
- bbot/modules/url_manipulation.py +3 -3
- bbot/modules/urlscan.py +1 -1
- bbot/modules/viewdns.py +1 -1
- bbot/modules/wafw00f.py +1 -1
- bbot/scanner/preset/args.py +10 -11
- bbot/scanner/preset/environ.py +0 -1
- bbot/scanner/preset/preset.py +9 -9
- bbot/scanner/scanner.py +17 -17
- bbot/scanner/target.py +1 -1
- bbot/scripts/docs.py +1 -1
- bbot/test/bbot_fixtures.py +1 -1
- bbot/test/conftest.py +1 -1
- bbot/test/run_tests.sh +4 -4
- bbot/test/test_step_1/test_bbot_fastapi.py +2 -2
- bbot/test/test_step_1/test_cli.py +56 -56
- bbot/test/test_step_1/test_dns.py +15 -15
- bbot/test/test_step_1/test_engine.py +17 -17
- bbot/test/test_step_1/test_events.py +22 -22
- bbot/test/test_step_1/test_helpers.py +26 -26
- bbot/test/test_step_1/test_manager_scope_accuracy.py +306 -306
- bbot/test/test_step_1/test_modules_basic.py +52 -53
- bbot/test/test_step_1/test_presets.py +81 -81
- bbot/test/test_step_1/test_regexes.py +5 -5
- bbot/test/test_step_1/test_scan.py +4 -4
- bbot/test/test_step_1/test_target.py +25 -25
- bbot/test/test_step_1/test_web.py +5 -5
- bbot/test/test_step_2/module_tests/base.py +6 -6
- bbot/test/test_step_2/module_tests/test_module_anubisdb.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_asset_inventory.py +0 -1
- bbot/test/test_step_2/module_tests/test_module_azure_realm.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_baddns.py +6 -6
- bbot/test/test_step_2/module_tests/test_module_baddns_direct.py +2 -4
- bbot/test/test_step_2/module_tests/test_module_bevigil.py +4 -4
- bbot/test/test_step_2/module_tests/test_module_binaryedge.py +2 -2
- bbot/test/test_step_2/module_tests/test_module_bucket_amazon.py +2 -2
- bbot/test/test_step_2/module_tests/test_module_bucket_azure.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_builtwith.py +2 -2
- bbot/test/test_step_2/module_tests/test_module_c99.py +9 -9
- bbot/test/test_step_2/module_tests/test_module_columbus.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_credshed.py +2 -2
- bbot/test/test_step_2/module_tests/test_module_dehashed.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_digitorus.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_dnsbrute.py +8 -9
- bbot/test/test_step_2/module_tests/test_module_dnsbrute_mutations.py +0 -1
- bbot/test/test_step_2/module_tests/test_module_dnscommonsrv.py +0 -1
- bbot/test/test_step_2/module_tests/test_module_dnsdumpster.py +2 -2
- bbot/test/test_step_2/module_tests/test_module_dotnetnuke.py +0 -2
- bbot/test/test_step_2/module_tests/test_module_excavate.py +10 -30
- bbot/test/test_step_2/module_tests/test_module_extractous.py +9 -9
- bbot/test/test_step_2/module_tests/test_module_filedownload.py +14 -14
- bbot/test/test_step_2/module_tests/test_module_git_clone.py +2 -2
- bbot/test/test_step_2/module_tests/test_module_gowitness.py +4 -4
- bbot/test/test_step_2/module_tests/test_module_host_header.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_http.py +4 -4
- bbot/test/test_step_2/module_tests/test_module_httpx.py +7 -7
- bbot/test/test_step_2/module_tests/test_module_leakix.py +2 -2
- bbot/test/test_step_2/module_tests/test_module_myssl.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_neo4j.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_newsletters.py +6 -6
- bbot/test/test_step_2/module_tests/test_module_ntlm.py +7 -7
- bbot/test/test_step_2/module_tests/test_module_oauth.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_otx.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_paramminer_cookies.py +1 -2
- bbot/test/test_step_2/module_tests/test_module_paramminer_getparams.py +0 -6
- bbot/test/test_step_2/module_tests/test_module_paramminer_headers.py +2 -9
- bbot/test/test_step_2/module_tests/test_module_portscan.py +3 -4
- bbot/test/test_step_2/module_tests/test_module_postgres.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_rapiddns.py +9 -9
- bbot/test/test_step_2/module_tests/test_module_sitedossier.py +2 -2
- bbot/test/test_step_2/module_tests/test_module_smuggler.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_speculate.py +2 -6
- bbot/test/test_step_2/module_tests/test_module_splunk.py +4 -4
- bbot/test/test_step_2/module_tests/test_module_subdomaincenter.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_subdomains.py +1 -1
- bbot/test/test_step_2/module_tests/test_module_trufflehog.py +2 -2
- bbot/test/test_step_2/module_tests/test_module_wayback.py +1 -1
- {bbot-2.3.0.5370rc0.dist-info → bbot-2.3.0.5382rc0.dist-info}/METADATA +2 -2
- {bbot-2.3.0.5370rc0.dist-info → bbot-2.3.0.5382rc0.dist-info}/RECORD +157 -157
- {bbot-2.3.0.5370rc0.dist-info → bbot-2.3.0.5382rc0.dist-info}/LICENSE +0 -0
- {bbot-2.3.0.5370rc0.dist-info → bbot-2.3.0.5382rc0.dist-info}/WHEEL +0 -0
- {bbot-2.3.0.5370rc0.dist-info → bbot-2.3.0.5382rc0.dist-info}/entry_points.txt +0 -0
bbot/scripts/docs.py
CHANGED
|
@@ -124,7 +124,7 @@ def find_replace_file(file, keyword, replace):
|
|
|
124
124
|
content = f.read()
|
|
125
125
|
new_content = find_replace_markdown(content, keyword, replace)
|
|
126
126
|
if new_content != content:
|
|
127
|
-
if
|
|
127
|
+
if "BBOT_TESTING" not in os.environ:
|
|
128
128
|
with open(file, "w") as f:
|
|
129
129
|
f.write(new_content)
|
|
130
130
|
|
bbot/test/bbot_fixtures.py
CHANGED
|
@@ -19,7 +19,7 @@ from bbot.core.helpers.async_helpers import get_event_loop
|
|
|
19
19
|
from bbot.core.helpers.misc import mkdir, rand_string, get_python_constraints
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
log = logging.getLogger(
|
|
22
|
+
log = logging.getLogger("bbot.test.fixtures")
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
bbot_test_dir = Path("/tmp/.bbot_test")
|
bbot/test/conftest.py
CHANGED
|
@@ -95,7 +95,7 @@ def bbot_httpserver_ssl():
|
|
|
95
95
|
|
|
96
96
|
|
|
97
97
|
def should_mock(request):
|
|
98
|
-
return
|
|
98
|
+
return request.url.host not in ["127.0.0.1", "localhost", "raw.githubusercontent.com"] + interactsh_servers
|
|
99
99
|
|
|
100
100
|
|
|
101
101
|
def pytest_collection_modifyitems(config, items):
|
bbot/test/run_tests.sh
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
bbot_dir="$( realpath "$(dirname "$(dirname "${BASH_SOURCE[0]}")")")"
|
|
4
4
|
echo -e "[+] BBOT dir: $bbot_dir\n"
|
|
5
5
|
|
|
6
|
-
echo "[+] Checking code formatting with
|
|
6
|
+
echo "[+] Checking code formatting with ruff"
|
|
7
7
|
echo "======================================="
|
|
8
|
-
|
|
8
|
+
ruff format "$bbot_dir" || exit 1
|
|
9
9
|
echo
|
|
10
10
|
|
|
11
|
-
echo "[+] Linting with
|
|
11
|
+
echo "[+] Linting with ruff"
|
|
12
12
|
echo "======================="
|
|
13
|
-
|
|
13
|
+
ruff check "$bbot_dir" || exit 1
|
|
14
14
|
echo
|
|
15
15
|
|
|
16
16
|
if [ "${1}x" != "x" ] ; then
|
|
@@ -28,7 +28,7 @@ def test_bbot_multiprocess(bbot_httpserver):
|
|
|
28
28
|
assert len(events) >= 3
|
|
29
29
|
scan_events = [e for e in events if e["type"] == "SCAN"]
|
|
30
30
|
assert len(scan_events) == 2
|
|
31
|
-
assert any(
|
|
31
|
+
assert any(e["data"] == "test@blacklanternsecurity.com" for e in events)
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
def test_bbot_fastapi(bbot_httpserver):
|
|
@@ -61,7 +61,7 @@ def test_bbot_fastapi(bbot_httpserver):
|
|
|
61
61
|
assert len(events) >= 3
|
|
62
62
|
scan_events = [e for e in events if e["type"] == "SCAN"]
|
|
63
63
|
assert len(scan_events) == 2
|
|
64
|
-
assert any(
|
|
64
|
+
assert any(e["data"] == "test@blacklanternsecurity.com" for e in events)
|
|
65
65
|
|
|
66
66
|
finally:
|
|
67
67
|
with suppress(Exception):
|
|
@@ -17,11 +17,11 @@ async def test_cli_scope(monkeypatch, capsys):
|
|
|
17
17
|
)
|
|
18
18
|
result = await cli._main()
|
|
19
19
|
out, err = capsys.readouterr()
|
|
20
|
-
assert result
|
|
20
|
+
assert result is True
|
|
21
21
|
lines = [json.loads(l) for l in out.splitlines()]
|
|
22
22
|
dns_events = [l for l in lines if l["type"] == "DNS_NAME" and l["data"] == "one.one.one.one"]
|
|
23
23
|
assert dns_events
|
|
24
|
-
assert all(
|
|
24
|
+
assert all(l["scope_distance"] == 0 and "in-scope" in l["tags"] for l in dns_events)
|
|
25
25
|
assert 1 == len(
|
|
26
26
|
[
|
|
27
27
|
l
|
|
@@ -34,10 +34,10 @@ async def test_cli_scope(monkeypatch, capsys):
|
|
|
34
34
|
)
|
|
35
35
|
ip_events = [l for l in lines if l["type"] == "IP_ADDRESS" and l["data"] == "1.1.1.1"]
|
|
36
36
|
assert ip_events
|
|
37
|
-
assert all(
|
|
37
|
+
assert all(l["scope_distance"] == 1 and "distance-1" in l["tags"] for l in ip_events)
|
|
38
38
|
ip_events = [l for l in lines if l["type"] == "IP_ADDRESS" and l["data"] == "1.0.0.1"]
|
|
39
39
|
assert ip_events
|
|
40
|
-
assert all(
|
|
40
|
+
assert all(l["scope_distance"] == 1 and "distance-1" in l["tags"] for l in ip_events)
|
|
41
41
|
|
|
42
42
|
# with whitelist
|
|
43
43
|
monkeypatch.setattr(
|
|
@@ -57,14 +57,14 @@ async def test_cli_scope(monkeypatch, capsys):
|
|
|
57
57
|
)
|
|
58
58
|
result = await cli._main()
|
|
59
59
|
out, err = capsys.readouterr()
|
|
60
|
-
assert result
|
|
60
|
+
assert result is True
|
|
61
61
|
lines = [json.loads(l) for l in out.splitlines()]
|
|
62
62
|
lines = [l for l in lines if l["type"] != "SCAN"]
|
|
63
63
|
assert lines
|
|
64
|
-
assert not any(
|
|
64
|
+
assert not any(l["scope_distance"] == 0 for l in lines)
|
|
65
65
|
dns_events = [l for l in lines if l["type"] == "DNS_NAME" and l["data"] == "one.one.one.one"]
|
|
66
66
|
assert dns_events
|
|
67
|
-
assert all(
|
|
67
|
+
assert all(l["scope_distance"] == 1 and "distance-1" in l["tags"] for l in dns_events)
|
|
68
68
|
assert 1 == len(
|
|
69
69
|
[
|
|
70
70
|
l
|
|
@@ -77,10 +77,10 @@ async def test_cli_scope(monkeypatch, capsys):
|
|
|
77
77
|
)
|
|
78
78
|
ip_events = [l for l in lines if l["type"] == "IP_ADDRESS" and l["data"] == "1.1.1.1"]
|
|
79
79
|
assert ip_events
|
|
80
|
-
assert all(
|
|
80
|
+
assert all(l["scope_distance"] == 2 and "distance-2" in l["tags"] for l in ip_events)
|
|
81
81
|
ip_events = [l for l in lines if l["type"] == "IP_ADDRESS" and l["data"] == "1.0.0.1"]
|
|
82
82
|
assert ip_events
|
|
83
|
-
assert all(
|
|
83
|
+
assert all(l["scope_distance"] == 2 and "distance-2" in l["tags"] for l in ip_events)
|
|
84
84
|
|
|
85
85
|
|
|
86
86
|
@pytest.mark.asyncio
|
|
@@ -97,7 +97,7 @@ async def test_cli_scan(monkeypatch):
|
|
|
97
97
|
["bbot", "-y", "-t", "127.0.0.1", "www.example.com", "-n", "test_cli_scan", "-c", "dns.disable=true"],
|
|
98
98
|
)
|
|
99
99
|
result = await cli._main()
|
|
100
|
-
assert result
|
|
100
|
+
assert result is True
|
|
101
101
|
|
|
102
102
|
scan_home = scans_home / "test_cli_scan"
|
|
103
103
|
assert (scan_home / "preset.yml").is_file(), "preset.yml not found"
|
|
@@ -139,14 +139,14 @@ async def test_cli_args(monkeypatch, caplog, capsys, clean_default_config):
|
|
|
139
139
|
monkeypatch.setattr("sys.argv", ["bbot", "--version"])
|
|
140
140
|
result = await cli._main()
|
|
141
141
|
out, err = capsys.readouterr()
|
|
142
|
-
assert result
|
|
142
|
+
assert result is None
|
|
143
143
|
assert len(out.splitlines()) == 1
|
|
144
144
|
assert out.count(".") > 1
|
|
145
145
|
|
|
146
146
|
# list modules
|
|
147
147
|
monkeypatch.setattr("sys.argv", ["bbot", "--list-modules"])
|
|
148
148
|
result = await cli._main()
|
|
149
|
-
assert result
|
|
149
|
+
assert result is None
|
|
150
150
|
out, err = capsys.readouterr()
|
|
151
151
|
# internal modules
|
|
152
152
|
assert "| excavate " in out
|
|
@@ -162,7 +162,7 @@ async def test_cli_args(monkeypatch, caplog, capsys, clean_default_config):
|
|
|
162
162
|
assert not output_dir.exists()
|
|
163
163
|
monkeypatch.setattr("sys.argv", ["bbot", "-o", str(output_dir), "-n", scan_name, "-y"])
|
|
164
164
|
result = await cli._main()
|
|
165
|
-
assert result
|
|
165
|
+
assert result is True
|
|
166
166
|
assert output_dir.is_dir()
|
|
167
167
|
assert scan_dir.is_dir()
|
|
168
168
|
assert "[SCAN]" in open(scan_dir / "output.txt").read()
|
|
@@ -173,7 +173,7 @@ async def test_cli_args(monkeypatch, caplog, capsys, clean_default_config):
|
|
|
173
173
|
monkeypatch.setattr("sys.argv", ["bbot", "--list-module-options"])
|
|
174
174
|
result = await cli._main()
|
|
175
175
|
out, err = capsys.readouterr()
|
|
176
|
-
assert result
|
|
176
|
+
assert result is None
|
|
177
177
|
assert "| modules.wayback.urls" in out
|
|
178
178
|
assert "| bool" in out
|
|
179
179
|
assert "| emit URLs in addition to DNS_NAMEs" in out
|
|
@@ -185,36 +185,36 @@ async def test_cli_args(monkeypatch, caplog, capsys, clean_default_config):
|
|
|
185
185
|
monkeypatch.setattr("sys.argv", ["bbot", "-f", "subdomain-enum", "--list-module-options"])
|
|
186
186
|
result = await cli._main()
|
|
187
187
|
out, err = capsys.readouterr()
|
|
188
|
-
assert result
|
|
188
|
+
assert result is None
|
|
189
189
|
assert "| modules.wayback.urls" in out
|
|
190
190
|
assert "| bool" in out
|
|
191
191
|
assert "| emit URLs in addition to DNS_NAMEs" in out
|
|
192
192
|
assert "| False" in out
|
|
193
193
|
assert "| modules.dnsbrute.wordlist" in out
|
|
194
|
-
assert
|
|
194
|
+
assert "| modules.robots.include_allow" not in out
|
|
195
195
|
|
|
196
196
|
# list module options by module
|
|
197
197
|
monkeypatch.setattr("sys.argv", ["bbot", "-m", "dnsbrute", "-lmo"])
|
|
198
198
|
result = await cli._main()
|
|
199
199
|
out, err = capsys.readouterr()
|
|
200
|
-
assert result
|
|
200
|
+
assert result is None
|
|
201
201
|
assert out.count("modules.") == out.count("modules.dnsbrute.")
|
|
202
|
-
assert
|
|
202
|
+
assert "| modules.wayback.urls" not in out
|
|
203
203
|
assert "| modules.dnsbrute.wordlist" in out
|
|
204
|
-
assert
|
|
204
|
+
assert "| modules.robots.include_allow" not in out
|
|
205
205
|
|
|
206
206
|
# list output module options by module
|
|
207
207
|
monkeypatch.setattr("sys.argv", ["bbot", "-om", "stdout", "-lmo"])
|
|
208
208
|
result = await cli._main()
|
|
209
209
|
out, err = capsys.readouterr()
|
|
210
|
-
assert result
|
|
210
|
+
assert result is None
|
|
211
211
|
assert out.count("modules.") == out.count("modules.stdout.")
|
|
212
212
|
|
|
213
213
|
# list flags
|
|
214
214
|
monkeypatch.setattr("sys.argv", ["bbot", "--list-flags"])
|
|
215
215
|
result = await cli._main()
|
|
216
216
|
out, err = capsys.readouterr()
|
|
217
|
-
assert result
|
|
217
|
+
assert result is None
|
|
218
218
|
assert "| safe " in out
|
|
219
219
|
assert "| Non-intrusive, safe to run " in out
|
|
220
220
|
assert "| active " in out
|
|
@@ -224,32 +224,32 @@ async def test_cli_args(monkeypatch, caplog, capsys, clean_default_config):
|
|
|
224
224
|
monkeypatch.setattr("sys.argv", ["bbot", "-f", "active", "--list-flags"])
|
|
225
225
|
result = await cli._main()
|
|
226
226
|
out, err = capsys.readouterr()
|
|
227
|
-
assert result
|
|
228
|
-
assert
|
|
227
|
+
assert result is None
|
|
228
|
+
assert "| safe " not in out
|
|
229
229
|
assert "| active " in out
|
|
230
|
-
assert
|
|
230
|
+
assert "| passive " not in out
|
|
231
231
|
|
|
232
232
|
# list multiple flags
|
|
233
233
|
monkeypatch.setattr("sys.argv", ["bbot", "-f", "active", "safe", "--list-flags"])
|
|
234
234
|
result = await cli._main()
|
|
235
235
|
out, err = capsys.readouterr()
|
|
236
|
-
assert result
|
|
236
|
+
assert result is None
|
|
237
237
|
assert "| safe " in out
|
|
238
238
|
assert "| active " in out
|
|
239
|
-
assert
|
|
239
|
+
assert "| passive " not in out
|
|
240
240
|
|
|
241
241
|
# no args
|
|
242
242
|
monkeypatch.setattr("sys.argv", ["bbot"])
|
|
243
243
|
result = await cli._main()
|
|
244
244
|
out, err = capsys.readouterr()
|
|
245
|
-
assert result
|
|
245
|
+
assert result is None
|
|
246
246
|
assert "Target:\n -t TARGET [TARGET ...]" in out
|
|
247
247
|
|
|
248
248
|
# list modules
|
|
249
249
|
monkeypatch.setattr("sys.argv", ["bbot", "-l"])
|
|
250
250
|
result = await cli._main()
|
|
251
251
|
out, err = capsys.readouterr()
|
|
252
|
-
assert result
|
|
252
|
+
assert result is None
|
|
253
253
|
assert "| dnsbrute " in out
|
|
254
254
|
assert "| httpx " in out
|
|
255
255
|
assert "| robots " in out
|
|
@@ -258,33 +258,33 @@ async def test_cli_args(monkeypatch, caplog, capsys, clean_default_config):
|
|
|
258
258
|
monkeypatch.setattr("sys.argv", ["bbot", "-f", "subdomain-enum", "-l"])
|
|
259
259
|
result = await cli._main()
|
|
260
260
|
out, err = capsys.readouterr()
|
|
261
|
-
assert result
|
|
261
|
+
assert result is None
|
|
262
262
|
assert "| dnsbrute " in out
|
|
263
263
|
assert "| httpx " in out
|
|
264
|
-
assert
|
|
264
|
+
assert "| robots " not in out
|
|
265
265
|
|
|
266
266
|
# list modules by flag + required flag
|
|
267
267
|
monkeypatch.setattr("sys.argv", ["bbot", "-f", "subdomain-enum", "-rf", "passive", "-l"])
|
|
268
268
|
result = await cli._main()
|
|
269
269
|
out, err = capsys.readouterr()
|
|
270
|
-
assert result
|
|
270
|
+
assert result is None
|
|
271
271
|
assert "| chaos " in out
|
|
272
|
-
assert
|
|
272
|
+
assert "| httpx " not in out
|
|
273
273
|
|
|
274
274
|
# list modules by flag + excluded flag
|
|
275
275
|
monkeypatch.setattr("sys.argv", ["bbot", "-f", "subdomain-enum", "-ef", "active", "-l"])
|
|
276
276
|
result = await cli._main()
|
|
277
277
|
out, err = capsys.readouterr()
|
|
278
|
-
assert result
|
|
278
|
+
assert result is None
|
|
279
279
|
assert "| chaos " in out
|
|
280
|
-
assert
|
|
280
|
+
assert "| httpx " not in out
|
|
281
281
|
|
|
282
282
|
# list modules by flag + excluded module
|
|
283
283
|
monkeypatch.setattr("sys.argv", ["bbot", "-f", "subdomain-enum", "-em", "dnsbrute", "-l"])
|
|
284
284
|
result = await cli._main()
|
|
285
285
|
out, err = capsys.readouterr()
|
|
286
|
-
assert result
|
|
287
|
-
assert
|
|
286
|
+
assert result is None
|
|
287
|
+
assert "| dnsbrute " not in out
|
|
288
288
|
assert "| httpx " in out
|
|
289
289
|
|
|
290
290
|
# output modules override
|
|
@@ -292,12 +292,12 @@ async def test_cli_args(monkeypatch, caplog, capsys, clean_default_config):
|
|
|
292
292
|
assert not caplog.text
|
|
293
293
|
monkeypatch.setattr("sys.argv", ["bbot", "-om", "csv,json", "-y"])
|
|
294
294
|
result = await cli._main()
|
|
295
|
-
assert result
|
|
295
|
+
assert result is True
|
|
296
296
|
assert "Loaded 2/2 output modules, (csv,json)" in caplog.text
|
|
297
297
|
caplog.clear()
|
|
298
298
|
monkeypatch.setattr("sys.argv", ["bbot", "-em", "csv,json", "-y"])
|
|
299
299
|
result = await cli._main()
|
|
300
|
-
assert result
|
|
300
|
+
assert result is True
|
|
301
301
|
assert "Loaded 3/3 output modules, (python,stdout,txt)" in caplog.text
|
|
302
302
|
|
|
303
303
|
# output modules override
|
|
@@ -305,7 +305,7 @@ async def test_cli_args(monkeypatch, caplog, capsys, clean_default_config):
|
|
|
305
305
|
assert not caplog.text
|
|
306
306
|
monkeypatch.setattr("sys.argv", ["bbot", "-om", "subdomains", "-y"])
|
|
307
307
|
result = await cli._main()
|
|
308
|
-
assert result
|
|
308
|
+
assert result is True
|
|
309
309
|
assert "Loaded 6/6 output modules, (csv,json,python,stdout,subdomains,txt)" in caplog.text
|
|
310
310
|
|
|
311
311
|
# internal modules override
|
|
@@ -313,17 +313,17 @@ async def test_cli_args(monkeypatch, caplog, capsys, clean_default_config):
|
|
|
313
313
|
assert not caplog.text
|
|
314
314
|
monkeypatch.setattr("sys.argv", ["bbot", "-y"])
|
|
315
315
|
result = await cli._main()
|
|
316
|
-
assert result
|
|
316
|
+
assert result is True
|
|
317
317
|
assert "Loaded 5/5 internal modules (aggregate,cloudcheck,dnsresolve,excavate,speculate)" in caplog.text
|
|
318
318
|
caplog.clear()
|
|
319
319
|
monkeypatch.setattr("sys.argv", ["bbot", "-em", "excavate", "speculate", "-y"])
|
|
320
320
|
result = await cli._main()
|
|
321
|
-
assert result
|
|
321
|
+
assert result is True
|
|
322
322
|
assert "Loaded 3/3 internal modules (aggregate,cloudcheck,dnsresolve)" in caplog.text
|
|
323
323
|
caplog.clear()
|
|
324
324
|
monkeypatch.setattr("sys.argv", ["bbot", "-c", "speculate=false", "-y"])
|
|
325
325
|
result = await cli._main()
|
|
326
|
-
assert result
|
|
326
|
+
assert result is True
|
|
327
327
|
assert "Loaded 4/4 internal modules (aggregate,cloudcheck,dnsresolve,excavate)" in caplog.text
|
|
328
328
|
|
|
329
329
|
# custom target type
|
|
@@ -331,7 +331,7 @@ async def test_cli_args(monkeypatch, caplog, capsys, clean_default_config):
|
|
|
331
331
|
monkeypatch.setattr("sys.argv", ["bbot", "-t", "ORG:evilcorp", "-y"])
|
|
332
332
|
result = await cli._main()
|
|
333
333
|
out, err = capsys.readouterr()
|
|
334
|
-
assert result
|
|
334
|
+
assert result is True
|
|
335
335
|
assert "[ORG_STUB] evilcorp TARGET" in out
|
|
336
336
|
|
|
337
337
|
# activate modules by flag
|
|
@@ -339,50 +339,50 @@ async def test_cli_args(monkeypatch, caplog, capsys, clean_default_config):
|
|
|
339
339
|
assert not caplog.text
|
|
340
340
|
monkeypatch.setattr("sys.argv", ["bbot", "-f", "passive"])
|
|
341
341
|
result = await cli._main()
|
|
342
|
-
assert result
|
|
342
|
+
assert result is True
|
|
343
343
|
|
|
344
344
|
# unconsoleable output module
|
|
345
345
|
monkeypatch.setattr("sys.argv", ["bbot", "-om", "web_report"])
|
|
346
346
|
result = await cli._main()
|
|
347
|
-
assert result
|
|
347
|
+
assert result is True
|
|
348
348
|
|
|
349
349
|
# unresolved dependency
|
|
350
350
|
monkeypatch.setattr("sys.argv", ["bbot", "-m", "wappalyzer"])
|
|
351
351
|
result = await cli._main()
|
|
352
|
-
assert result
|
|
352
|
+
assert result is True
|
|
353
353
|
|
|
354
354
|
# require flags
|
|
355
355
|
monkeypatch.setattr("sys.argv", ["bbot", "-f", "active", "-rf", "passive"])
|
|
356
356
|
result = await cli._main()
|
|
357
|
-
assert result
|
|
357
|
+
assert result is True
|
|
358
358
|
|
|
359
359
|
# excluded flags
|
|
360
360
|
monkeypatch.setattr("sys.argv", ["bbot", "-f", "active", "-ef", "active"])
|
|
361
361
|
result = await cli._main()
|
|
362
|
-
assert result
|
|
362
|
+
assert result is True
|
|
363
363
|
|
|
364
364
|
# slow modules
|
|
365
365
|
monkeypatch.setattr("sys.argv", ["bbot", "-m", "bucket_digitalocean"])
|
|
366
366
|
result = await cli._main()
|
|
367
|
-
assert result
|
|
367
|
+
assert result is True
|
|
368
368
|
|
|
369
369
|
# deadly modules
|
|
370
370
|
caplog.clear()
|
|
371
371
|
assert not caplog.text
|
|
372
372
|
monkeypatch.setattr("sys.argv", ["bbot", "-m", "nuclei"])
|
|
373
373
|
result = await cli._main()
|
|
374
|
-
assert result
|
|
374
|
+
assert result is False, "-m nuclei ran without --allow-deadly"
|
|
375
375
|
assert "Please specify --allow-deadly to continue" in caplog.text
|
|
376
376
|
|
|
377
377
|
# --allow-deadly
|
|
378
378
|
monkeypatch.setattr("sys.argv", ["bbot", "-m", "nuclei", "--allow-deadly"])
|
|
379
379
|
result = await cli._main()
|
|
380
|
-
assert result
|
|
380
|
+
assert result is True, "-m nuclei failed to run with --allow-deadly"
|
|
381
381
|
|
|
382
382
|
# install all deps
|
|
383
383
|
monkeypatch.setattr("sys.argv", ["bbot", "--install-all-deps"])
|
|
384
384
|
success = await cli._main()
|
|
385
|
-
assert success
|
|
385
|
+
assert success is True, "--install-all-deps failed for at least one module"
|
|
386
386
|
|
|
387
387
|
|
|
388
388
|
@pytest.mark.asyncio
|
|
@@ -396,7 +396,7 @@ async def test_cli_customheaders(monkeypatch, caplog, capsys):
|
|
|
396
396
|
"sys.argv", ["bbot", "--custom-headers", "foo=bar", "foo2=bar2", "foo3=bar=3", "--current-preset"]
|
|
397
397
|
)
|
|
398
398
|
success = await cli._main()
|
|
399
|
-
assert success
|
|
399
|
+
assert success is None, "setting custom headers on command line failed"
|
|
400
400
|
captured = capsys.readouterr()
|
|
401
401
|
stdout_preset = yaml.safe_load(captured.out)
|
|
402
402
|
assert stdout_preset["config"]["web"]["http_headers"] == {"foo": "bar", "foo2": "bar2", "foo3": "bar=3"}
|
|
@@ -404,21 +404,21 @@ async def test_cli_customheaders(monkeypatch, caplog, capsys):
|
|
|
404
404
|
# test custom headers invalid (no "=")
|
|
405
405
|
monkeypatch.setattr("sys.argv", ["bbot", "--custom-headers", "justastring", "--current-preset"])
|
|
406
406
|
result = await cli._main()
|
|
407
|
-
assert result
|
|
407
|
+
assert result is None
|
|
408
408
|
assert "Custom headers not formatted correctly (missing '=')" in caplog.text
|
|
409
409
|
caplog.clear()
|
|
410
410
|
|
|
411
411
|
# test custom headers invalid (missing key)
|
|
412
412
|
monkeypatch.setattr("sys.argv", ["bbot", "--custom-headers", "=nokey", "--current-preset"])
|
|
413
413
|
result = await cli._main()
|
|
414
|
-
assert result
|
|
414
|
+
assert result is None
|
|
415
415
|
assert "Custom headers not formatted correctly (missing header name or value)" in caplog.text
|
|
416
416
|
caplog.clear()
|
|
417
417
|
|
|
418
418
|
# test custom headers invalid (missing value)
|
|
419
419
|
monkeypatch.setattr("sys.argv", ["bbot", "--custom-headers", "missingvalue=", "--current-preset"])
|
|
420
420
|
result = await cli._main()
|
|
421
|
-
assert result
|
|
421
|
+
assert result is None
|
|
422
422
|
assert "Custom headers not formatted correctly (missing header name or value)" in caplog.text
|
|
423
423
|
|
|
424
424
|
|
|
@@ -23,7 +23,7 @@ async def test_dns_engine(bbot_scanner):
|
|
|
23
23
|
)
|
|
24
24
|
result = await scan.helpers.resolve("one.one.one.one")
|
|
25
25
|
assert "1.1.1.1" in result
|
|
26
|
-
assert
|
|
26
|
+
assert "2606:4700:4700::1111" not in result
|
|
27
27
|
|
|
28
28
|
results = [_ async for _ in scan.helpers.resolve_batch(("one.one.one.one", "1.1.1.1"))]
|
|
29
29
|
pass_1 = False
|
|
@@ -85,12 +85,12 @@ async def test_dns_resolution(bbot_scanner):
|
|
|
85
85
|
for answer in answers:
|
|
86
86
|
responses += list(extract_targets(answer))
|
|
87
87
|
assert ("A", "1.1.1.1") in responses
|
|
88
|
-
assert
|
|
88
|
+
assert ("AAAA", "2606:4700:4700::1111") not in responses
|
|
89
89
|
answers, errors = await dnsengine.resolve_raw("one.one.one.one", type="AAAA")
|
|
90
90
|
responses = []
|
|
91
91
|
for answer in answers:
|
|
92
92
|
responses += list(extract_targets(answer))
|
|
93
|
-
assert
|
|
93
|
+
assert ("A", "1.1.1.1") not in responses
|
|
94
94
|
assert ("AAAA", "2606:4700:4700::1111") in responses
|
|
95
95
|
answers, errors = await dnsengine.resolve_raw("1.1.1.1")
|
|
96
96
|
responses = []
|
|
@@ -113,7 +113,7 @@ async def test_dns_resolution(bbot_scanner):
|
|
|
113
113
|
batch_results = [r async for r in dnsengine.resolve_batch(["1.1.1.1", "one.one.one.one"])]
|
|
114
114
|
assert len(batch_results) == 2
|
|
115
115
|
batch_results = dict(batch_results)
|
|
116
|
-
assert any(
|
|
116
|
+
assert any(x in batch_results["one.one.one.one"] for x in ("1.1.1.1", "1.0.0.1"))
|
|
117
117
|
assert "one.one.one.one" in batch_results["1.1.1.1"]
|
|
118
118
|
|
|
119
119
|
# custom batch resolution
|
|
@@ -141,11 +141,11 @@ async def test_dns_resolution(bbot_scanner):
|
|
|
141
141
|
assert hash(("1.1.1.1", "PTR")) in dnsengine._dns_cache
|
|
142
142
|
await dnsengine.resolve("one.one.one.one", type="A")
|
|
143
143
|
assert hash(("one.one.one.one", "A")) in dnsengine._dns_cache
|
|
144
|
-
assert
|
|
144
|
+
assert hash(("one.one.one.one", "AAAA")) not in dnsengine._dns_cache
|
|
145
145
|
dnsengine._dns_cache.clear()
|
|
146
146
|
await dnsengine.resolve("one.one.one.one", type="AAAA")
|
|
147
147
|
assert hash(("one.one.one.one", "AAAA")) in dnsengine._dns_cache
|
|
148
|
-
assert
|
|
148
|
+
assert hash(("one.one.one.one", "A")) not in dnsengine._dns_cache
|
|
149
149
|
|
|
150
150
|
await dnsengine._shutdown()
|
|
151
151
|
|
|
@@ -165,7 +165,7 @@ async def test_dns_resolution(bbot_scanner):
|
|
|
165
165
|
assert "A" in resolved_hosts_event1.raw_dns_records
|
|
166
166
|
assert "AAAA" in resolved_hosts_event1.raw_dns_records
|
|
167
167
|
assert "a-record" in resolved_hosts_event1.tags
|
|
168
|
-
assert
|
|
168
|
+
assert "a-record" not in resolved_hosts_event2.tags
|
|
169
169
|
|
|
170
170
|
scan2 = bbot_scanner("evilcorp.com", config={"dns": {"minimal": False}})
|
|
171
171
|
await scan2.helpers.dns._mock_dns(
|
|
@@ -198,7 +198,7 @@ async def test_wildcards(bbot_scanner):
|
|
|
198
198
|
assert len(dnsengine._wildcard_cache) == len(all_rdtypes) + (len(all_rdtypes) - 2)
|
|
199
199
|
for rdtype in all_rdtypes:
|
|
200
200
|
assert hash(("github.io", rdtype)) in dnsengine._wildcard_cache
|
|
201
|
-
if not
|
|
201
|
+
if rdtype not in ("A", "AAAA"):
|
|
202
202
|
assert hash(("asdf.github.io", rdtype)) in dnsengine._wildcard_cache
|
|
203
203
|
assert "github.io" in wildcard_domains
|
|
204
204
|
assert "A" in wildcard_domains["github.io"]
|
|
@@ -781,16 +781,16 @@ async def test_dns_graph_structure(bbot_scanner):
|
|
|
781
781
|
|
|
782
782
|
@pytest.mark.asyncio
|
|
783
783
|
async def test_dns_helpers(bbot_scanner):
|
|
784
|
-
assert service_record("")
|
|
785
|
-
assert service_record("localhost")
|
|
786
|
-
assert service_record("www.example.com")
|
|
787
|
-
assert service_record("www.example.com", "SRV")
|
|
788
|
-
assert service_record("_custom._service.example.com", "SRV")
|
|
789
|
-
assert service_record("_custom._service.example.com", "A")
|
|
784
|
+
assert service_record("") is False
|
|
785
|
+
assert service_record("localhost") is False
|
|
786
|
+
assert service_record("www.example.com") is False
|
|
787
|
+
assert service_record("www.example.com", "SRV") is True
|
|
788
|
+
assert service_record("_custom._service.example.com", "SRV") is True
|
|
789
|
+
assert service_record("_custom._service.example.com", "A") is False
|
|
790
790
|
# top 100 most common SRV records
|
|
791
791
|
for srv_record in common_srvs[:100]:
|
|
792
792
|
hostname = f"{srv_record}.example.com"
|
|
793
|
-
assert service_record(hostname)
|
|
793
|
+
assert service_record(hostname) is True
|
|
794
794
|
|
|
795
795
|
# make sure system nameservers are excluded from use by DNS brute force
|
|
796
796
|
brute_nameservers = tempwordlist(["1.2.3.4", "8.8.4.4", "4.3.2.1", "8.8.8.8"])
|
|
@@ -72,7 +72,7 @@ async def test_engine():
|
|
|
72
72
|
|
|
73
73
|
# test async generator
|
|
74
74
|
assert counter == 0
|
|
75
|
-
assert yield_cancelled
|
|
75
|
+
assert yield_cancelled is False
|
|
76
76
|
yield_res = [r async for r in test_engine.yield_stuff(13)]
|
|
77
77
|
assert yield_res == [f"thing{i}" for i in range(13)]
|
|
78
78
|
assert len(yield_res) == 13
|
|
@@ -88,8 +88,8 @@ async def test_engine():
|
|
|
88
88
|
await agen.aclose()
|
|
89
89
|
break
|
|
90
90
|
await asyncio.sleep(5)
|
|
91
|
-
assert yield_cancelled
|
|
92
|
-
assert yield_errored
|
|
91
|
+
assert yield_cancelled is True
|
|
92
|
+
assert yield_errored is False
|
|
93
93
|
assert counter < 15
|
|
94
94
|
|
|
95
95
|
# test async generator with error
|
|
@@ -99,8 +99,8 @@ async def test_engine():
|
|
|
99
99
|
with pytest.raises(BBOTEngineError):
|
|
100
100
|
async for _ in agen:
|
|
101
101
|
pass
|
|
102
|
-
assert yield_cancelled
|
|
103
|
-
assert yield_errored
|
|
102
|
+
assert yield_cancelled is False
|
|
103
|
+
assert yield_errored is True
|
|
104
104
|
|
|
105
105
|
# test return with cancellation
|
|
106
106
|
return_started = False
|
|
@@ -113,10 +113,10 @@ async def test_engine():
|
|
|
113
113
|
with pytest.raises(asyncio.CancelledError):
|
|
114
114
|
await task
|
|
115
115
|
await asyncio.sleep(0.1)
|
|
116
|
-
assert return_started
|
|
117
|
-
assert return_finished
|
|
118
|
-
assert return_cancelled
|
|
119
|
-
assert return_errored
|
|
116
|
+
assert return_started is True
|
|
117
|
+
assert return_finished is False
|
|
118
|
+
assert return_cancelled is True
|
|
119
|
+
assert return_errored is False
|
|
120
120
|
|
|
121
121
|
# test return with late cancellation
|
|
122
122
|
return_started = False
|
|
@@ -128,10 +128,10 @@ async def test_engine():
|
|
|
128
128
|
task.cancel()
|
|
129
129
|
result = await task
|
|
130
130
|
assert result == "thing1"
|
|
131
|
-
assert return_started
|
|
132
|
-
assert return_finished
|
|
133
|
-
assert return_cancelled
|
|
134
|
-
assert return_errored
|
|
131
|
+
assert return_started is True
|
|
132
|
+
assert return_finished is True
|
|
133
|
+
assert return_cancelled is False
|
|
134
|
+
assert return_errored is False
|
|
135
135
|
|
|
136
136
|
# test return with error
|
|
137
137
|
return_started = False
|
|
@@ -140,9 +140,9 @@ async def test_engine():
|
|
|
140
140
|
return_errored = False
|
|
141
141
|
with pytest.raises(BBOTEngineError):
|
|
142
142
|
result = await test_engine.return_thing(None)
|
|
143
|
-
assert return_started
|
|
144
|
-
assert return_finished
|
|
145
|
-
assert return_cancelled
|
|
146
|
-
assert return_errored
|
|
143
|
+
assert return_started is True
|
|
144
|
+
assert return_finished is False
|
|
145
|
+
assert return_cancelled is False
|
|
146
|
+
assert return_errored is True
|
|
147
147
|
|
|
148
148
|
await test_engine.shutdown()
|