Documentation
¶
Index ¶
Constants ¶
View Source
const ( OP_REPLY = 1 OP_QUERY = 2004 OP_MSG = 2013 )
MongoDB wire protocol opcodes
View Source
const MONGODB = "mongodb"
Variables ¶
This section is empty.
Functions ¶
func DetectMongoDB ¶
DetectMongoDB performs MongoDB fingerprinting using a layered fallback approach. It attempts detection using both OP_QUERY (universal) and OP_MSG (MongoDB 3.6+) protocols to ensure compatibility across all MongoDB versions from ancient to unreleased.
Detection Strategy:
- DETECTION PHASE: Use hello/isMaster commands to detect MongoDB and extract metadata - PRIMARY PATH (OP_QUERY): Try OP_QUERY + "hello", then OP_QUERY + "isMaster" Works on ALL MongoDB versions, including 5.1+ (handshake exception) Extracts: version, maxWireVersion, minWireVersion, serverType - SECONDARY PATH (OP_MSG): Try OP_MSG + "hello", then OP_MSG + "isMaster" Works on MongoDB 3.6+ only Extracts: version, maxWireVersion, minWireVersion, serverType
- ENRICHMENT PHASE: If version not found in hello/isMaster, try buildInfo - Attempts buildInfo with both OP_QUERY and OP_MSG protocols - If buildInfo fails (e.g., requires auth), still returns MongoDB detection
Parameters:
- conn: Network connection to the MongoDB server
- timeout: Timeout duration for network operations
Returns:
- mongoDBMetadata: Enriched metadata (version, wire versions, server type)
- bool: true if this appears to be MongoDB
- error: Error details if detection failed
Types ¶
type MONGODBPlugin ¶
type MONGODBPlugin struct{}
func (*MONGODBPlugin) Name ¶
func (p *MONGODBPlugin) Name() string
func (*MONGODBPlugin) PortPriority ¶
func (p *MONGODBPlugin) PortPriority(port uint16) bool
func (*MONGODBPlugin) Priority ¶
func (p *MONGODBPlugin) Priority() int
func (*MONGODBPlugin) Type ¶
func (p *MONGODBPlugin) Type() plugins.Protocol
Click to show internal directories.
Click to hide internal directories.