ML Exclusions - CrowdStrike/falconpy GitHub Wiki

CrowdStrike Falcon CrowdStrike Subreddit

Using the ML Exclusions service collection

Uber class support Service class support Documentation Version Page Updated

Table of Contents

Operation ID Description
getMLExclusionsV1
PEP 8 get_exclusions
Get a set of ML Exclusions by specifying their IDs.
createMLExclusionsV1
PEP 8 create_exclusions
Create the ML exclusions.
deleteMLExclusionsV1
PEP 8 delete_exclusions
Delete the ML exclusions by ID.
updateMLExclusionsV1
PEP 8 update_exclusions
Update the ML exclusions.
queryMLExclusionsV1
PEP 8 query_exclusions
Search for ML exclusions.

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.

getMLExclusionsV1

Get a set of ML Exclusions by specifying their IDs

PEP8 method name

get_exclusions

Endpoint

Method Route
GET /policy/entities/ml-exclusions/v1

Content-Type

  • 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 The IDs of the exclusions to retrieve.
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 MLExclusions

# Do not hardcode API credentials!
falcon = MLExclusions(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_exclusions(ids=id_list)
print(response)
Service class example (Operation ID syntax)
from falconpy import MLExclusions

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

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

response = falcon.getMLExclusionsV1(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("getMLExclusionsV1", ids=id_list)
print(response)

createMLExclusionsV1

Create the ML exclusions

PEP8 method name

create_exclusions

Endpoint

Method Route
POST /policy/entities/ml-exclusions/v1

Content-Type

  • Produces: application/json

Keyword Arguments

Name Service Uber Type Data type Description
body
Service Class Support

Uber Class Support
body dictionary Full body payload in JSON format.
comment
Service Class Support

Uber Class Support
body string String comment describing why the exclusions was created.
excluded_from
Service Class Support

Uber Class Support
body list of strings Group ID(s) explicitly excluded from the exclusion.
groups
Service Class Support

Uber Class Support
body list of strings Group ID(s) impacted by the exclusion. Defaults to ["all"] when not specified while using a Service Class. This default must be provided by the developer when using the Uber Class.
value
Service Class Support

Uber Class Support
body string Value to match for the exclusion.

Usage

Service class example (PEP8 syntax)
from falconpy import MLExclusions

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

group_list = ['ID1', 'ID2', 'ID3']
exclude_list = ['EX1', 'EX2', 'EX3']

response = falcon.create_exclusions(comment="string",
                                    groups=group_list,
                                    excluded_from=exclude_list,
                                    value="string"
                                    )
print(response)
Service class example (Operation ID syntax)
from falconpy import MLExclusions

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

group_list = ['ID1', 'ID2', 'ID3']
exclude_list = ['EX1', 'EX2', 'EX3']

response = falcon.createMLExclusionsV1(comment="string",
                                       groups=group_list,
                                       excluded_from=exclude_list,
                                       value="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
                      )
group_list = ['ID1', 'ID2', 'ID3']  # If not specifying a group ID, you must submit ["all"].
exclude_list = ['EX1', 'EX2', 'EX3']

BODY = {
    "comment": "string",
    "excluded_from": exclude_list,
    "groups": group_list,
    "value": "string"
}

response = falcon.command("createMLExclusionsV1", body=BODY)
print(response)

deleteMLExclusionsV1

Delete the ML exclusions by id

PEP8 method name

delete_exclusions

Endpoint

Method Route
DELETE /policy/entities/ml-exclusions/v1

Content-Type

  • Produces: application/json

Keyword Arguments

Name Service Uber Type Data type Description
comment
Service Class Support

Uber Class Support
query string Explains why this exclusion was deleted.
ids
Service Class Support

Uber Class Support
query string or list of strings The IDs of the exclusions to retrieve.
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 MLExclusions

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

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

response = falcon.delete_exclusions(comment="string", ids=id_list)
print(response)
Service class example (Operation ID syntax)
from falconpy import MLExclusions

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

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

response = falcon.deleteMLExclusionsV1(comment="string", 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("deleteMLExclusionsV1", comment="string", ids=id_list)
print(response)

updateMLExclusionsV1

Update the ML exclusions

PEP8 method name

update_exclusions

Endpoint

Method Route
PATCH /policy/entities/ml-exclusions/v1

Content-Type

  • Produces: application/json

Keyword Arguments

Name Service Uber Type Data type Description
body
Service Class Support

Uber Class Support
body dictionary Full body payload in JSON format.
comment
Service Class Support

Uber Class Support
body string String comment describing why the exclusions was created.
groups
Service Class Support

Uber Class Support
body list of strings Group ID(s) impacted by the exclusion.
id
Service Class Support

Uber Class Support
body string The ID of the exclusion to update.
value
Service Class Support

Uber Class Support
body string Value to match for the exclusion.

Usage

Service class example (PEP8 syntax)
from falconpy import MLExclusions

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

group_list = ['ID1', 'ID2', 'ID3']

response = falcon.update_exclusions(comment="string",
                                    groups=group_list,
                                    value="string",
                                    id="string"
                                    )
print(response)
Service class example (Operation ID syntax)
from falconpy import MLExclusions

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

group_list = ['ID1', 'ID2', 'ID3']

response = falcon.updateMLExclusionsV1(comment="string",
                                       groups=group_list,
                                       value="string",
                                       id="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
                      )

group_list = ['ID1', 'ID2', 'ID3']

BODY = {
    "comment": "string",
    "groups": group_list,
    "id": "string",
    "value": "string"
}

response = falcon.command("updateMLExclusionsV1", body=BODY)
print(response)

queryMLExclusionsV1

Search for ML exclusions.

PEP8 method name

query_exclusions

Endpoint

Method Route
GET /policy/queries/ml-exclusions/v1

Content-Type

  • Produces: application/json

Keyword Arguments

Name Service Uber Type Data type Description
filter
Service Class Support

No Uber Class Support
query string The filter expression that should be used to limit the results. FQL syntax.

Available filters:
  • applied_globally
  • created_by
  • created_on
  • last_modified
  • modified_by
  • value
limit
Service Class Support

No Uber Class Support
query integer The maximum number of records to return. [1-500]
offset
Service Class Support

No Uber Class Support
query integer The offset to start retrieving records from.
parameters
Service Class Support

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

No Uber Class Support
query string The property to sort by.
FQL syntax. (e.g. last_behavior|asc)

Available sort fields:
  • applied_globally
  • created_by
  • created_on
  • last_modified
  • modified_by
  • value

Usage

Service class example (PEP8 syntax)
from falconpy import MLExclusions

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

response = falcon.query_exclusions(filter="string",
                                   offset=integer,
                                   limit=integer,
                                   sort="string"
                                   )
print(response)
Service class example (Operation ID syntax)
from falconpy import MLExclusions

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

response = falcon.queryMLExclusionsV1(filter="string",
                                      offset=integer,
                                      limit=integer,
                                      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("queryMLExclusionsV1",
                          filter="string",
                          offset=integer,
                          limit=integer,
                          sort="string"
                          )
print(response)
⚠️ **GitHub.com Fallback** ⚠️