censys.asm package¶
Submodules¶
censys.asm.api module¶
Base for interacting with the Censys Search API.
-
class
censys.asm.api.
CensysAsmAPI
(api_key: Optional[str] = None, **kwargs)[source]¶ Bases:
censys.base.CensysAPIBase
This is the base class for ASM’s Seeds, Assets, and Events classes
-
DEFAULT_URL
: str = 'https://app.censys.io/api/v1'¶ Default ASM API base URL.
-
censys.asm.assets module¶
Class for interfacing with the Censys Assets API.
-
class
censys.asm.assets.
Assets
(asset_type, api_key: Optional[str] = None, **kwargs)[source]¶ Bases:
censys.asm.api.CensysAsmAPI
Assets API class
-
add_comment
(asset_id: str, comment: str) → dict[source]¶ Adds a comment to a specified asset on the ASM platform.
- Args:
asset_id (str): Asset ID to add comment to. comment (str): New comment text.
- Returns:
dict: Added comment results.
-
add_tag
(asset_id: str, name: str, color: Optional[str] = None) → dict[source]¶ Adds a tag to a specified asset on the ASM platform.
- Args:
asset_id (str): Asset ID to add tag to. name (str): New tag name. color (str, optional): New tag color.
-
delete_tag
(asset_id: str, name: str) → dict[source]¶ Deletes a tag from a specified asset on the ASM platform by tag name.
- Args:
asset_id (str): Asset ID to delete tag from. name (str): Tag name to delete.
-
get_asset_by_id
(asset_id: str) → dict[source]¶ Requests asset data by ID.
- Args:
asset_id (str): Requested asset ID.
- Returns:
dict: Asset search result.
-
get_assets
(page_number: int = 1, page_size: Optional[int] = None) → Generator[dict, None, None][source]¶ Requests assets data.
- Args:
page_number (int, optional): Page number to begin at when searching. page_size (int, optional): Page size for retrieving assets.
- Returns:
generator: Asset search results.
-
get_comment_by_id
(asset_id: str, comment_id: int) → dict[source]¶ Requests a comment on a specified asset by comment ID.
- Args:
asset_id (str): Asset ID for requested comments. comment_id (int): Requested comment ID.
- Returns:
dict: Comment search result.
-
get_comments
(asset_id: str, page_number: int = 1, page_size: Optional[int] = None) → Generator[dict, None, None][source]¶ Requests comments on a specified asset.
- Args:
asset_id (str): Asset ID for requested comments. page_number (int, optional): Page number to begin at when searching. page_size (int, optional): Page size for retrieving comments.
- Returns:
generator: Comment search results.
-
censys.asm.client module¶
Client for interacting with the Censys ASM API.
censys.asm.events module¶
Class for interfacing with the Censys Logbook API.
-
class
censys.asm.events.
Events
(api_key: Optional[str] = None, **kwargs)[source]¶ Bases:
censys.asm.api.CensysAsmAPI
Events API class
-
get_cursor
(start: Optional[Union[datetime.datetime, int]] = None, filters: Optional[List[str]] = None) → str[source]¶ Requests a logbook cursor.
- Args:
start (datetime or int, optional): Timestamp or event ID to begin searching. filters (list, optional): List of filters applied to logbook search results.
- Returns:
str: Cursor result.
-
-
class
censys.asm.events.
Filters
[source]¶ Bases:
object
Logbook filters class
-
CERT
= 'CERT'¶
-
CERT_RISK
= 'CERT_RISK'¶
-
DOMAIN
= 'DOMAIN'¶
-
DOMAIN_EXPIRATION_DATE
= 'DOMAIN_EXPIRATION_DATE'¶
-
DOMAIN_MAIL_EXCHANGE_SERVER
= 'DOMAIN_MAIL_EXCHANGE_SERVER'¶
-
DOMAIN_NAME_SERVER
= 'DOMAIN_NAME_SERVER'¶
-
DOMAIN_REGISTRAR
= 'DOMAIN_REGISTRAR'¶
-
DOMAIN_RISK
= 'DOMAIN_RISK'¶
-
DOMAIN_SUBDOMAIN
= 'DOMAIN_SUBDOMAIN'¶
-
HOST
= 'HOST'¶
-
HOST_CERT
= 'HOST_CERT'¶
-
HOST_PORT
= 'HOST_PORT'¶
-
HOST_PROTOCOL
= 'HOST_PROTOCOL'¶
-
HOST_RISK
= 'HOST_RISK'¶
-
HOST_SOFTWARE
= 'HOST_SOFTWARE'¶
-
HOST_VULNERABILITY
= 'HOST_VULNERABILITY'¶
-
-
censys.asm.events.
format_data
(start: Optional[Union[datetime.datetime, int]] = None, filters: Optional[List[str]] = None) → dict[source]¶ Formats cursor request data into a start date/id and filter list
- Args:
start (datetime or int, optional): Timestamp or event ID to begin searching. filters (list, optional): List of filters applied to logbook search results.
- Returns:
dict: Formatted logbook cursor request data
censys.asm.seeds module¶
Class for interfacing with the Censys Seeds API.
-
class
censys.asm.seeds.
Seeds
(api_key: Optional[str] = None, **kwargs)[source]¶ Bases:
censys.asm.api.CensysAsmAPI
Seeds API class
-
add_seeds
(seeds: list, force: Optional[bool] = False) → dict[source]¶ Add seeds to the ASM platform.
- Args:
seeds (list): List of seed objects to add. force (bool, optional): Forces replace operation.
- Returns:
dict: Added seeds results.
-
delete_seed_by_id
(seed_id: int) → dict[source]¶ Delete a seed in the ASM platform by id.
- Args:
seed_id (int): Seed ID to delete by.
-
delete_seeds_by_label
(label: str) → dict[source]¶ Delete seeds in the ASM platform by label.
- Args:
label (str): Label name to delete by.
-
get_seed_by_id
(seed_id: int) → dict[source]¶ Requests seed data by ID.
- Args:
seed_id (int): Seed ID to get.
- Returns:
dict: Seed search result.
-
get_seeds
(seed_type: Optional[str] = None) → dict[source]¶ Requests seed data.
- Args:
- seed_type (str, optional): Seed type
[‘IP_ADDRESS’, ‘DOMAIN_NAME’, ‘CIDR’, ‘ASN’].
- Returns:
dict: Seed search results.
-
replace_seeds_by_label
(label: str, seeds: list, force: Optional[bool] = False) → dict[source]¶ Replace seeds in the ASM platform by label.
- Args:
label (str): Label name to replace by. seeds (list): List of seed objects to add. force (bool, optional): Forces replace operation.
- Returns:
dict: Added and removed seeds results.
-
Module contents¶
An easy-to-use and lightweight API wrapper for the Censys ASM platform (censys.io).