Skip to content

armgit / bbot

Public Imported from GitHub
0

The recursive internet scanner for hackers. 🧡

Decouple dnsresolve worker count from dns.threads

liquidsec67424f10ee4f
diff --git a/bbot/modules/internal/dnsresolve.py b/bbot/modules/internal/dnsresolve.py
index 4abf2223a..1c7f8c4c7 100644
--- a/bbot/modules/internal/dnsresolve.py
+++ b/bbot/modules/internal/dnsresolve.py
@@ -20,9 +20,8 @@ class DNSResolve(BaseInterceptModule):
_name = "host"
_type = "internal"
- @property
- def module_threads(self):
- return self.dns_config.get("threads", 25)
+ # events resolved concurrently; separate from dns.threads, which caps blastdns queries per resolver
+ _module_threads = 25
async def setup(self):
self.dns_config = self.scan.config.get("dns", {})
diff --git a/bbot/test/test_step_1/test_dns.py b/bbot/test/test_step_1/test_dns.py
index 8d8d54d98..04e29f03e 100644
--- a/bbot/test/test_step_1/test_dns.py
+++ b/bbot/test/test_step_1/test_dns.py
@@ -1065,6 +1065,20 @@ async def test_dns_brute_client_config(bbot_scanner, monkeypatch):
await scan._prep()
+async def test_dnsresolve_module_threads(bbot_scanner):
+ """dnsresolve's worker count is its own module_threads, not dns.threads."""
+ scan = bbot_scanner("evilcorp.com", config={"dns": {"threads": 3}})
+ await scan._prep()
+ assert scan.modules["dnsresolve"].module_threads == 25
+
+ scan = bbot_scanner(
+ "evilcorp.com", config={"dns": {"threads": 3}, "modules": {"dnsresolve": {"module_threads": 50}}}
+ )
+ await scan._prep()
+ assert scan.modules["dnsresolve"].module_threads == 50
+
+
@pytest.mark.asyncio
async def test_dnsresolve_incoming_lanes(bbot_scanner):
from bbot.core.helpers.async_helpers import LaneQueue
@@ -1141,7 +1155,7 @@ async def run_parent_child_scan(bbot_scanner, order):
"evilcorp.com",
"127.0.1.0/24",
blacklist=["127.0.0.99"],
- config={"dns": {"threads": 1, "wildcard_ignore": []}},
+ config={"modules": {"dnsresolve": {"module_threads": 1}}, "dns": {"wildcard_ignore": []}},
)
await scan._prep()
await scan.helpers.dns._mock_dns(parent_child_mock_data)