/censys:censys-aggregatefrom censys
Aggregates, buckets, or counts Censys search results by field. Wraps the `censys aggregate` CLI subcommand for report-style queries like top ports or count by country.
Ships in censys. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Use this skill whenever the user wants bucketed counts of a field's values across matching Censys documents, rather than the raw matching records themselves. This is the CLI equivalent of the Censys Platform Report Builder. Covers requests like:
If the user wants the actual matching records (not counts), that's censys-search. If the user has a specific IP, cert SHA-256, or FQDN and wants a single-record lookup, that's censys-view. If the user needs help writing or debugging the CenQL query itself, defer to censys-cenql.
Base form:
censys aggregate "<CenQL query>" "<field>" [flags]
The query selects the document set; the field is the dotted field path to bucket on (e.g. host.services.port, host.location.country).
| Flag | Alias | Description |
|---|---|---|
--num-buckets | -n | Number of buckets to return (default: 25, range: 1-2000; verified on cencli 1.1.3, 2026-08 — lower bound client-side, upper bound server-side 422) |
--count-by-level | -l | Document level to count at, for nested fields (e.g. count at the service level vs. the host level) |
--filter-by-query | -f | Limit aggregation to field values that also match the query (rather than aggregating across all values present on matching documents) |
--collection-id | -c | Aggregate within a specific collection (UUID) |
--interactive | -i | Open an interactive TUI table for browsing buckets |
Unlike most other censys subcommands, aggregate defaults to -O short rather than json. Pass --output-format/-O explicitly with json, yaml, tree, or short to override. -O template is not supported for aggregate and exits with code 2.
See ${CLAUDE_SKILL_DIR}/references/cli-globals.md for the full global flags reference (output
format, diagnostics, org-id, and PAT vs OAuth notes). Note: aggregate does
not support -S (streaming) or -O template.
# Top 10 SSH ports
censys aggregate "host.services.protocol=SSH" "host.services.port" -n 10
# Country breakdown for hosts on port 443
censys aggregate "host.services.port: 443" "host.location.country"
# Protocol distribution on port 22, limited to values matching the query
censys aggregate "host.services.port=22" "host.services.protocol" --filter-by-query
# Country breakdown for HTTP hosts, as JSON for downstream processing
censys aggregate "host.services.protocol=HTTP" "host.location.country" -O json
# Interactive TUI table for browsing protocol buckets on port 22
censys aggregate "host.services.port=22" "host.services.protocol" -i
Each result is a bucket with two fields:
key — the field value for that bucket (e.g. a port number, country name, or protocol string)count — the number of matching documents with that valueNotes on shaping the bucket set:
--count-by-level/-l matters for nested fields where a host can have multiple services. Counting at the service level counts every matching service occurrence; counting at the host level counts each host once regardless of how many matching services it has. Pick the level that matches what the user actually means by "count" (e.g. "how many hosts run SSH" vs. "how many SSH services exist").
--filter-by-query/-f restricts aggregation to field values that also satisfy the query itself, rather than aggregating across every value present on the matching document set. Use this when the user wants the breakdown scoped strictly to the condition they searched for (e.g. protocol distribution only among the ports the query matched), not a broader profile of the matching hosts.
--num-buckets/-n is a hard cap on returned buckets, not a sample size — if the true cardinality of the field exceeds -n, only the top buckets by count are returned. Raise -n (up to 2000) if the user wants the long tail.
Do not use a bucket sum as a total. jq '[.[].count] | add' adds only the buckets the server returned. -n limits that number, and the default is 25. If the field has more distinct values than -n, the sum is lower than the true total. The command gives no warning.
Measured on one query (host.services: pinned to 3 ports and a vendor; from investigation data, 2026):
-n | Sum of buckets | True total |
|---|---|---|
| 8 | 67 | 144 |
| 20 | 103 | 144 |
| 50 | 136 | 144 |
| 200 | 144 | 144 |
The sum at -n 8 is 2.1 times too low. A report that used it stated 67 hosts. The correct number was 144.
Rule: use aggregate for distribution. Use search for a total. To count the hosts that match a query, page the query:
censys search '<query>' --max-pages -1 --page-size 100 -O json | jq 'length'
To confirm a bucket sum is complete, run the same aggregation twice with a large -n (for example 20 and 1000). If the sum increases, the smaller -n was too low. If both sums are equal, the field cardinality is below the smaller -n and the sum is the total.
-O template requested: aggregate does not support template output and exits with code 2. Fall back to -O json and post-process with jq, or use -O short/-O tree for direct review.censys-cenql for field paths, operators, and syntax reference before retrying.host.services.port vs. host.location.country) against censys-cenql's field reference.--num-buckets out of range: values outside 1-2000 are rejected; clamp the request before retrying.censys auth login to re-authenticate (OAuth), or verify the PAT is still valid via censys config auth add if using a token.--org-id/-o explicitly — the query may be scoping to the wrong (or no) organization.count is computed server-side across the full matching document set. A bucket count is not a sample. But this applies to each bucket on its own, not to the set of buckets: -n still limits how many buckets come back. An accurate per-bucket count and an incomplete bucket list can appear in the same response. Do not read per-bucket accuracy as proof that the bucket list is complete.-n cap will silently truncate to the top values by count; confirm with the user whether they want the full distribution before running such an aggregation.--collection-id requires a valid collection UUID that the authenticated identity has access to; an unrecognized or unauthorized UUID returns an error rather than an empty bucket set.short) is meant for quick terminal review of key/count pairs; switch to -O json before piping into jq or other tooling.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub censys/censys-ai-skills --plugin censys9 skills in this plugin
/censys-analyzeUse when the user wants to do structured post-retrieval analysis on Censys CLI output — e.g. "censys analyze results," "analyze censys data," "censys jq," "query saved censys data," "censys batch certs," "cross-reference censys results," or "censys post-processing." Teaches saving CLI output to files, jq recipes for filtering/extraction, loading results into SQLite for SQL-style queries, batch certificate workflows, and cross-referencing multiple result sets. Not for generating the underlying data — see censys-search, censys-view, or censys-timeline for that./censys-cenqlUse when the user needs help with CenQL syntax, censys query syntax, how to write a censys query, what censys fields are available, or censys query help — field paths, operators, quoting/escaping rules, or example queries for hosts, certificates, and web properties. Trigger phrases include "CenQL syntax," "censys query syntax," "how do I write a censys query," "what censys fields are available," and "censys query help." Also fires when the user writes "CQL," a frequent misspelling of CenQL. This is a reference skill, not a CLI wrapper — defer to censys-search, censys-aggregate, or censys-view to actually execute the query once it's constructed./censys-censeyeUse when the user wants to run censys censeye, censys pivot analysis, censys rarity analysis, censys find related infrastructure, or run censeye on a host. Wraps the `censys censeye` CLI subcommand to analyze a single host and generate pivotable threat-hunting queries bounded by rarity (how many other hosts share each attribute). Trigger phrases include "censys censeye," "censys pivot analysis," "censys rarity analysis," "censys find related infrastructure," and "run censeye on." Requires Threat Hunting feature access on the organization. Not for criteria-based search (see censys-search) or single-record point lookups (see censys-view)./censys-enrichUse when the user wants fast, credit-free IP context for SOC/triage work via the Censys CLI — e.g. "censys enrich," "censys enrich this IP," "censys bulk enrich," "censys triage IP," "censys SOC lookup," "is this IP interesting per censys," "censys check this IP for scanning activity," or "censys reputation on this address." Wraps `censys enrich` for single/bulk IP enrichment (location, AS, WHOIS, DNS, labels, GreyNoise, reputation, network/privacy classification, third-party verdicts). Not for full host records with all services and raw banners (see censys-view) or criteria-based search (see censys-search)./censys-investigateUse when the user explicitly requests a multi-step Censys investigation — e.g. "censys investigate," "censys deep dive into," "trace this infrastructure with censys," "censys pivot chain," "full censys investigation," "hunt for related infrastructure," or "/censys-investigate." This is a heavyweight methodology skill (typically 20–50+ API calls) — do NOT fire on simple lookups like "what's running on this IP" or "profile this host" (use censys-view for those). Structured as a baseline collection phase followed by decision trees that branch on what the baseline reveals. Prescribes a findings template and data preservation convention. Always confirms scope and estimated cost with the user before starting./censys-searchUse when the user wants to run a censys search, censys search for hosts or certificates, search censys for hosts/certs/web properties, find censys hosts with a given condition, run a censys query for hosts, or search for certificates on censys using CenQL. Wraps the `censys search` CLI subcommand. Trigger phrases include "censys search," "search censys for," "find censys hosts with," "censys query for hosts," and "search for certificates on censys." Do not use for viewing a single known host/cert/domain by identifier (see censys-view) or for aggregating/counting by field (see censys-aggregate).Other plugins' skills for the same job