Addresses #6403 — hosts on Shodan (and similar platforms) sometimes act as honeypots, returning responses that match many unrelated nuclei templates and producing noisy false positives. This PR adds per-host tracking of unique template matches with configurable threshold-based flagging.
/claim #6403
pkg/honeypotDetector struct — thread-safe, tracks unique template IDs per normalized hostNormalizeHost() — canonical host extraction from URLs, host:port, bare hostnames, IPv4/IPv6RecordMatch(host, templateID) — registers a match; returns true when threshold is crossedIsFlagged(host) / ShouldSuppress(host) — query flagged statusWarnOnce(host) — emits a single warning log per flagged hostPrintSummary() — end-of-scan summary of all flagged hostspkg/outputStandardWriter gains a HoneypotDetector fieldNewStandardWriter() initializes the detector when threshold > 0Write() records every successful match and optionally suppresses output for flagged hostsClose() prints the honeypot summarycmd/nuclei/main.go + pkg/types| Flag | Short | Default | Description |
|---|---|---|---|
--honeypot-threshold |
-hpt |
0 (disabled) |
Unique template match count before flagging |
--honeypot-suppress |
-hpsu |
false |
Suppress results from flagged hosts |
# Warn-only mode (default): flag honeypots but still show all results
nuclei -l targets.txt -t templates/ -honeypot-threshold 50
# Suppression mode: flag AND drop results from honeypot hosts
nuclei -l targets.txt -t templates/ -honeypot-threshold 50 -honeypot-suppress
=== RUN TestNormalizeHost (12 sub-cases) --- PASS
=== RUN TestDetectorDisabled --- PASS
=== RUN TestDetectorNegativeThreshold --- PASS
=== RUN TestDetectorThresholdFlagging --- PASS
=== RUN TestDetectorSuppression --- PASS
=== RUN TestDetectorHostNormalizationConsistency --- PASS
=== RUN TestDetectorMultipleHosts --- PASS
=== RUN TestDetectorWarnOnce --- PASS
=== RUN TestDetectorConcurrency --- PASS
=== RUN TestDetectorMemoryCleanup --- PASS
=== RUN TestDetectorEmptyHost --- PASS
=== RUN TestDetectorMatchCountFlagged --- PASS
PASS — 0.589s
IsEnabled() returns false and all methods short-circuit immediately-honeypot-suppress is explicitly sethost:port, IPv4, IPv6 with brackets, mixed caseNew Features
Tests
Tereda_Developer
@teredasites
ProjectDiscovery
@projectdiscovery