Skip to content

Let already-resolved events skip ahead in dnsresolve's queue - #3533

Open
liquidsec wants to merge 1 commit into
blastdns-2.0from
intercept-queue-lag
Open

liquidsec wants to merge 1 commit into
blastdns-2.0from
intercept-queue-lag

Conversation

@liquidsec

Copy link
Copy Markdown
Contributor

Every event passes through dnsresolve, and the web chain passes through it three times (DNS_NAME → OPEN_TCP_PORT → URL/HTTP_RESPONSE). Early in a scan, subdomain modules flood its queue with thousands of new DNS_NAMEs, and because the queue between intercept modules is FIFO, cheap events whose host is already resolved wait behind all of them. The result is a long stretch at the start of a scan where DNS results arrive but no web data does.

This splits intercept queues into lanes:

  • LaneQueue (async_helpers.py): an asyncio.PriorityQueue subclass where lower lanes are dequeued first and each lane is FIFO. It keeps _queue, so qsize(), maxsize and num_queued_events behave as before.
  • BaseInterceptModule.make_intercept_queue() / incoming_lane(event): the queue feeding an intercept module is now built by that module and laned by its incoming_lane(). The default is a single lane, so other intercept modules are unchanged.
  • dnsresolve.incoming_lane(): events whose host already has a resolved DNS_NAME/IP_ADDRESS parent (and hostless events) go in lane 0; hosts that still need resolving go in lane 1. The parent lookup is shared with get_dns_parent() via a new find_dns_parent().

Reordering is safe because a fast-lane event's same-host parent has always already passed through the pipeline.

On a subdomain-enum + http scan of a real target, the baseline had 1 OPEN_TCP_PORT and 0 URLs after 120 seconds; with this change it had 147 OPEN_TCP_PORTs and 13 URLs at 30 seconds, while hostnames resolved at the same rate.

@codecov

codecov Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91%. Comparing base (a74ff5b) to head (b33d94a).

Additional details and impacted files
@@             Coverage Diff              @@
##           blastdns-2.0   #3533   +/-   ##
============================================
- Coverage            91%     91%   -0%     
============================================
  Files               461     461           
  Lines             49823   49884   +61     
============================================
+ Hits              44962   45016   +54     
- Misses             4861    4868    +7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

Copy link
Copy Markdown
Contributor

📊 Performance Benchmark Report

Comparing blastdns-2.0 (baseline) vs intercept-queue-lag (current)

📈 Detailed Results (All Benchmarks)

📋 Complete results for all benchmarks - includes both significant and insignificant changes

🧪 Test Name 📏 Base 📏 Current 📈 Change 🎯 Status
Bloom Filter Dns Mutation Tracking Performance 2.20ms 2.24ms +2.1% ⚪ ✅
Bloom Filter Large Scale Dns Brute Force 8.47ms 9.71ms +14.7% 🟡🟡 ⚠️
Large Closest Match Lookup 191.05ms 195.92ms +2.6% ⚪ ✅
Realistic Closest Match Workload 102.04ms 109.34ms +7.2% ⚪ ✅
Event Memory Medium Scan 1402 B/event 1405 B/event +0.3% ⚪ ✅
Event Memory Large Scan 1527 B/event 1527 B/event +0.0% ⚪ ✅
Event Validation Full Scan Startup Small Batch 231.95ms 239.82ms +3.4% ⚪ ✅
Event Validation Full Scan Startup Large Batch 300.85ms 303.97ms +1.0% ⚪ ✅
Make Event Autodetection Small 12.58ms 12.23ms -2.8% ⚪ ✅
Make Event Autodetection Large 126.94ms 123.75ms -2.5% ⚪ ✅
Make Event Explicit Types 5.33ms 5.34ms +0.2% ⚪ ✅
Excavate Single Thread Small 2.574s 2.481s -3.6% ⚪ ✅
Excavate Single Thread Large 6.047s 6.073s +0.4% ⚪ ✅
Excavate Parallel Tasks Small 2.546s 2.596s +2.0% ⚪ ✅
Excavate Parallel Tasks Large 4.011s 4.112s +2.5% ⚪ ✅
Intercept Throughput Small 676.28ms 689.82ms +2.0% ⚪ ✅
Intercept Throughput Medium 770.74ms 704.19ms -8.6% ⚪ ✅
Dns Throughput Quiet 1.436s 1.488s +3.7% ⚪ ✅
Dns Throughput Loaded 1.129s 1.053s -6.8% ⚪ ✅
Dns Throughput Inherited 1.176s 1.327s +12.8% 🟡🟡 ⚠️
Is Ip Performance 1.34ms 1.33ms -0.9% ⚪ ✅
Make Ip Type Performance 120.58µs 114.85µs -4.8% ⚪ ✅
Mixed Ip Operations 1.39ms 1.39ms -0.2% ⚪ ✅
Memory Use Web Crawl 1.2 MB 1.2 MB +0.0% ⚪ ✅
Memory Use Subdomain Enum 28.3 MB 28.3 MB +0.0% ⚪ ✅
Memory Use Deep Chain 5.0 MB 5.0 MB +0.0% ⚪ ✅
Memory Use Parallel Chains 11.1 MB 11.6 MB +4.4% ⚪ ✅
Scan Throughput 100 1.589s 1.883s +18.5% 🟡🟡 ⚠️
Scan Throughput 1000 10.689s 11.686s +9.3% ⚪ ✅
Typical Queue Shuffle 2.97µs 3.02µs +1.9% ⚪ ✅
Priority Queue Shuffle 14.26µs 15.11µs +6.0% ⚪ ✅

🎯 Performance Summary

! 3 regressions ⚠️
  28 unchanged ✅

🔍 Significant Changes (>10%)

  • Bloom Filter Large Scale Dns Brute Force: 14.7% 🐌 slower
  • Dns Throughput Inherited: 12.8% 🐌 slower
  • Scan Throughput 100: 18.5% 🐌 slower

🐍 Python Version 3.11.17

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant