censys.search.v1 package

Interact with the Censys Search v1 APIs.

class censys.search.v1.CensysCertificates(api_id: Optional[str] = None, api_secret: Optional[str] = None, **kwargs)[source]

Bases: censys.search.v1.api.CensysSearchAPIv1

Interacts with the Certificates index.

See CensysSearchAPIv1 for additional arguments.

Parameters
  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

INDEX_NAME: Optional[str] = 'certificates'

Name of Censys Index.

MAX_PER_BULK_REQUEST = 50

Max number of bulk requests.

bulk(fingerprints: List[str])dict[source]

Requests bulk certificates.

Parameters

fingerprints (List[str]) – List of certificate SHA256 fingerprints.

Returns

Search results from an API query.

Return type

dict

bulk_path = '/bulk/certificates'
class censys.search.v1.CensysData(api_id: Optional[str] = None, api_secret: Optional[str] = None, **kwargs)[source]

Bases: censys.search.v1.api.CensysSearchAPIv1

Interacts with the Data index.

For more details, see our documentation: https://censys.io/api/v1/docs/data

get_series()dict[source]

Get data on the types of scans we regularly perform (series).

Returns

The result set returned.

Return type

dict

view_result(series_id: str, result_id: str)dict[source]

View a specific result of a specific series.

Parameters
  • series_id (str) – The ID of the series.

  • result_id (str) – The ID of the result.

Returns

The result set returned.

Return type

dict

view_series(series_id: str)dict[source]

Get data on a specific series.

Parameters

series_id (str) – The ID of the series.

Returns

The result set returned.

Return type

dict

class censys.search.v1.CensysIPv4(api_id: Optional[str] = None, api_secret: Optional[str] = None, **kwargs)[source]

Bases: censys.search.v1.api.CensysSearchAPIv1

Interacts with the IPv4 index.

INDEX_NAME: Optional[str] = 'ipv4'

Name of Censys Index.

class censys.search.v1.CensysWebsites(api_id: Optional[str] = None, api_secret: Optional[str] = None, **kwargs)[source]

Bases: censys.search.v1.api.CensysSearchAPIv1

Interacts with the Websites index.

INDEX_NAME: Optional[str] = 'websites'

Name of Censys Index.

censys.search.v1.api module

Base for interacting with the Censys Search API.

censys.search.v1.api.CensysSearchAPI

alias of censys.search.v1.api.CensysSearchAPIv1

class censys.search.v1.api.CensysSearchAPIv1(api_id: Optional[str] = None, api_secret: Optional[str] = None, **kwargs)[source]

Bases: censys.common.base.CensysAPIBase

This class is the base class for all v1 API indexes.

See CensysAPIBase for additional arguments.

Parameters
  • api_id (str) – Optional; The API ID provided by Censys.

  • api_secret (str) – Optional; The API secret provided by Censys.

  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

Raises

CensysException – Base Exception Class for the Censys API.

DEFAULT_URL: str = 'https://censys.io/api/v1'

Default Search API base URL.

INDEX_NAME: Optional[str] = None

Name of Censys Index.

account()dict[source]

Gets the current account information.

This includes email and quota.

Returns

Account response.

Return type

dict

metadata(query: str)dict[source]

Returns metadata of a given search query.

Parameters

query (str) – The query to be executed.

Returns

The metadata of the result set returned.

Return type

dict

quota()dict[source]

Gets the current account’s query quota.

Returns

Quota response.

Return type

dict

report(query: str, field: str, buckets: int = 50)dict[source]

Creates a report on the breakdown of the values of a field in a result set.

For more details, see our documentation: https://censys.io/api/v1/docs/report

Parameters
  • query (str) – The query to be executed.

  • field (str) – The field you are running a breakdown on.

  • buckets (int) – Optional; The maximum number of values. Defaults to 50.

Returns

The result set returned.

Return type

dict

search(query: str, fields: Optional[List[str]] = None, page: int = 1, max_records: Optional[int] = None, flatten: bool = True)Iterator[dict][source]

Searches the given index for all records that match the given query.

For more details, see our documentation: https://censys.io/api/v1/docs/search

Parameters
  • query (str) – The query to be executed.

  • fields (Fields) – Optional; Fields to be returned in the result set.

  • page (int) – Optional; The page of the result set. Defaults to 1.

  • max_records (int) – Optional; The maximum number of records.

  • flatten (bool) – Optional; Flattens fields to dot notation. Defaults to True.

Raises

CensysException – Base Exception Class for the Censys API.

Yields

dict – The result set returned.

view(document_id: str)dict[source]

View the current structured data we have on a specific document.

For more details, see our documentation: https://censys.io/api/v1/docs/view

Parameters

document_id (str) – The ID of the document you are requesting.

Returns

The result set returned.

Return type

dict