Skip to content

Comments

Add search Engine _ Driftnet#678

Merged
dogancanbakir merged 2 commits intoprojectdiscovery:devfrom
driftnet-io:add_driftnet_search_engine
Jun 16, 2025
Merged

Add search Engine _ Driftnet#678
dogancanbakir merged 2 commits intoprojectdiscovery:devfrom
driftnet-io:add_driftnet_search_engine

Conversation

@craig46562376
Copy link
Contributor

@craig46562376 craig46562376 commented Jun 12, 2025

Adds search engine Driftnet as requested in #676

Ref: https://driftnet.io/
API Guide: https://driftnet.io/api-docs/getting-started

Summary by CodeRabbit

  • New Features

    • Added support for Driftnet as a new search engine, enabling users to perform network reconnaissance and open port lookups using Driftnet queries.
    • Introduced command-line options and configuration for Driftnet, including API key management and usage examples.
    • Integrated Driftnet into provider key handling and rate limiting.
  • Documentation

    • Updated the README to include Driftnet integration details, setup instructions, and usage examples.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 12, 2025

Walkthrough

Support for the Driftnet search engine was added throughout the project. This includes a new agent for Driftnet queries, integration into command-line options, API key management, provider configuration, rate limiting, and updated documentation. All changes are additive, introducing Driftnet as a fully supported search engine without altering existing functionality.

Changes

File(s) Change Summary
README.md Documented Driftnet integration: usage, API key setup, examples, and feature listing.
runner/options.go Added Driftnet to CLI options, engine selection, and query handling logic.
sources/agent/driftnet/driftnet.go Implemented Driftnet agent: handles queries, API requests, response parsing, and streaming results.
sources/agent/driftnet/response.go Defined Driftnet API response data structures for ports, IPs, and paginated results.
sources/keys.go Added DriftnetToken field to Keys struct and updated Empty() method.
sources/provider.go Integrated Driftnet into provider key management: loading, retrieval, and presence checks.
sources/session.go Added Driftnet to DefaultRateLimits for rate limiting.
uncover.go Registered Driftnet agent in uncover service and agent listing.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant DriftnetAgent
    participant DriftnetAPI

    User->>CLI: Run with --driftnet or -df query
    CLI->>DriftnetAgent: Initialize agent with API key
    DriftnetAgent->>DriftnetAPI: Send query (IP/CIDR or search term)
    DriftnetAPI-->>DriftnetAgent: Return paginated results
    DriftnetAgent->>CLI: Stream results (IP, ports, hostnames)
    CLI->>User: Display Driftnet results
Loading

Possibly related PRs

  • projectdiscovery/uncover#672: Adds support for the Onyphe search engine, modifying the same core components as this PR but for a different engine.

Poem

A new friend hops into the net,
Driftnet’s here—our best agent yet!
Queries and ports, it sniffs with glee,
Streaming results as fast as can be.
With docs and code all up to date,
The search just got more first-rate!
🐰✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between adf94c5 and 05d5284.

📒 Files selected for processing (3)
  • README.md (8 hunks)
  • runner/options.go (7 hunks)
  • sources/agent/driftnet/driftnet.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • runner/options.go
  • README.md
  • sources/agent/driftnet/driftnet.go
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Nitpick comments (4)
uncover.go (1)

195-196: Keep AllAgents() list sorted for readability

Optional: appending new engines at the end makes diffs larger over time. Consider alphabetical ordering next time.

runner/options.go (1)

95-96: Fix typo “drfitnet” in help string

Minor but user-visible typo in the flag description.

- flagSet.StringSliceVarP(&options.Driftnet, "driftnet", "df", nil, "search query for drfitnet (example: -driftnet 'query.txt')", goflags.FileStringSliceOptions),
+ flagSet.StringSliceVarP(&options.Driftnet, "driftnet", "df", nil, "search query for driftnet (example: -driftnet 'query.txt')", goflags.FileStringSliceOptions),
README.md (2)

169-195: Consistent environment-variable name

You used DRIFTNET_API_KEY (👍). After fixing the YAML typo above everything will align.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~174-~174: You might be missing the article “the” here.
Context: ...iple keys/credentials are specified for same provider in the config file, random key...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)


[uncategorized] ~174-~174: You might be missing the article “a” here.
Context: ...d for same provider in the config file, random key will be used for each execution. a...

(AI_EN_LECTOR_MISSING_DETERMINER_A)


[uncategorized] ~175-~175: Possible missing comma found.
Context: ...m key will be used for each execution. alternatively you can also set the API key as environ...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~176-~176: A comma might be missing here.
Context: ...used for each execution. alternatively you can also set the API key as environment...

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)


[uncategorized] ~176-~176: You might be missing the article “an” here.
Context: ...atively you can also set the API key as environment variable in your bash profile. ```yaml...

(AI_EN_LECTOR_MISSING_DETERMINER_AN)


382-416: Section header & examples contain the same typo

Occurrences of “drfitnet” should be “driftnet” to avoid confusion in copy-paste examples.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e52c85e and adf94c5.

📒 Files selected for processing (8)
  • README.md (8 hunks)
  • runner/options.go (7 hunks)
  • sources/agent/driftnet/driftnet.go (1 hunks)
  • sources/agent/driftnet/response.go (1 hunks)
  • sources/keys.go (2 hunks)
  • sources/provider.go (4 hunks)
  • sources/session.go (1 hunks)
  • uncover.go (3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
uncover.go (2)
sources/agent/driftnet/driftnet.go (1)
  • Agent (43-43)
sources/agent.go (1)
  • Agent (8-11)
🔇 Additional comments (7)
sources/keys.go (1)

22-23: Addition looks correct – field aligns with existing naming pattern

DriftnetToken is added consistently with the other *Token fields and is also accounted for in Empty(). No issues spotted.

sources/session.go (1)

34-35: Double-check Driftnet’s permitted request rate

MaxCount: 5, Duration: time.Second means up to 5 req/s. Please confirm this is within Driftnet’s published limits; overshooting will quickly burn through quotas or trigger 429s.

uncover.go (1)

89-91: Agent registration looks fine

The new switch-case branch correctly instantiates &driftnet.Agent{}. Ensure Agent.Name() returns "driftnet" (lower-case) to stay in sync with the key checks elsewhere.

runner/options.go (1)

63-64: Good – new flag wired into Options struct

No functional concerns here.

README.md (1)

52-53: Nice – Driftnet added to supported engines

Documentation updated correctly.

sources/provider.go (1)

124-127: LGTM – integration matches existing providers

Key selection logic mirrors the other providers and should work as expected.

sources/agent/driftnet/response.go (1)

1-54: Structs look fine

Types accurately map the API payloads and use correct JSON tags.

@craig46562376
Copy link
Contributor Author

@dogancanbakir, believe this is somewhat expected, let us know if you need anything else here.

@dogancanbakir dogancanbakir linked an issue Jun 16, 2025 that may be closed by this pull request
@ehsandeep ehsandeep changed the base branch from main to dev June 16, 2025 12:21
Copy link
Member

@dogancanbakir dogancanbakir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

$ go run . -driftnet 'field=product-tag:jira'

  __  ______  _________ _   _____  _____
 / / / / __ \/ ___/ __ \ | / / _ \/ ___/
/ /_/ / / / / /__/ /_/ / |/ /  __/ /    
\__,_/_/ /_/\___/\____/|___/\___/_/

                projectdiscovery.io

[INF] Current uncover version v1.0.10 (latest)
5.x.255.x:443
5.x.255.x:443
...



$ echo 8.8.8.8/20 | go run . -e driftnet

  __  ______  _________ _   _____  _____
 / / / / __ \/ ___/ __ \ | / / _ \/ ___/
/ /_/ / / / / /__/ /_/ / |/ /  __/ /    
\__,_/_/ /_/\___/\____/|___/\___/_/

                projectdiscovery.io

[INF] Current uncover version v1.0.10 (latest)
8.8.1.106:22
8.8.1.106:22
....

@dogancanbakir dogancanbakir merged commit 7a052d7 into projectdiscovery:dev Jun 16, 2025
8 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Jun 16, 2025
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.

Driftnet.io search engine

2 participants