Skip to content

feat(rescan): add rescan command for live rescans - #84

Open
Aidan Holland (thehappydinoa) wants to merge 5 commits into
mainfrom
feat/rescan-command
Open

Aidan Holland (thehappydinoa) wants to merge 5 commits into
mainfrom
feat/rescan-command

Conversation

@thehappydinoa

Copy link
Copy Markdown
Member

Summary

  • Adds censys rescan <url> command that initiates a live rescan via the Censys API and polls until completion
  • Target is specified as a URL: IP host → service target, hostname → web origin target
  • Scheme maps to Censys protocol name with a built-in lookup table (e.g. https:// → HTTP, dns:// → DNS/UDP, smtps:// → SMTP)
  • Port defaults from scheme when not explicit in URL (e.g. https://1.1.1.1 → port 443)
  • --transport-protocol flag overrides the scheme-derived default when needed
  • Polls every 5s and reports progress until completed: true
  • Costs 10 credits per rescan; Enterprise only

Test plan

  • censys rescan http://1.1.1.1:80 — service target, completes successfully
  • censys rescan https://1.1.1.1 — maps to HTTP/443/tcp without specifying port
  • Error cases: missing scheme, missing port on unknown scheme, invalid port, bad transport protocol

🤖 Generated with Claude Code

Adds `censys rescan` command that initiates a live rescan via the
Censys API and polls for completion, reporting progress as it waits.

- Client: CreateTrackedScan and GetTrackedScan methods on GlobalDataClient
- App service: rescan.Service handles target construction, initiation, and polling loop
- Command: supports --ip/--port/--protocol/--transport-protocol for service targets and --hostname/--port for web origin targets
- Context: RescanService memoized factory + WithRescanService test opt
- Root: wired into command tree

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lags

Replaces --ip/--hostname/--port/--protocol with a single <url> argument.
The scheme maps to the application protocol (uppercased), host determines
target type (IP → service, hostname → web origin), and port is parsed
from the URL. --transport-protocol remains as an optional flag (default tcp).

Examples:
  censys rescan http://1.1.1.1:80
  censys rescan rtsp://203.0.113.5:554
  censys rescan http://example.com:8088/

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a lookup table for common URL schemes so users can omit the port
when it is implied (e.g. http://1.1.1.1 → port 80) and maps TLS
variants to their base Censys protocol name (https→HTTP, smtps→SMTP,
ldaps→LDAP, etc.). Each scheme also carries a default transport protocol
so dns:// correctly uses UDP without needing --transport-protocol.

--transport-protocol still overrides the scheme default when explicitly set.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@thehappydinoa
Aidan Holland (thehappydinoa) requested a review from a team as a code owner August 28, 2026 20:29
Returning cerr directly preserves the structured ClientError title
and status code. Wrapping in cenclierrors.NewCencliError() would
lose that context and show "Unknown Error" for 403/402 responses.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant