Skip to content

Zoomeye bulletproof multipage results - #21770

Open
e2002e wants to merge 5 commits into
rapid7:masterfrom
e2002e:zoomeye_max_results_per_page
Open

Zoomeye bulletproof multipage results#21770
e2002e wants to merge 5 commits into
rapid7:masterfrom
e2002e:zoomeye_max_results_per_page

Conversation

@e2002e

@e2002e e2002e commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Hello,
This pull request modifies the loop on result pages so that it can handle empty ones without looping forever or truncating the list.
It uses a retry count (set to 3) for earch page, if it exeeds it, it goes to the next page.
Keeping the amount of results per page to the minimum of 10 is necessary to limit the loss in case some return nil.

msf auxiliary(gather/zoomeye_search) > run
[*] Total: 618 on 62 pages. Showing: 62 page(s)
[*] Collecting data, please wait...
[-] Skipping page 16
[-] Skipping page 18
Host search
===========

 IP:Port              Protocol  City            Country  Hostname                       OS                              Service                 AppName                              Version                 Info
 -------              --------  ----            -------  --------                       --                              -------                 -------                              -------                 ----
 #.#.#.#:443      tcp       Saint-Brieuc    France                                                                  https
....

wc outfile > 606 (5 are header) so we lost 17 results but it took 2 minutes and the list is quite exhaustive. I don't know if there is really that total of results but if so I don't see any way of getting it.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the gather/zoomeye_search auxiliary module’s ZoomEye pagination to reduce infinite-loop risk on empty pages by forcing a 10-result page size and adding retry/skip handling when a page returns no matches.

Changes:

  • Set ZoomEye API pagesize to 10 and update total-page computation accordingly.
  • Add retry-and-skip logic when a page returns matches: nil to avoid getting stuck on empty pages.

Impact Analysis:

  • Blast radius: medium — affects all users of auxiliary/gather/zoomeye_search and the completeness/ordering of collected results.
  • Data and contract effects: output row count and which pages are queried can change (10-per-page assumption is now baked into both request and page-count math).
  • Rollback and test focus: rollback is straightforward (single module); validate by running the module against queries known to produce intermittent empty pages and confirming (1) no infinite loop, (2) skip messages show the correct page number, and (3) retries apply per page.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 172 to 188
while page < maxpage
page_result = dork_search(resource, dork, page + 1, facets, api_key)
page_result = dork_search(resource, dork, page + skipped + 1, facets, api_key)
if page_result['matches'].nil?
next
retrying += 1
if retrying < 3
next
else
print_error("Skipping page #{page + skipped}")
if page + skipped >= maxpage #stop the strafe once we reach the theorical maxpage, but let it try it first.
break
end
skipped += 1
next
end
else
retrying = 0
end
Comment on lines +166 to +167
# If search results greater than 20, loop & get all results
if results[first_page]['total'] > 20
if results[first_page]['total'] > 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants