> 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/s/shodan.md).

# Shodan

Shodan indexes internet-connected hosts and their open services. OctoXLabs runs a Shodan search query that you define and adds the matching hosts, one device per IP with its open ports, to the device inventory.

## Use cases

* List internet-facing hosts that Shodan reports for your ranges.

```
Adapters = shodan
```

* Find Shodan hosts that are not in your internal inventory.

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

## Before you begin

### Network

| Source              | Destination                    | Port | Protocol |
| ------------------- | ------------------------------ | ---- | -------- |
| OctoXLabs connector | api.shodan.io (default domain) | 443  | HTTPS    |

### Required permissions

| Scope or role  | Permission             | Needed for                                                        |
| -------------- | ---------------------- | ----------------------------------------------------------------- |
| Shodan API key | Search (query credits) | `/shodan/host/search` uses 1 query credit per page of 100 results |

## Create credentials in Shodan

{% stepper %}
{% step %}

### Log in

Log in to your Shodan account at account.shodan.io.
{% endstep %}

{% step %}

### Copy the key

Copy your API key from the dashboard.
{% endstep %}
{% endstepper %}

## Connection parameters

| Parameter | Required | Type    | Default       | Description                                                                                                                                                |
| --------- | -------- | ------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Domain    | Yes      | String  | api.shodan.io | Base domain of the Shodan API.                                                                                                                             |
| API Key   | Yes      | String  | None          | Shodan API key.                                                                                                                                            |
| Query     | Yes      | String  | None          | Shodan search query that selects the hosts. Examples: `net:203.0.113.0/24`, `org:"Company Name"`, `port:22 country:US`.                                    |
| Proxy     | No       | String  | None          | Proxy as host:port. The connector prefixes it with http\://.                                                                                               |
| Timeout   | No       | Integer | 30            | Seconds to wait for API responses.                                                                                                                         |
| Max Pages | No       | Integer | 0             | Maximum pages to fetch. Each page returns 100 results and costs 1 query credit. 0 means no limit. A broad query can match millions of hosts, so set a cap. |

## Troubleshooting

| Error message | Cause                                                                                                                                      | Fix                                                                                                                          |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
| Status Code:  | The API answered with a status other than the one the connector expects. The message also lists the URL, the method and the response body. | Read the status code and the response body in the message, then check the credentials, the permissions and the network path. |

## Change history

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