Zero Trust Assessment - CrowdStrike/falconpy GitHub Wiki

CrowdStrike Falcon CrowdStrike Subreddit

Using the Zero Trust Assessment service collection

Uber class support Service class support Documentation Version Page Updated

Table of Contents

Operation ID Description
getAssessmentV1
PEP 8 get_assessment
Get Zero Trust Assessment data for one or more hosts by providing agent IDs (AID) and a customer ID (CID).
getAuditV1
PEP 8 get_audit
Get the Zero Trust Assessment audit report for one customer ID (CID).
getAssessmentsByScoreV1
PEP 8 get_assessments_by_score
Get Zero Trust Assessment data for one or more hosts by providing a customer ID (CID) and a range of scores.

Passing credentials

WARNING

client_id and client_secret are keyword arguments that contain your CrowdStrike API credentials. Please note that all examples below do not hard code these values. (These values are ingested as strings.)

CrowdStrike does not recommend hard coding API credentials or customer identifiers within source code.

getAssessmentV1

Get Zero Trust Assessment data for one or more hosts by providing agent IDs (AID) and a customer ID (CID).

PEP8 method name

get_assessment

Endpoint

Method Route
GET /zero-trust-assessment/entities/assessments/v1

Content-Type

  • Consumes: application/json
  • Produces: application/json

Keyword Arguments

Name Service Uber Type Data type Description
ids
Service Class Support

Uber Class Support
query string or list of strings One or more agent IDs, which you can find in the data.zta file, or the Falcon console.
parameters
Service Class Support

Uber Class Support
query dictionary Full query string parameters payload in JSON format.

Usage

Service class example (PEP8 syntax)
from falconpy import ZeroTrustAssessment

# Do not hardcode API credentials!
falcon = ZeroTrustAssessment(client_id=CLIENT_ID,
                             client_secret=CLIENT_SECRET
                             )

id_list = 'ID1,ID2,ID3'  # Can also pass a list here: ['ID1', 'ID2', 'ID3']

response = falcon.get_assessment(ids=id_list)
print(response)
Service class example (Operation ID syntax)
from falconpy import ZeroTrustAssessment

# Do not hardcode API credentials!
falcon = ZeroTrustAssessment(client_id=CLIENT_ID,
                             client_secret=CLIENT_SECRET
                             )

id_list = 'ID1,ID2,ID3'  # Can also pass a list here: ['ID1', 'ID2', 'ID3']

response = falcon.getAssessmentV1(ids=id_list)
print(response)
Uber class example
from falconpy import APIHarnessV2

# Do not hardcode API credentials!
falcon = APIHarnessV2(client_id=CLIENT_ID,
                      client_secret=CLIENT_SECRET
                      )

id_list = 'ID1,ID2,ID3'  # Can also pass a list here: ['ID1', 'ID2', 'ID3']

response = falcon.command("getAssessmentV1", ids=id_list)
print(response)

getAuditV1

Get the Zero Trust Assessment audit report for one customer ID (CID).

PEP8 method name

get_audit

Deprecated ID

This operation ID has recently been changed.

FalconPy supports deprecated IDs and method names via aliases. Developers should consider moving code to leverage the updated ID and method name for this operation whenever possible.

  • Legacy Operation ID: getComplianceV1
  • Legacy PEP8 method name: get_compliance

Endpoint

Method Route
GET /zero-trust-assessment/entities/audit/v1

Content-Type

  • Consumes: application/json
  • Produces: application/json

Keyword arguments

No keywords or arguments accepted.

Usage

Service class example (PEP8 syntax)
from falconpy import ZeroTrustAssessment

# Do not hardcode API credentials!
falcon = ZeroTrustAssessment(client_id=CLIENT_ID,
                             client_secret=CLIENT_SECRET
                             )

response = falcon.get_audit()
print(response)
Service class example (Operation ID syntax)
from falconpy import ZeroTrustAssessment

# Do not hardcode API credentials!
falcon = ZeroTrustAssessment(client_id=CLIENT_ID,
                             client_secret=CLIENT_SECRET
                             )

response = falcon.getAuditV1()
print(response)
Uber class example
from falconpy import APIHarnessV2

# Do not hardcode API credentials!
falcon = APIHarnessV2(client_id=CLIENT_ID,
                      client_secret=CLIENT_SECRET
                      )

response = falcon.command("getAuditV1")
print(response)

getAssessmentsByScoreV1

Get Zero Trust Assessment data for one or more hosts by providing a customer ID (CID) and a range of scores.

PEP8 method name

get_assessments_by_score

Endpoint

Method Route
GET /zero-trust-assessment/queries/assessments/v1

Content-Type

  • Consumes: application/json
  • Produces: application/json

Keyword Arguments

Name Service Uber Type Data type Description
filter
Service Class Support

Uber Class Support
query string FQL formatted string containing the filter to use to limit results.
limit
Service Class Support

Uber Class Support
query integer The number of scores to return in this response. (Min: 1, Max: 1,000, Default: 100). Use in conjuction with the after parameter to limit results.
after
Service Class Support

Uber Class Support
query string A pagination token used with the limit parameter to manage pagination of results. On your first request, do not provided an after token. On subsequent requests, provide the after token from the previous response to continue from that place in the results.
sort
Service Class Support

Uber Class Support
query string FQL formatted string containing the sort specification. A single sort field is allowed score, which can be sorted ascending or descending. (Defaults to desc, Example: score|asc or score|desc).
parameters
Service Class Support

Uber Class Support
query dictionary Full query string parameters payload in JSON format.

Usage

Service class example (PEP8 syntax)
from falconpy import ZeroTrustAssessment

# Do not hardcode API credentials!
falcon = ZeroTrustAssessment(client_id=CLIENT_ID,
                             client_secret=CLIENT_SECRET
                             )

response = falcon.get_assessments_by_score(filter="string",
                                           limit=integer,
                                           after="string",
                                           sort="string"
                                           )

print(response)
Service class example (Operation ID syntax)
from falconpy import ZeroTrustAssessment

# Do not hardcode API credentials!
falcon = ZeroTrustAssessment(client_id=CLIENT_ID,
                             client_secret=CLIENT_SECRET
                             )


response = falcon.getAssessmentsByScoreV1(filter="string",
                                          limit=integer,
                                          after="string",
                                          sort="string"
                                          )

print(response)
Uber class example
from falconpy import APIHarnessV2

# Do not hardcode API credentials!
falcon = APIHarnessV2(client_id=CLIENT_ID,
                      client_secret=CLIENT_SECRET
                      )

response = falcon.command("getAssessmentsByScoreV1",
                          filter="string",
                          limit=integer,
                          after="string",
                          sort="string"
                          )

print(response)
⚠️ **GitHub.com Fallback** ⚠️