Shodan API

URL:https://api.shodan.io


搜索

GET /shodan/host/{ip}

https://api.shodan.io/shodan/host/{ip}?key=g4KxLwWB4y5wwp4czRTgCfK6KN2eHuzP

请求样例

curl -X GET "https://api.shodan.io/shodan/host/8.8.8.8?key=g4KxLwWB4y5wwp4czRTgCfK6KN2eHuzP"

返回样例

{
    "area_code": None,
    "asn": "AS15169",
    "city": None,
    "country_code": "US",
    "country_code3": None,
    "country_name": "United States",
    "data": [
        {
            "asn": "AS15169",
            "data": "\nRecursion: enabled",
            "dns": {
                "recursive": True,
                "resolver_hostname": None,
                "resolver_id": None,
                "software": None,
            },
            "domains": ["dns.google"],
            "hash": -553166942,
            "hostnames": ["dns.google"],
            "ip": 134744072,
            "ip_str": "8.8.8.8",
            "isp": "Google",
            "location": {
                "area_code": None,
                "city": None,
                "country_code": "US",
                "country_code3": None,
                "country_name": "United States",
                "dma_code": None,
                "latitude": 37.751,
                "longitude": -97.822,
                "postal_code": None,
                "region_code": None,
            },
            "opts": {
                "raw": "34ef818200010000000000000776657273696f6e0462696e640000100003"
            },
            "org": "Google",
            "os": None,
            "port": 53,
            "timestamp": "2021-01-22T08:49:35.190817",
            "transport": "udp",
        }
    ],
    "dma_code": None,
    "domains": ["dns.google"],
    "hostnames": ["dns.google"],
    "ip": 134744072,
    "ip_str": "8.8.8.8",
    "isp": "Google",
    "last_update": "2021-01-22T08:49:35.190817",
    "latitude": 37.751,
    "longitude": -97.822,
    "org": "Google",
    "os": None,
    "ports": [53],
    "postal_code": None,
    "region_code": None,
    "tags": [],
}

GET /shodan/host/count

https://api.shodan.io/shodan/host/count?key=g4KxLwWB4y5wwp4czRTgCfK6KN2eHuzP&query={query}&facets={facets}

请求样例

curl -X GET "https://api.shodan.io/shodan/host/count?key=g4KxLwWB4y5wwp4czRTgCfK6KN2eHuzP&query=port:22&facets=org,os"

返回样例

{
    "matches": [],
    "facets": {
        "org": [
            {
                "count": 3012386,
                "value": "Amazon.com"
            },
            {
                "count": 1322102,
                "value": "Google Cloud"
            },
            {
                "count": 1075807,
                "value": "Digital Ocean"
            },
            {
                "count": 687155,
                "value": "OVH SAS"
            },
            {
                "count": 450521,
                "value": "Tencent cloud computing"
            }
        ],
        "os": [
            {
                "count": 601923,
                "value": "Ubuntu"
            },
            {
                "count": 227851,
                "value": "Debian"
            },
            {
                "count": 7660,
                "value": "Raspbian"
            }
        ]
    },
    "total": 19590274
}
https://api.shodan.io/shodan/host/search?key=g4KxLwWB4y5wwp4czRTgCfK6KN2eHuzP&query={query}&facets={facets}

请求样例

curl -X GET "https://api.shodan.io/shodan/host/search?key=g4KxLwWB4y5wwp4czRTgCfK6KN2eHuzP&query=product:nginx&facets=country"

返回样例

{
    "matches": [
        {
            "product": "nginx",
            "hash": -1609083510,
            "ip": 1616761883,
            "org": "Comcast Business",
            "isp": "Comcast Business",
            "transport": "tcp",
            "cpe": [
                "cpe:/a:igor_sysoev:nginx"
            ],
            "data": "HTTP/1.1 400 Bad Request\r\nServer: nginx\r\nDate: Mon, 25 Jan 2021 21:33:48 GMT\r\nContent-Type: text/html\r\nContent-Length: 650\r\nConnection: close\r\n\r\n",
            "asn": "AS7922",
            "port": 443,
            "hostnames": [
                "three.webapplify.net"
            ],
            "location": {
                "city": "Denver",
                "region_code": "CO",
                "area_code": null,
                "longitude": -104.9078,
                "country_code3": null,
                "latitude": 39.7301,
                "postal_code": null,
                "dma_code": 751,
                "country_code": "US",
                "country_name": "United States"
            },
            "timestamp": "2021-01-25T21:33:49.154513",
            "domains": [
                "webapplify.net"
            ],
            "http": {
                "robots_hash": null,
                "redirects": [],
                "securitytxt": null,
                "title": "400 The plain HTTP request was sent to HTTPS port",
                "sitemap_hash": null,
                "robots": null,
                "server": "nginx",
                "host": "96.93.212.27",
                "html": "\r\n400 The plain HTTP request was sent to HTTPS port\r\n\r\n400 Bad Request\r\nThe plain HTTP request was sent to HTTPS port\r\nnginx\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n",
                "location": "/",
                "components": {},
                "securitytxt_hash": null,
                "sitemap": null,
                "html_hash": 199333125
            },
            "os": null,
            "_shodan": {
                "crawler": "c9b639b99e5410a46f656e1508a68f1e6e5d6f99",
                "ptr": true,
                "id": "534cc127-e734-44bc-be88-2e219a56a099",
                "module": "auto",
                "options": {}
            },
            "ip_str": "96.93.212.27"
        },
        {
            "product": "nginx",
            "hostnames": [
                "kolobok.us"
            ],
            "hash": 1940048442,
            "ip": 3104568883,
            "org": "RuWeb",
            "isp": "RuWeb",
            "transport": "tcp",
            "cpe": [
                "cpe:/a:igor_sysoev:nginx:1.4.2"
            ],
            "data": "HTTP/1.1 410 Gone\r\nServer: nginx/1.4.2\r\nDate: Mon, 25 Jan 2021 21:33:50 GMT\r\nContent-Type: text/html; charset=iso-8859-1\r\nContent-Length: 295\r\nConnection: keep-alive\r\n\r\n",
            "asn": "AS49189",
            "port": 80,
            "version": "1.4.2",
            "location": {
                "city": null,
                "region_code": null,
                "area_code": null,
                "longitude": 37.6068,
                "country_code3": null,
                "latitude": 55.7386,
                "postal_code": null,
                "dma_code": null,
                "country_code": "RU",
                "country_name": "Russia"
            },
            "timestamp": "2021-01-25T21:33:51.172037",
            "domains": [
                "kolobok.us"
            ],
            "http": {
                "robots_hash": null,
                "redirects": [],
                "securitytxt": null,
                "title": "410 Gone",
                "sitemap_hash": null,
                "robots": null,
                "server": "nginx/1.4.2",
                "host": "185.11.246.51",
                "html": "\n\n410 Gone\n\nGone\nThe requested resource/\nis no longer available on this server and there is no forwarding address.\nPlease remove all references to this resource.\n\n",
                "location": "/",
                "components": {},
                "securitytxt_hash": null,
                "sitemap": null,
                "html_hash": 922034037
            },
            "os": null,
            "_shodan": {
                "crawler": "c9b639b99e5410a46f656e1508a68f1e6e5d6f99",
                "ptr": true,
                "id": "118b7360-01d0-4edb-8ee9-01e411c23e60",
                "module": "auto",
                "options": {}
            },
            "ip_str": "185.11.246.51"
        },
        ...
    ],
    "facets": {
        "country": [
            {
                "count": 7883733,
                "value": "US"
            },
            {
                "count": 2964965,
                "value": "CN"
            },
            {
                "count": 1945369,
                "value": "DE"
            },
            {
                "count": 1717359,
                "value": "HK"
            },
            {
                "count": 940900,
                "value": "FR"
            }
        ]
    },
    "total": 23047224
}

GET /shodan/host/search/facets

https://api.shodan.io/shodan/host/search/facets?key=g4KxLwWB4y5wwp4czRTgCfK6KN2eHuzP

请求样例

curl -X GET "https://api.shodan.io/shodan/host/search/facets?key=g4KxLwWB4y5wwp4czRTgCfK6KN2eHuzP"

返回样例

[
    'asn',
    'bitcoin.ip',
    'bitcoin.ip_count',
    ...
]

GET /shodan/host/search/filters

https://api.shodan.io/shodan/host/search/filters?key=g4KxLwWB4y5wwp4czRTgCfK6KN2eHuzP

请求样例

curl -X GET "https://api.shodan.io/shodan/host/search/filters?key=g4KxLwWB4y5wwp4czRTgCfK6KN2eHuzP"

返回样例

[
    "all",
    "asn",
    "bitcoin.ip",
    "bitcoin.ip_count",
    ...
]

GET /shodan/host/search/tokens

https://api.shodan.io/shodan/host/search/tokens?key=g4KxLwWB4y5wwp4czRTgCfK6KN2eHuzP&query={query}

请求样例

curl -X GET "https://api.shodan.io/shodan/host/search/tokens?key=g4KxLwWB4y5wwp4czRTgCfK6KN2eHuzP&query=Raspbian port:22"

返回样例

{
    "attributes": {
        "ports": [22]
    },
    "errors": [],
    "string": "Raspbian",
    "filters": ["port"],
}

扫描

GET /shodan/ports

https://api.shodan.io/shodan/ports?key=g4KxLwWB4y5wwp4czRTgCfK6KN2eHuzP

请求样例

curl -X GET "https://api.shodan.io/shodan/ports?key=g4KxLwWB4y5wwp4czRTgCfK6KN2eHuzP"

返回样例

[
    7,
    11,
    13,
    15,
    ...
]

GET /shodan/protocols

https://api.shodan.io/shodan/protocols?key=g4KxLwWB4y5wwp4czRTgCfK6KN2eHuzP

请求样例

curl -X GET "https://api.shodan.io/shodan/protocols?key=g4KxLwWB4y5wwp4czRTgCfK6KN2eHuzP"

返回样例

{
    "afp": "AFP server information grabbing module",
    "ajp": "Check whether the Tomcat server running AJP protocol",
    "amqp": "Grab information from an AMQP service",
    ...
}

POST /shodan/scan

https://api.shodan.io/shodan/scan?key=g4KxLwWB4y5wwp4czRTgCfK6KN2eHuzP

请求样例(扫描所有服务)

curl -X POST "https://api.shodan.io/shodan/scan?key=g4KxLwWB4y5wwp4czRTgCfK6KN2eHuzP" -d 'ips=8.8.8.8,1.1.1.1'

返回样例

{
    "count": 2,
    "id": "vwWO7P5N1rWF5jbh",
    "credits_left": 100000
}

请求样例(扫描特定服务)

curl -X POST "https://api.shodan.io/shodan/scan?key=g4KxLwWB4y5wwp4czRTgCfK6KN2eHuzP" -d 'ips={
    "1.1.1.1": [
        [53, "dns-udp"],
        [443, "https"]
    ]
}'

返回样例

{
    "count": 1,
    "id": "z1ojEJbI0gy4AqSx",
    "credits_left": 100000
}

POST /shodan/scan/internet

https://api.shodan.io/shodan/scan/internet?key=g4KxLwWB4y5wwp4czRTgCfK6KN2eHuzP

请求样例

curl -X POST "https://api.shodan.io/shodan/scan/internet?key=g4KxLwWB4y5wwp4czRTgCfK6KN2eHuzP" -d 'port=80' -d 'protocol=http'

返回样例

{
    "id": "TcjcsMfPcw4o7O84"
}

GET /shodan/scans

https://api.shodan.io/shodan/scans?key=g4KxLwWB4y5wwp4czRTgCfK6KN2eHuzP

请求样例

curl -X GET "https://api.shodan.io/shodan/scans?key=g4KxLwWB4y5wwp4czRTgCfK6KN2eHuzP"

返回样例

{
    "matches": [
        {
            "status": "PROCESSING",
            "created": "2021-01-26T08:17:43.794000",
            "status_check": "2021-01-26T08:17:43.900000",
            "credits_left": 100000,
            "api_key": "toH56DpDulOnvyxLhOSIxaUgZQeg1gFX",
            "id": "Mo8W7itcWumiy9Ay",
            "size": 1
        },
        {
            "status": "DONE",
            "created": "2021-01-26T08:08:26.296000",
            "status_check": "2021-01-26T08:09:39.636000",
            "credits_left": 100000,
            "api_key": "toH56DpDulOnvyxLhOSIxaUgZQeg1gFX",
            "id": "04GjMnUkQx9HsFhA",
            "size": 1
        },
        ...
    ],
    "total": 19
}

GET /shodan/scan/{id}

https://api.shodan.io/shodan/scan/{id}?key=g4KxLwWB4y5wwp4czRTgCfK6KN2eHuzP

请求样例

curl -X GET "https://api.shodan.io/shodan/scan/Mo8W7itcWumiy9Ay?key=g4KxLwWB4y5wwp4czRTgCfK6KN2eHuzP"

返回样例

{
    "count": 1,
    "status": "DONE",
    "id": "Mo8W7itcWumiy9Ay",
    "created": "2021-01-26T08:17:43.794000"
}

参考文章

Shodan Developer


转载请注明来源,欢迎对文章中的引用来源进行考证,文章可能具有时效性,欢迎指出任何有错误、已失效或不够清晰的表达 ,可通过[邮件](mailto:cnlnnn@qq.com)联系垃圾堆主人

文章标题:Shodan API

字数:2k

本文作者:cnlnn

发布时间:2022-05-18, 08:45:02

最后更新:2022-05-18, 08:45:02

原始链接:https://cnlnn.ml/posts/a15b551a/

版权声明: "署名-非商用-相同方式共享 4.0" 转载请保留原文链接及作者。