Skip to content

Comments

update zoomeye api#674

Merged
ehsandeep merged 4 commits intodevfrom
update_zoomeye
Jun 17, 2025
Merged

update zoomeye api#674
ehsandeep merged 4 commits intodevfrom
update_zoomeye

Conversation

@dogancanbakir
Copy link
Member

@dogancanbakir dogancanbakir commented May 22, 2025

Closes #664

Summary by CodeRabbit

  • Documentation

    • Updated the README to unify ZoomEye search engine references and simplify API key configuration, reflecting a single endpoint and key format.
  • New Features

    • Improved ZoomEye search results by providing structured and clearly defined fields for IP, port, and hostname.
  • Refactor

    • Simplified the ZoomEye integration by switching to a unified API endpoint, using POST requests with JSON bodies, and removing legacy host and port handling logic.
    • Streamlined credential management by eliminating host configuration for ZoomEye API keys.

@dogancanbakir dogancanbakir self-assigned this May 22, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 22, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

"""

Walkthrough

The changes update the ZoomEye integration to use the new unified API endpoint and request format, removing previous region-specific handling. The code now sends POST requests with base64-encoded queries, uses strongly-typed response structs, and simplifies API key configuration and extraction. Documentation and legacy logic were updated accordingly.

Changes

File(s) Change Summary
README.md Updated documentation to reference the unified ZoomEye endpoint and simplified API key configuration, removing region-specific details.
sources/agent/zoomeye/response.go Replaced the loosely-typed Results field in ZoomEyeResponse with a strongly-typed slice of ZoomEyeResult structs; added the new struct.
sources/agent/zoomeye/zoomeye.go Updated API calls to use POST requests to the new endpoint with base64-encoded queries; simplified response parsing using the new struct; removed legacy host/port logic.
sources/keys.go Removed ZoomEyeHost from the Keys struct and related logic in the Empty() method.
sources/provider.go Simplified ZoomEye API key extraction by removing host parsing logic; now directly assigns the token.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Agent
    participant ZoomEyeAPI

    User->>Agent: Submit search query
    Agent->>Agent: Encode query in base64
    Agent->>ZoomEyeAPI: POST /v2/search with JSON body (base64 query, page, pageSize)
    ZoomEyeAPI-->>Agent: JSON response with results (typed fields)
    Agent->>Agent: Parse response using ZoomEyeResult struct
    Agent->>User: Return structured results
Loading

Assessment against linked issues

Objective Addressed Explanation
Update ZoomEye API integration to use new unified endpoint and request format (#664)
Remove region-specific API key and host handling for ZoomEye (#664)
Use strongly-typed response parsing for ZoomEye results (#664)

Poem

A hop to ZoomEye, now one and the same,
No more regions—just one endpoint to name!
With base64 queries and structs oh-so neat,
Parsing results is now quite a treat.
🐇✨ Unified, simplified, all in one go—
This rabbit’s delighted to see it so!
"""


🪧 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: 2

🔭 Outside diff range comments (1)
sources/provider.go (1)

149-156: 🛠️ Refactor suggestion

Environment variable loading still expects ZOOMEYE_HOST, contradicting new single-token design

appendIfAllExists(provider.ZoomEye, "ZOOMEYE_API_KEY", "ZOOMEYE_HOST") forces users to set an additional variable that is no longer used. It also builds the deprecated token:host string discussed above.

-provider.ZoomEye = appendIfAllExists(provider.ZoomEye, "ZOOMEYE_API_KEY", "ZOOMEYE_HOST")
+// ZoomEye now requires only the API key
+provider.ZoomEye = appendIfExists(provider.ZoomEye, "ZOOMEYE_API_KEY")

Remember to delete the helper at the bottom of this function if it becomes unused.

🧹 Nitpick comments (3)
README.md (1)

185-194: Documentation drift – host-selection guidance is obsolete

The paragraph explaining zoomeye.org vs zoomeye.hk survives, but the code has hard-wired https://api.zoomeye.ai/v2/search and no longer accepts a custom host. Please either:

  • delete this section, or
  • re-introduce host selection in code & provider config.

Keeping stale instructions will confuse users during migration.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

192-192: Unordered list indentation
Expected: 0; Actual: 1

(MD007, ul-indent)


193-193: Unordered list indentation
Expected: 0; Actual: 1

(MD007, ul-indent)

sources/agent/zoomeye/zoomeye.go (2)

82-88: Header spelling & additional resilience

ZoomEye’s docs currently accept API-KEY, but some examples show X-API-KEY. To be future-proof you could set both headers:

request.Header.Set("API-KEY", session.Keys.ZoomEyeToken)
request.Header.Set("X-API-KEY", session.Keys.ZoomEyeToken)

Not mandatory, yet avoids sudden breakage if the service deprecates one header.


104-114: Minor optimisation – reuse sourceResult allocation

Within tight loops this tiny optimisation avoids repeated allocations:

- for _, result := range zoomeyeResponse.Results {
-     sourceResult := sources.Result{Source: agent.Name()}
-     ...
- }
+for _, r := range zoomeyeResponse.Results {
+    sr := sources.Result{Source: agent.Name(), IP: r.IP, Port: r.Port, Host: r.Hostname}
+    sr.Raw, _ = json.Marshal(r)
+    results <- sr
+}

Not critical, but improves GC behaviour for large result sets.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f4d7a82 and 01fb797.

📒 Files selected for processing (5)
  • README.md (2 hunks)
  • sources/agent/zoomeye/response.go (1 hunks)
  • sources/agent/zoomeye/zoomeye.go (4 hunks)
  • sources/keys.go (0 hunks)
  • sources/provider.go (1 hunks)
💤 Files with no reviewable changes (1)
  • sources/keys.go
🧰 Additional context used
🧬 Code Graph Analysis (1)
sources/agent/zoomeye/zoomeye.go (4)
sources/agent.go (1)
  • Query (3-6)
sources/util.go (1)
  • NewHTTPRequest (10-17)
sources/keys.go (1)
  • Keys (3-20)
sources/result.go (1)
  • Result (8-17)
🪛 markdownlint-cli2 (0.17.2)
README.md

45-45: Bare URL used
null

(MD034, no-bare-urls)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Test Builds (macOS-13, 1.22.x)
  • GitHub Check: Test Builds (windows-latest, 1.22.x)
  • GitHub Check: Analyze (go)
🔇 Additional comments (1)
sources/agent/zoomeye/response.go (1)

4-11: Typed response greatly improves safety – nice work!

Replacing the map[string]interface{} approach with a concrete ZoomEyeResult struct eliminates repetitive type assertions and makes downstream code clearer.

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

@ehsandeep ehsandeep left a comment

Choose a reason for hiding this comment

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

$ ./uncover -zoomeye 'app="MinIO Browser"'

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

		projectdiscovery.io

[INF] Current uncover version v1.0.10 (latest)
182.160.16.234:60217
182.160.16.234:60217
182.160.16.163:60217
182.160.16.163:60217
173.230.132.95:8822
173.230.132.95:8822
173.230.132.59:8822
173.230.132.59:8822
173.230.132.80:8822
173.230.132.80:8822
69.164.213.20:19200
69.164.213.20:19200

@ehsandeep ehsandeep merged commit 3d7c893 into dev Jun 17, 2025
9 checks passed
@ehsandeep ehsandeep deleted the update_zoomeye branch June 17, 2025 11:56
@coderabbitai coderabbitai bot mentioned this pull request Jul 4, 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.

zoomeye api update Zoomeye Engine no Longer Working due to Domain Change

2 participants