Quick Scan - CrowdStrike/falconpy GitHub Wiki
This service collection has code examples posted to the repository.
Operation ID | Description | ||||
---|---|---|---|---|---|
|
Get scans aggregations as specified via json in request body. | ||||
|
Check the status of a volume scan. Time required for analysis increases with the number of samples in a volume but usually it should take less than 1 minute | ||||
|
Submit a volume of files for ml scanning. Time required for analysis increases with the number of samples in a volume but usually it should take less than 1 minute | ||||
|
Find IDs for submitted scans by providing a FQL filter and paging details. Returns a set of volume IDs that match your criteria. |
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.
Get scans aggregations as specified via json in request body.
get_scans_aggregates
Method | Route |
---|---|
/scanner/aggregates/scans/GET/v1 |
- Consumes: application/json
- Produces: application/json
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
body |
|
|
body | dictionary | 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" } ] |
field |
|
|
body | string | The field on which to compute the aggregation. |
filter |
|
|
body | string | FQL syntax formatted string to use to filter the results. |
interval |
|
|
body | string | Time interval for date histogram aggregations. Valid values include:
|
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:
|
from falconpy import QuickScan
# Do not hardcode API credentials!
falcon = QuickScan(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
date_ranges = [
{
"from": "2021-05-15T14:55:21.892315096Z",
"to": "2021-05-17T13:42:16.493180643Z"
}
]
ranges = [
{
"From": 1,
"To": 100
}
]
response = falcon.get_scans_aggregates(date_ranges=date_ranges,
field="string",
filter="string",
interval="string",
min_doc_count=integer,
missing="string",
name="string",
q="string",
ranges=ranges,
size=integer,
sort="string",
time_zone="string",
type="string"
)
print(response)
from falconpy import QuickScan
# Do not hardcode API credentials!
falcon = QuickScan(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
date_ranges = [
{
"from": "2021-05-15T14:55:21.892315096Z",
"to": "2021-05-17T13:42:16.493180643Z"
}
]
ranges = [
{
"From": 1,
"To": 100
}
]
response = falcon.GetScansAggregates(date_ranges=date_ranges,
field="string",
filter="string",
interval="string",
min_doc_count=integer,
missing="string",
name="string",
q="string",
ranges=ranges,
size=integer,
sort="string",
time_zone="string",
type="string"
)
print(response)
from falconpy import APIHarnessV2
# Do not hardcode API credentials!
falcon = APIHarnessV2(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
date_ranges = [
{
"from": "2021-05-15T14:55:21.892315096Z",
"to": "2021-05-17T13:42:16.493180643Z"
}
]
ranges = [
{
"From": 1,
"To": 100
}
]
BODY = {
"date_ranges": date_ranges,
"field": "string",
"filter": "string",
"interval": "string",
"min_doc_count": 0,
"missing": "string",
"name": "string",
"q": "string",
"ranges": ranges,
"size": 0,
"sort": "string",
"time_zone": "string",
"type": "string"
}
response = falcon.command("GetScansAggregates", body=BODY)
print(response)
Check the status of a volume scan. Time required for analysis increases with the number of samples in a volume but usually it should take less than 1 minute
get_scans
Method | Route |
---|---|
/scanner/entities/scans/v1 |
- Produces: application/json
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
ids |
|
|
query | string or list of strings | ID of a submitted scan to retrieve. |
parameters |
|
|
query | dictionary | Full query string parameters payload in JSON format. |
from falconpy import QuickScan
# Do not hardcode API credentials!
falcon = QuickScan(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_scans(ids=id_list)
print(response)
from falconpy import QuickScan
# Do not hardcode API credentials!
falcon = QuickScan(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
id_list = 'ID1,ID2,ID3' # Can also pass a list here: ['ID1', 'ID2', 'ID3']
response = falcon.GetScans(ids=id_list)
print(response)
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("GetScans", ids=id_list)
print(response)
Submit a volume of files for ml scanning. Time required for analysis increases with the number of samples in a volume but usually it should take less than 1 minute
scan_samples
Method | Route |
---|---|
/scanner/entities/scans/v1 |
- Produces: application/json
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
body |
|
|
body | dictionary | Full body payload in JSON format. |
samples |
|
|
body | string or list of strings | Submit a batch of SHA256s for ml scanning. The samples must have been previously uploaded through UploadSampleV3. |
from falconpy import QuickScan
# Do not hardcode API credentials!
falcon = QuickScan(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
sample_list = "SHA1,SHA2,SHA3" # Can also pass a list here: ['SHA1', 'SHA2', 'SHA3']
response = falcon.scan_samples(samples=sample_list)
print(response)
from falconpy import QuickScan
# Do not hardcode API credentials!
falcon = QuickScan(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
sample_list = "SHA1,SHA2,SHA3" # Can also pass a list here: ['SHA1', 'SHA2', 'SHA3']
response = falcon.ScanSamples(samples=sample_list)
print(response)
from falconpy import APIHarnessV2
# Do not hardcode API credentials!
falcon = APIHarnessV2(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
sample_list = ['SHA1', 'SHA2', 'SHA3']
BODY = {
"samples": sample_list
}
response = falcon.command("ScanSamples", body=BODY)
print(response)
Find IDs for submitted scans by providing a FQL filter and paging details. Returns a set of volume IDs that match your criteria.
query_submissions
Method | Route |
---|---|
/scanner/queries/scans/v1 |
- Produces: application/json
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
filter |
|
|
query | string | Optional filter and sort criteria in the form of an FQL query. Additional information about FQL queries can also be found in here (Customer login required). |
limit |
|
|
query | integer | Maximum number of volume IDs to return. Max: 5000. |
offset |
|
|
query | string | The offset to start retrieving submissions from. |
sort |
|
|
query | string | Sort order: asc or desc . |
parameters |
|
|
query | dictionary | Full query string parameters payload in JSON format. |
from falconpy import QuickScan
# Do not hardcode API credentials!
falcon = QuickScan(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
response = falcon.query_submissions(filter="string",
offset="string",
limit=integer,
sort="string"
)
print(response)
from falconpy import QuickScan
# Do not hardcode API credentials!
falcon = QuickScan(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
response = falcon.QuerySubmissionsMixin0(filter="string",
offset="string",
limit=integer,
sort="string"
)
print(response)
from falconpy import APIHarnessV2
# Do not hardcode API credentials!
falcon = APIHarnessV2(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
response = falcon.command("QuerySubmissionsMixin0",
filter="string",
offset="string",
limit=integer,
sort="string"
)
print(response)