Using the Identity Protection service collection
Table of Contents
Operation ID | Description | ||||
---|---|---|---|---|---|
| Get sensor aggregates as specified via json in request body. | ||||
| Get details on one or more sensors by providing device IDs in a POST body. Supports up to a maximum of 5000 IDs. | ||||
| Search for sensors in your environment by hostname, IP, and other criteria. | ||||
| Identity Protection GraphQL API. Allows to retrieve entities, timeline activities, identity-based incidents and security assessment. Allows to perform actions on entities and identity-based incidents. | ||||
| Get policy rules. | ||||
| Create policy rules. | ||||
| Delete policy rules. | ||||
| Query policy rule IDs. |
Passing credentials
WARNING
client_id
andclient_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.
GetSensorAggregates
Get sensor aggregates as specified via json in request body.
PEP8 method name
get_sensor_aggregates
Endpoint
Method | Route |
---|---|
/identity-protection/aggregates/devices/GET/v1 |
Required Scope
Content-Type
- Consumes: application/json
- Produces: application/json
Keyword Arguments
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
body | body | list of dictionaries | Full body payload in JSON format. | ||
date_ranges | body | list of dictionaries | Applies to date_range aggregations. Example: [ { "from": "2016-05-28T09:00:31Z", "to": "2016-05-30T09:00:31Z" }, { "from": "2016-06-01T09:00:31Z", "to": "2016-06-10T09:00:31Z" } ] | ||
exclude | body | string | Elements to exclude. | ||
field | body | string | The field on which to compute the aggregation. | ||
filter | body | string | FQL syntax formatted string to use to filter the results. | ||
from | body | integer | Starting position. | ||
include | body | string | Elements to include. | ||
interval | body | string | Time interval for date histogram aggregations. Valid values include:
| ||
max_doc_count | body | integer | Only return buckets if values are less than or equal to the value here. | ||
min_doc_count | body | integer | Only return buckets if values are greater than or equal to the value here. | ||
missing | body | string | Missing is the value to be used when the aggregation field is missing from the object. In other words, the missing parameter defines how documents that are missing a value should be treated. By default they will be ignored, but it is also possible to treat them as if they had a value. | ||
name | body | string | Name of the aggregate query, as chosen by the user. Used to identify the results returned to you. | ||
q | body | string | Full text search across all metadata fields. | ||
ranges | body | list of dictionaries | Applies to range aggregations. Ranges values will depend on field. For example, if max_severity is used, ranges might look like: [ { "From": 0, "To": 70 }, { "From": 70, "To": 100 } ] | ||
size | body | integer | The max number of term buckets to be returned. | ||
sub_aggregates | body | list of dictionaries | A nested aggregation, such as: [ { "name": "max_first_behavior", "type": "max", "field": "first_behavior" } ] There is a maximum of 3 nested aggregations per request. | ||
sort | body | string | FQL syntax string to sort bucket results.
asc and desc using | format. Example: _count|desc | ||
time_zone | body | string | Time zone for bucket results. | ||
type | body | string | Type of aggregation. Valid values include:
|
Usage
Service class example (PEP8 syntax)
from falconpy import IdentityProtection
# Do not hardcode API credentials!
falcon = IdentityProtection(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
date_range = {
"from": "string",
"to": "string"
}
search_range = {
"From": integer,
"To": integer
}
response = falcon.get_sensor_aggregates(date_ranges=[date_range],
exclude="string",
field="string",
filter="string",
from=integer,
include="string",
interval="string",
max_doc_count=integer,
min_doc_count=integer,
missing="string",
name="string",
q="string",
ranges=[search_range],
size=integer,
sort="string",
time_zone="string",
type="string"
)
print(response)
Service class example (Operation ID syntax)
from falconpy import IdentityProtection
# Do not hardcode API credentials!
falcon = IdentityProtection(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
date_range = {
"from": "string",
"to": "string"
}
search_range = {
"From": integer,
"To": integer
}
response = falcon.GetSensorAggregates(date_ranges=[date_range],
exclude="string",
field="string",
filter="string",
from=integer,
include="string",
interval="string",
max_doc_count=integer,
min_doc_count=integer,
missing="string",
name="string",
q="string",
ranges=[search_range],
size=integer,
sort="string",
time_zone="string",
type="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
)
BODY = [{
"date_ranges": [
{
"from": "string",
"to": "string"
}
],
"exclude": "string",
"field": "string",
"filter": "string",
"from": integer,
"include": "string",
"interval": "string",
"max_doc_count": integer,
"min_doc_count": integer,
"missing": "string",
"name": "string",
"q": "string",
"ranges": [
{
"From": integer,
"To": integer
}
],
"size": integer,
"sort": "string",
"sub_aggregates": [
null
]
"time_zone": "string",
"type": "string"
}]
response = falcon.command("GetSensorAggregates", body=BODY)
print(response)
GetSensorDetails
Get details on one or more sensors by providing device IDs in a POST body. Supports up to a maximum of 5000 IDs.
PEP8 method name
get_sensor_details
Endpoint
Method | Route |
---|---|
/identity-protection/entities/devices/GET/v1 |
Required Scope
Content-Type
- Produces: application/json
Keyword Arguments
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
body | body | dictionary | Full body payload in JSON format. | ||
ids | body | string or list of strings | The host agent IDs used to get details on. Maximum: 5000 |
Usage
Service class example (PEP8 syntax)
from falconpy import IdentityProtection
# Do not hardcode API credentials!
falcon = IdentityProtection(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_sensor_details(ids=id_list)
print(response)
Service class example (Operation ID syntax)
from falconpy import IdentityProtection
# Do not hardcode API credentials!
falcon = IdentityProtection(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
id_list = 'ID1,ID2,ID3' # Can also pass a list here: ['ID1', 'ID2', 'ID3']
response = falcon.GetSensorDetails(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("GetSensorDetails", ids=id_list)
print(response)
QuerySensorsByFilter
Search for sensors in your environment by hostname, IP, and other criteria.
PEP8 method name
query_sensors
Endpoint
Method | Route |
---|---|
/identity-protection/queries/devices/v1 |
Required Scope
Content-Type
- Produces: application/json
Keyword Arguments
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
offset | query | integer | The offset to start retrieving records from | ||
parameters | query | dictionary | Full query string parameters payload in JSON format. | ||
limit | query | integer | The maximum records to return. [1-200] | ||
sort | query | string | The property to sort by (e.g. status.desc or hostname.asc) | ||
filter | query | string | The filter expression that should be used to limit the results. |
Usage
Service class example (PEP8 syntax)
from falconpy import IdentityProtection
# Do not hardcode API credentials!
falcon = IdentityProtection(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
response = falcon.query_sensors(offset=integer,
limit=integer,
sort="string",
filter="string"
)
print(response)
Service class example (Operation ID syntax)
from falconpy import IdentityProtection
# Do not hardcode API credentials!
falcon = IdentityProtection(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
response = falcon.QuerySensorsByFilter(offset=integer,
limit=integer,
sort="string",
filter="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("QuerySensorsByFilter",
offset=integer,
limit=integer,
sort="string",
filter="string"
)
print(response)
api_preempt_proxy_post_graphql
Identity Protection GraphQL API. Allows to retrieve entities, timeline activities, identity-based incidents and security assessment. Allows to perform actions on entities and identity-based incidents.
PEP8 method name
graphql
Endpoint
Method | Route |
---|---|
/identity-protection/combined/graphql/v1 |
Required Scope
Content-Type
- Consumes: application/json
- Produces: application/json
Keyword Arguments
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
body | body | dictionary | Full body payload in JSON format. | ||
query | body | string | JSON-similar formatted query to perform. | ||
variables | body | dictionary | Dictionary of variables to provide to the query. |
Usage
Service class example (PEP8 syntax)
from falconpy import IdentityProtection
# Do not hardcode API credentials!
falcon = IdentityProtection(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
idp_query = """
query ($after: Cursor) {
entities(types: [USER], archived: false, learned: false, first: 5, after: $after) {
nodes {
primaryDisplayName
secondaryDisplayName
accounts {
... on ActiveDirectoryAccountDescriptor {
domain
}
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
"""
variables = {
"string": "string, int, float"
}
response = falcon.graphql(query=idp_query, variables=variables)
print(response)
Service class example (Operation ID syntax)
from falconpy import IdentityProtection
# Do not hardcode API credentials!
falcon = IdentityProtection(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
idp_query = """
query ($after: Cursor) {
entities(types: [USER], archived: false, learned: false, first: 5, after: $after) {
nodes {
primaryDisplayName
secondaryDisplayName
accounts {
... on ActiveDirectoryAccountDescriptor {
domain
}
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
"""
variables = {
"string": "string, int, float"
}
response = falcon.api_preempt_proxy_post_graphql(query=idp_query, variables=variables)
print(response)
Uber class example
from falconpy import APIHarnessV2
# Do not hardcode API credentials!
falcon = APIHarnessV2(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
idp_query = """
query ($after: Cursor) {
entities(types: [USER], archived: false, learned: false, first: 5, after: $after) {
nodes {
primaryDisplayName
secondaryDisplayName
accounts {
... on ActiveDirectoryAccountDescriptor {
domain
}
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
"""
variables = {
"string": "string, int, float"
}
BODY = {
"query": idp_query,
"variables" variables
}
response = falcon.command("api_preempt_proxy_post_graphql", body=BODY)
print(response)
get_policy_rules
Get policy rules.
PEP8 method name
get_policy_rules
Endpoint
Method | Route |
---|---|
/identity-protection/entities/policy-rules/v1 |
Required Scope
Content-Type
- Produces: application/json
Keyword Arguments
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
parameters | query | dictionary | Full query string payload in JSON format. | ||
ids | query | string or list of strings | The policy rule IDs used to get details on. |
Usage
Service class example (PEP8 / Operation ID syntax)
from falconpy import IdentityProtection
# Do not hardcode API credentials!
falcon = IdentityProtection(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_policy_rules(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("get_policy_rules", ids=id_list)
print(response)
post_policy_rules
Create policy rules.
PEP8 method name
create_policy_rules
Endpoint
Method | Route |
---|---|
/identity-protection/entities/policy-rules/v1 |
Required Scope
Content-Type
- Produces: application/json
Keyword Arguments
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
body | body | dictionary | Full body payload in JSON format. | ||
destination | query | dictionary | Activity destination. | ||
enabled | query | boolean | Flag indicating if the policy rule is enabled. | ||
name | query | string | Name of the policy rule. | ||
simulation_mode | query | boolean | Simulate the policy action instead of actually taking action. | ||
source_endpoint | query | dictionary | Source endpoint details. | ||
source_user | query | dictionary | Source user details. | ||
trigger | query | string | Policy rule trigger. |
Usage
Service class example (PEP8 syntax)
from falconpy import IdentityProtection
# Do not hardcode API credentials!
falcon = IdentityProtection(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
dest_dictionary = {
"entityId": {
"exclude": [
"string"
],
"include": [
"string"
]
},
"groupMembership": {
"exclude": [
"string"
],
"include": [
"string"
]
}
}
endpoint_dictionary = {
"entityId": {
"exclude": [
"string"
],
"include": [
"string"
]
},
"groupMembership": {
"exclude": [
"string"
],
"include": [
"string"
]
}
}
user_dictionary = {
"entityId": {
"exclude": [
"string"
],
"include": [
"string"
]
},
"groupMembership": {
"exclude": [
"string"
],
"include": [
"string"
]
}
}
response = falcon.create_policy_rules(destination=dest_dictionary,
enabled=boolean,
name="string",
simulation_mode=boolean,
source_endpoint=endpoint_dictionary,
source_user=user_dictionary,
trigger="string"
)
print(response)
Service class example (PEP8 / Operation ID syntax)
from falconpy import IdentityProtection
# Do not hardcode API credentials!
falcon = IdentityProtection(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
dest_dictionary = {
"entityId": {
"exclude": [
"string"
],
"include": [
"string"
]
},
"groupMembership": {
"exclude": [
"string"
],
"include": [
"string"
]
}
}
endpoint_dictionary = {
"entityId": {
"exclude": [
"string"
],
"include": [
"string"
]
},
"groupMembership": {
"exclude": [
"string"
],
"include": [
"string"
]
}
}
user_dictionary = {
"entityId": {
"exclude": [
"string"
],
"include": [
"string"
]
},
"groupMembership": {
"exclude": [
"string"
],
"include": [
"string"
]
}
}
response = falcon.post_policy_rules(destination=dest_dictionary,
enabled=boolean,
name="string",
simulation_mode=boolean,
source_endpoint=endpoint_dictionary,
source_user=user_dictionary,
trigger="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
)
body_payload = {
"action": "string",
"activity": {
"accessType": {
"exclude": [
"string"
],
"include": [
"string"
]
},
"accessTypeCustom": {
"exclude": [
"string"
],
"include": [
"string"
]
}
},
"destination": {
"entityId": {
"exclude": [
"string"
],
"include": [
"string"
]
},
"groupMembership": {
"exclude": [
"string"
],
"include": [
"string"
]
}
},
"enabled": boolean,
"name": "string",
"simulationMode": boolean,
"sourceEndpoint": {
"entityId": {
"exclude": [
"string"
],
"include": [
"string"
]
},
"groupMembership": {
"exclude": [
"string"
],
"include": [
"string"
]
}
},
"sourceUser": {
"entityId": {
"exclude": [
"string"
],
"include": [
"string"
]
},
"groupMembership": {
"exclude": [
"string"
],
"include": [
"string"
]
}
},
"trigger": "string"
}
response = falcon.command("post_policy_rules", body=body_payload)
print(response)
delete_policy_rules
Delete policy rules.
PEP8 method name
delete_policy_rules
Endpoint
Method | Route |
---|---|
/identity-protection/entities/policy-rules/v1 |
Required Scope
Content-Type
- Produces: application/json
Keyword Arguments
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
parameters | query | dictionary | Full query string payload in JSON format. | ||
ids | query | string or list of strings | The policy rule IDs to delete. |
Usage
Service class example (PEP8 / Operation ID syntax)
from falconpy import IdentityProtection
# Do not hardcode API credentials!
falcon = IdentityProtection(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_policy_rules(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("delete_policy_rules", ids=id_list)
print(response)
get_policy_rules_query
Query policy rule IDs.
PEP8 method name
query_policy_rules
Endpoint
Method | Route |
---|---|
/identity-protection/entities/policy-rules/v1 |
Required Scope
Content-Type
- Produces: application/json
Keyword Arguments
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
enabled | query | boolean | Flag indicating if the rule is enabled. | ||
parameters | query | dictionary | Full query string parameters payload in JSON format. | ||
simulation_mode | query | boolean | Flag indicating if the rule is in simulation mode. | ||
name | query | string | Rule name |
Usage
Service class example (PEP8 syntax)
from falconpy import IdentityProtection
# Do not hardcode API credentials!
falcon = IdentityProtection(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
response = falcon.query_policy_rules(enabled=boolean,
simulation_mode=boolean,
name="string"
)
print(response)
Service class example (Operation ID syntax)
from falconpy import IdentityProtection
# Do not hardcode API credentials!
falcon = IdentityProtection(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
response = falcon.get_policy_rules_query(enabled=boolean,
simulation_mode=boolean,
name="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("QuerySensorsByFilter",
enabled=boolean,
simulation_mode=boolean,
name="string"
)
print(response)