Skip to main content

Pydantic model for Shodan banner

Project description

pydantic-shodan

Python 3 library containing Pydantic models for parsing and validating Shodan banners.

About

It is based on the JSON schema provided by Shodan and extended with fields such as ethereum_p2p that are not documented in the schema but occasionally present in the banner. The library was tested with on approximately 300k banners.

Installation

pip install pydantic-shodan

Example

import json
from pydantic_shodan import Banner

BANNER_JSON = """
{
    "_shodan": {
        "id": "7383056c-d513-4b43-8734-b82d897888e6",
        "options": {},
        "ptr": true,
        "module": "dns-udp",
        "crawler": "9d8ac08f91f51fa9017965712c8fdabb4211dee4"
    },
    "hash": -553166942,
    "os": null,
    "opts": {
        "raw": "34ef818200010000000000000776657273696f6e0462696e640000100003"
    },
    "ip": 134744072,
    "isp": "Google",
    "port": 53,
    "hostnames": [
        "dns.google"
    ],
    "location": {
        "city": null,
        "region_code": null,
        "area_code": null,
        "longitude": -97.822,
        "country_code3": null,
        "country_name": "United States",
        "postal_code": null,
        "dma_code": null,
        "country_code": "US",
        "latitude": 37.751
    },
    "dns": {
        "resolver_hostname": null,
        "recursive": true,
        "resolver_id": null,
        "software": null
    },
    "timestamp": "2021-01-28T07:21:33.444507",
    "domains": [
        "dns.google"
    ],
    "org": "Google",
    "data": "Recursion: enabled",
    "asn": "AS15169",
    "transport": "udp",
    "ip_str": "8.8.8.8"
}
"""

banner = Banner.parse_obj(json.loads(BANNER_JSON))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydantic-shodan-1.0.0.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

pydantic_shodan-1.0.0-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file pydantic-shodan-1.0.0.tar.gz.

File metadata

  • Download URL: pydantic-shodan-1.0.0.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for pydantic-shodan-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2fb5e01d9431032cd164b95c157ae87fffe8d59f9cd6214dd29e67a47a99f9fe
MD5 87967029dc78db4d24807d0983c345d6
BLAKE2b-256 78e55313fa33ba40422e9f8dd8245fe2cdd8deb4688d9541616e3ce93d19c42c

See more details on using hashes here.

File details

Details for the file pydantic_shodan-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pydantic_shodan-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for pydantic_shodan-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 61d0259b57a3a6c4cc93e1a4cefe2c589acd7980d0b909259becec0abec064d7
MD5 1246c492a88b2a1dbec1f4ce0da6d2a1
BLAKE2b-256 75389c81b0279d123696f3c9d31cfe571d0d840efd17c5a14241a0785dc57049

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page