Censys Search Executor¶
Category: Attack Surface Management
Script: censys.py
Integration: REST API
Faraday Plugin: Raw JSON
Website: https://search.censys.io
Description¶
Runs a Censys Search v2 query and imports the matching hosts, exposed services and certificates into Faraday as attack-surface discoveries.
Prerequisites¶
- A Censys account with Search API access
- A Censys API ID and secret, from the console under Account > API
requestsavailable in the agent's Python environment
Configuration¶
Environment Variables (Setup)¶
| Variable | Required | Description |
|---|---|---|
CENSYS_HOST |
Yes | Censys Search API host (default: https://search.censys.io). Change only for a federated or on-prem deployment. |
CENSYS_API_ID |
Yes | Censys API ID, from the console under Account > API |
CENSYS_API_SECRET |
Yes | Censys API secret paired with the API ID |
These variables are also accepted as execution arguments, so a single run can override them.
Execution Arguments¶
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
CENSYS_QUERY |
string | Yes | Censys query language filter (e.g., services.service_name: HTTP and location.country_code: AR) |
CENSYS_VIRTUAL_HOSTS |
string | No | How to handle virtual hosts on the hosts search: INCLUDE, EXCLUDE or ONLY (default: EXCLUDE). Boolean-style values (true/false) also work. Ignored on the certificates search. |
CENSYS_PAGES |
string | No | Maximum number of pages of 100 hits to read for hosts and, separately, for certificates (default: 5, maximum: 50) |
YAML Configuration Example¶
executors:
censys:
repo_executor: censys.py
max_size: 65536
varenvs:
CENSYS_HOST: "https://search.censys.io"
CENSYS_API_ID: "<censys_api_id>"
CENSYS_API_SECRET: "<censys_api_secret>"
params:
CENSYS_QUERY:
mandatory: true
type: string
base: string
CENSYS_VIRTUAL_HOSTS:
mandatory: false
type: string
base: string
CENSYS_PAGES:
mandatory: false
type: string
base: string
How It Works¶
- Authenticates every request with HTTP Basic (
CENSYS_API_IDas the username,CENSYS_API_SECRETas the password) - Runs
CENSYS_QUERYagainstGET /api/v2/hosts/searchand separately againstGET /api/v2/certificates/search, 100 hits per page (cursor-based pagination) - Creates one host per matching IP (or per virtual host name), with its ASN, location and OS fingerprint in the description, and one Faraday service per exposed port
- Creates one vulnerability per exposed service, named
[EASM] Censys exposed <service> on <port>/<proto>. Severity isinfoby default,lowfor historically risky unauthenticated services (Telnet, FTP, SMB, RDP, database ports, Docker/Kubernetes APIs, etc.), andmediumwhen the TLS certificate is self-signed, expired or untrusted. - Creates one host per matching certificate, on the synthetic IP
0.0.0.0with the certificate's SANs as hostnames, and oneinfovulnerability with the certificate details
Notes¶
CENSYS_QUERYis mandatory; Censys rejects an empty query.- The virtual-hosts setting only affects the hosts search. Set
CENSYS_VIRTUAL_HOSTS=ONLYto search virtual hosts exclusively. - By default the executor reads at most 500 host hits and 500 certificate hits per run. Raise
CENSYS_PAGESfor larger result sets. CENSYS_HOSTcan be given with or withouthttps://. Without it,https://is assumed. The default is the public Censys cloud.- The run stops if the credentials are rejected (HTTP 401). If Censys rate-limits or denies a later request, the executor keeps what it has already read.
- The shared agent parameters (
AGENT_CONFIG_*tags and severity filters) are not applied by this executor.