Skip to main content

Proofpoint ITM API client library

Project description

proofpoint_itm

Proofpoint ITM API client library for python

Installation

python -m pip install proofpoint_itm

Usage

Create a front end script to import the ITMClient class and create a new ITMClient object by passing in the tenant ID (first part of the admin console url), API Client ID, and client secret as a dict.

from proofpoint_itm import ITMClient

itm_client = ITMClient(
    {
        'tenant_id': <tenant id>,
        'client_id': <api client id>,
        'client_secret': <api client secret>
    }
)

Get Requests

** Not all API objects are supported for get requests, additional API gets will be updated as needed

This library supports get requests for the following object types:

  • Endpoints
  • Rules
  • Predicates (Conditions)
  • Tags
  • Agent Policies
  • Notification Policies
  • Dictionaries
  • Dictionary Terms
  • Detectors
  • Detector Sets
  • Smart IDs

Get requests return a python dictionary object with the corresponding object attributes or a list of objects. See examples below


Endpoints

endpoints = itm_client.get_endpoints()

get_endpoints: (includes: str = '*', kind: str = '*', status: str = '*', headers: dict = None, count: bool = False) -> list

Gets endpoints from the registry API

Args:

  • includes (str):
    • List of attributes to return, defaults to *
  • kind (str):
    • Type of agent to return, Accepts *, agent:saas, or updater:saas, defaults to *
  • status (str):
    • Filter by agent status. Accepts: *, HEALTHY, UNHEALTHY, UNREACHABLE, DEAD, INACTIVE

Returns:

  • A list of endpoint objects

Rules

rules = itm_client.get_rules()
rule = itm_client.get_rule(<id>)

get_rules: (includes: str = '*', headers: dict = None) -> list

Query for all rules in the depot API

Args:

  • includes (str):
    • comma-separated list of attributes to include, default = *
  • headers (dict):
    • headers to include in the http request, if not provided a default header will be created with auth info

Returns:

  • A list of rule objects

get_rule: (id: str, includes: str = '*', headers: dict = None) -> dict

Query for single rule by ID in the depot API

Args:

  • id (str):
    • Rule id to return, if not provided, return all
  • includes (str):
    • Comma-separated list of attributes to include, default = *
  • headers (dict):
    • Headers to include in the http request, if not provided a default header will be created with auth info

Returns:

  • A dict of rule attributes

Predicates (Conditions)

predicates = itm_client.get_predicates()
predicate = itm_client.get_predicate(<id>)

Predicates are conditions either configured directly in a rule, or created as a standalone 'condition'

get_predicates: (includes: str = '*', headers: dict = None) -> list

Query for all predicates in the depot API, does not return built-in/global predicates but will return rule predicates in addition to condition predicates.

Args:

  • includes (str):
    • Comma-separated list of attributes to include, default = *
  • headers (dict):
    • headers to include in the http request, if not provided a default header will be created with auth info

Returns:

  • A list of predicates objects

get_predicate: (id: str, includes: str = '*', headers: dict = None) -> dict

Query for a single predicate by ID

Args:

  • id (str):
    • The predicate id to return
  • includes (str):
    • Comma-separated list of attributes to include, default = *
  • headers (dict):
    • headers to include in the http request, if not provided a default header will be created with auth info

Returns:

  • A dict of predicate attributes

get_conditions: (includes: str = '*', headers: dict = None) -> list

Query for all custom conditions (user created) that are not auto created from rules. This is the condition list defined in Definitions > Conditions in the admin GUI.

Uses the get_predicates call, then post filters for kind = it:predicate:custom:match

Args:

  • includes (str):
    • comma-separated list of attributes to include, default = *
  • headers (dict):
    • headers to include in the http request, if not provided a default header will be created with auth info

Returns:

  • Returns list of predicate objects

Searches

  • activity_search
  • depot_search
  • noficiation_search
  • registry_search
  • ruler_search

Searches require a query be provided as a dictionary representing an elasitcsearch query.

This is a simple example, more information can be found here: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html

{
  "query": {
    "bool": {
      "filter": {
        "term": {
          "status": "active"
        }
      }
    }
  }
}

Aggregate searches are also supported

{
  "aggs": {
    "my-agg-name": {
      "terms": {
        "field": "my-field"
      }
    }
  }
}

activity_search(query: dict, entity: str, params: dict = None, headers: dict = None)

Performs a search query against the activity API

  • Parameters

    • query (dict) – A dict representing an Elasticsearch query, will be converted to json string

    • entity (str) – entityTypes to search for Accepted values: event, casbevent, audit, network

    • params (dict) – A dict of web request url parameters ex. offset = 0, limit=500

    • headers (dict) – Headers to include in the http request, if not provided a default header will be created with auth info

  • Returns

    urllib.response object (dict)

depot_search(query: str, entity: str, params: dict = None, headers: dict = None)

Performs a search query against the depot API

  • Parameters

    • query (dict) – A dict representing an Elasticsearch query, will be converted to json string

    • entity (str) – entityTypes to search for Accepted values: list, predicate, tag, article

    • params (dict) – A dict of web request url parameters ex. offset=0, limit=500

    • headers (dict) – Headers to include in the http request, if not provided a default header will be created with auth info

  • Returns

    dict of returned objects

notification_search(query: dict, entity: str, params: dict = None, headers: dict = None)

Performs a search query against the notification API

  • Parameters

    • query (dict) – A dict representing an Elasticsearch query, will be converted to json string

    • entity (str) – entityTypes to search for Accepted values: target-group, notification

    • params (dict) – A dict of web request url parameters ex. offset=0, limit=500

    • headers (dict) – Headers to include in the http request, if not provided a default header will be created with auth info

  • Returns

    dict of returned objects

registry_search(query: dict, entity: str, params: Optional[dict] = None, headers: Optional[dict] = None)

Performs a search query against the registry API

  • Parameters

    • query (dict) – A dict representing an Elasticsearch query, will be converted to json string

    • entity (str) – entityTypes to search for Accepted values: component, component-change, endpoint, endpoint-change, heartbeat

    • params (dict) – A dict of web request url parameters ex. offset=0, limit=500

    • headers (dict) – Headers to include in the http request, if not provided a default header will be created with auth info

  • Returns

    urllib.response object (dict)

ruler_search(query: str, entity: str, params: dict = None, headers: dict = None)

Performs a search query against the ruler API

  • Parameters

    • query (dict) – A dict representing an Elasticsearch query, will be converted to json string

    • entity (str) – entityTypes to search for Accepted values: artifact, rule, rulechain

    • params (dict) – A dict of web request url parameters ex. offset=0, limit=500

    • headers (dict) – Headers to include in the http request, if not provided a default header will be created with auth info

  • Returns

    dict of returned objects

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

proofpoint_itm-0.4.0.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

proofpoint_itm-0.4.0-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file proofpoint_itm-0.4.0.tar.gz.

File metadata

  • Download URL: proofpoint_itm-0.4.0.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.0

File hashes

Hashes for proofpoint_itm-0.4.0.tar.gz
Algorithm Hash digest
SHA256 4d260b6555082d054285fad87c9821d8899384582161cf04651d1b2be19d924f
MD5 5316148b9f4712f9e44d2a23e3943af9
BLAKE2b-256 2534f95b392c9d5abc08d175f2fc3bb44a28f8b0f7b71ff8cdd7dd85b2af99cc

See more details on using hashes here.

File details

Details for the file proofpoint_itm-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: proofpoint_itm-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.0

File hashes

Hashes for proofpoint_itm-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7e0f7fd9d4cdfcaf880ef628968a3446465cc541fc7d44c69d4828510ccd4616
MD5 20bd42fbf165c3ab18acff806b7c026c
BLAKE2b-256 cb67e0ddb6bc02ad634791c74f37c84e95fd1fe32a55d077a75d64ec8c96880e

See more details on using hashes here.

Supported by

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