> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/adapters/c/censys.md).

# Censys

Censys scans the internet to give visibility into internet-facing assets, open ports, services and vulnerabilities. OctoXLabs reads the hosts in your ASN or CIDR range and the members of your Censys organization.

## Use cases

* **Find internet-facing hosts that are not in your inventory.** List hosts that Censys sees but no internal adapter reports. Replace `active-directory` with an internal source that covers your hosts.

```
Adapters = censys AND NOT Adapters = active-directory
```

* **Review Censys organization members.** List users that come from Censys.

```
Adapters = censys
```

Use the Vulnerabilities and Applications inventories to review the CVEs and the software that Censys reports on the exposed services.

## Before you begin

### Network

| Source              | Destination            | Port | Protocol |
| ------------------- | ---------------------- | ---- | -------- |
| OctoXLabs connector | api.platform.censys.io | 443  | HTTPS    |

If a proxy is set, requests go through it as `http://<value>`.

### Required permissions

| Scope or role             | Permission | Needed for                    |
| ------------------------- | ---------- | ----------------------------- |
| Global Data               | Read       | Fetching host data            |
| Organization-level access | Read       | Fetching organization members |

Both permissions are stated in the baseline. The connection test needs the organization members call to work.

## Create credentials in Censys

{% stepper %}
{% step %}

### Generate an API token

In the Censys Platform, go to **Settings > API Access** and generate a new API token. Copy the token.
{% endstep %}

{% step %}

### Find the Organization ID

In the Censys Platform, go to **Settings > Organization** and copy the Organization ID.
{% endstep %}

{% step %}

### Choose the host filter

Decide on an ASN (for example `9121`), a CIDR range (for example `203.0.113.0/24`), or both. If both are set, they are combined with OR. At least one of them should be set.
{% endstep %}
{% endstepper %}

## Connection parameters

| Parameter       | Required | Type    | Default | Description                                           |
| --------------- | -------- | ------- | ------- | ----------------------------------------------------- |
| API token       | Yes      | String  | None    | Censys API token. Stored as a sensitive value.        |
| Organization ID | Yes      | String  | None    | Organization whose members are fetched.               |
| ASN             | No       | String  | None    | Filters hosts with `host.autonomous_system.asn`.      |
| CIDR            | No       | String  | None    | Filters hosts with `host.ip in "<cidr>"`.             |
| Proxy           | No       | String  | None    | Proxy address, used as `http://<value>`.              |
| Timeout         | No       | Integer | 30      | Seconds to wait for an API response. Advanced option. |

## Troubleshooting

| Error message                                                  | Cause                                    | Fix                                                       |
| -------------------------------------------------------------- | ---------------------------------------- | --------------------------------------------------------- |
| Max retries exceeded for {url}                                 | The API kept answering 429 (rate limit). | Run discovery again later.                                |
| Status Code: `, followed by URL, Method and the response body` | The API answered with an error status.   | Check the token, its permissions and the Organization ID. |

## Change history

{% hint style="info" %}
Available starting from version 6.4.1.
{% endhint %}
