-
Notifications
You must be signed in to change notification settings - Fork 118
MalQuery
This service collection has code examples posted to the repository.
Operation ID | Description | ||||
---|---|---|---|---|---|
|
Get information about search and download quotas in your environment | ||||
|
Search Falcon MalQuery quickly, but with more potential for false positives. Search for a combination of hex patterns and strings in order to identify samples based upon file content at byte level granularity. | ||||
|
Download a file indexed by MalQuery. Specify the file using its SHA256. Only one file is supported at this time | ||||
|
Retrieve indexed files metadata by their hash | ||||
|
Check the status and results of an asynchronous request, such as hunt or exact-search. Supports a single request id at this time. | ||||
|
Fetch a zip archive with password 'infected' containing the samples. Call this once the /entities/samples-multidownload request has finished processing | ||||
|
Schedule samples for download. Use the result id with the /request endpoint to check if the download is ready after which you can call the /entities/samples-fetch to get the zip | ||||
|
Search Falcon MalQuery for a combination of hex patterns and strings in order to identify samples based upon file content at byte level granularity. You can filter results on criteria such as file type, file size and first seen date. Returns a request id which can be used with the /request endpoint | ||||
|
Schedule a YARA-based search for execution. Returns a request id which can be used with the /request endpoint |
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 information about search and download quotas in your environment
get_quotas
Method | Route |
---|---|
/malquery/aggregates/quotas/v1 |
- Produces: application/json
No keywords are arguments are accepted.
from falconpy import MalQuery
# Do not hardcode API credentials!
falcon = MalQuery(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
response = falcon.get_quotas()
print(response)
from falconpy import MalQuery
# Do not hardcode API credentials!
falcon = MalQuery(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
response = falcon.GetMalQueryQuotasV1()
print(response)
from falconpy import APIHarnessV2
# Do not hardcode API credentials!
falcon = APIHarnessV2(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
response = falcon.command("GetMalQueryQuotasV1")
print(response)
Search Falcon MalQuery quickly, but with more potential for false positives. Search for a combination of hex patterns and strings in order to identify samples based upon file content at byte level granularity.
fuzzy_search
Method | Route |
---|---|
/malquery/combined/fuzzy-search/v1 |
- Consumes: application/json
- Produces: application/json
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
body |
|
|
body | dictionary | Full body payload in JSON format. |
filter_meta |
|
|
body | list of strings | FQL Syntax. |
limit |
|
|
body | integer | Maximum number of matches to return. |
patterns |
|
|
body | list of dictionaries | List of patterns to match in JSON format. Example: { "type": "string", "value": "string" } |
from falconpy import MalQuery
# Do not hardcode API credentials!
falcon = MalQuery(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
pattern = [{
"type": "string",
"value": "string"
}]
filter_m = ["string", "string"]
response = falcon.fuzzy_search(filter_meta=filter_m,
limit=integer,
patterns=pattern
)
print(response)
from falconpy import MalQuery
# Do not hardcode API credentials!
falcon = MalQuery(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
pattern = [{
"type": "string",
"value": "string"
}]
filter_m = ["string", "string"]
response = falcon.PostMalQueryFuzzySearchV1(filter_meta=filter_m,
limit=integer,
patterns=pattern
)
print(response)
from falconpy import APIHarnessV2
# Do not hardcode API credentials!
falcon = APIHarnessV2(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
pattern = [{
"type": "string",
"value": "string"
}]
filter_m = ["string", "string"]
BODY = {
"options": {
"filter_meta": filter_m,
"limit": 0
},
"patterns": pattern
}
response = falcon.command("PostMalQueryFuzzySearchV1", body=BODY)
print(response)
Download a file indexed by MalQuery. Specify the file using its SHA256. Only one file is supported at this time
get_download
Method | Route |
---|---|
/malquery/entities/download-files/v1 |
- Produces: application/octet-stream
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
ids |
|
|
query | string or list of strings | File(s) SHA256 ID. |
parameters |
|
|
query | dictionary | Full query string parameters payload in JSON format. |
from falconpy import MalQuery
# Do not hardcode API credentials!
falcon = MalQuery(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
id_list = 'ID1,ID2,ID3' # Can also pass a list here: ['ID1', 'ID2', 'ID3']
save_file = "some_file.ext"
response = falcon.get_download(ids=id_list)
open(save_file, 'wb').write(response)
from falconpy import MalQuery
# Do not hardcode API credentials!
falcon = MalQuery(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
id_list = 'ID1,ID2,ID3' # Can also pass a list here: ['ID1', 'ID2', 'ID3']
save_file = "some_file.ext"
response = falcon.GetMalQueryDownloadV1(ids=id_list)
open(save_file, 'wb').write(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']
save_file = "some_file.ext"
response = falcon.command("GetMalQueryDownloadV1", ids=id_list)
open(save_file, 'wb').write(response)
Retrieve indexed files metadata by their hash
get_metadata
Method | Route |
---|---|
/malquery/entities/metadata/v1 |
- Produces: application/json
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
ids |
|
|
query | string or list of strings | File(s) SHA256 ID. |
parameters |
|
|
query | dictionary | Full query string parameters payload in JSON format. |
from falconpy import MalQuery
# Do not hardcode API credentials!
falcon = MalQuery(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_metadata(ids=id_list)
print(response)
from falconpy import MalQuery
# Do not hardcode API credentials!
falcon = MalQuery(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
id_list = 'ID1,ID2,ID3' # Can also pass a list here: ['ID1', 'ID2', 'ID3']
response = falcon.GetMalQueryMetadataV1(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("GetMalQueryMetadataV1", ids=id_list)
print(response)
Check the status and results of an asynchronous request, such as hunt or exact-search. Supports a single request id at this time.
get_request
Method | Route |
---|---|
/malquery/entities/requests/v1 |
- Produces: application/json
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
ids |
|
|
query | string | Identifier of the MalQuery request. |
parameters |
|
|
query | dictionary | Full query string parameters payload in JSON format. |
from falconpy import MalQuery
# Do not hardcode API credentials!
falcon = MalQuery(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
response = falcon.get_request(ids="string")
print(response)
from falconpy import MalQuery
# Do not hardcode API credentials!
falcon = MalQuery(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
response = falcon.GetMalQueryRequestV1(ids="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("GetMalQueryRequestV1", ids="string")
print(response)
Fetch a zip archive with password 'infected' containing the samples. Call this once the /entities/samples-multidownload request has finished processing
get_samples
Method | Route |
---|---|
/malquery/entities/samples-fetch/v1 |
- Produces: application/zip
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
ids |
|
|
query | string or list of strings | Multi-download job ID(s). |
parameters |
|
|
query | dictionary | Full query string parameters payload in JSON format. |
from falconpy import MalQuery
# Do not hardcode API credentials!
falcon = MalQuery(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
id_list = 'ID1,ID2,ID3' # Can also pass a list here: ['ID1', 'ID2', 'ID3']
save_file = "some_file.zip"
response = falcon.get_samples(ids=id_list)
open(save_file, 'wb').write(response)
from falconpy import MalQuery
# Do not hardcode API credentials!
falcon = MalQuery(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
id_list = 'ID1,ID2,ID3' # Can also pass a list here: ['ID1', 'ID2', 'ID3']
save_file = "some_file.zip"
response = falcon.GetMalQueryEntitiesSamplesFetchV1(ids=id_list)
open(save_file, 'wb').write(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']
save_file = "some_file.zip"
response = falcon.command("GetMalQueryEntitiesSamplesFetchV1", ids=id_list)
open(save_file, 'wb').write(response)
Schedule samples for download. Use the result id with the /request endpoint to check if the download is ready after which you can call the /entities/samples-fetch to get the zip
samples_multidownload
Method | Route |
---|---|
/malquery/entities/samples-multidownload/v1 |
- Consumes: application/json
- Produces: application/json
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
body |
|
|
body | dictionary | Full body payload in JSON format. |
samples |
|
|
body | list of strings | List of MalQuery sample ID(s) to be downloaded. |
from falconpy import MalQuery
# Do not hardcode API credentials!
falcon = MalQuery(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
id_list = 'ID1,ID2,ID3' # Can also pass a list here: ['ID1', 'ID2', 'ID3']
response = falcon.samples_multidownload(samples=id_list)
print(response)
from falconpy import MalQuery
# Do not hardcode API credentials!
falcon = MalQuery(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
id_list = 'ID1,ID2,ID3' # Can also pass a list here: ['ID1', 'ID2', 'ID3']
response = falcon.PostMalQueryEntitiesSamplesMultidownloadV1(samples=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']
BODY = {
"samples": id_list
}
response = falcon.command("PostMalQueryEntitiesSamplesMultidownloadV1", body=BODY)
print(response)
Search Falcon MalQuery for a combination of hex patterns and strings in order to identify samples based upon file content at byte level granularity. You can filter results on criteria such as file type, file size and first seen date. Returns a request id which can be used with the /request endpoint
exact_search
Method | Route |
---|---|
/malquery/queries/exact-search/v1 |
- Consumes: application/json
- Produces: application/json
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
body |
|
|
body | dictionary | Full body payload in JSON format. |
filter_filetypes |
|
|
body | list of strings | File types to filter on. |
filter_meta |
|
|
body | list of strings | File metadata to filter on. |
limit |
|
|
body | integer | Maximum number of matches to return. |
min_date |
|
|
body | string | UTC formatted date string representing the earliest date from which to return results. |
max_date |
|
|
body | string | UTC formatted date string representing the latest date from which to return results. |
min_size |
|
|
body | string | Minimum file size for returned results. |
max_size |
|
|
body | string | Maximum file size for returned results. |
patterns |
|
|
body | list of dictionaries | List of patterns to match in JSON format. Example: { "type": "string", "value": "string" } |
from falconpy import MalQuery
# Do not hardcode API credentials!
falcon = MalQuery(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
filter_types = ["string", "string"]
filter_metas = ["string", "string"]
pattern = [{
"type": "string",
"value": "string"
}]
response = falcon.exact_search(filter_filetypes=filter_types,
filter_meta=filter_metas,
limit=integer,
min_date="string",
max_date="string",
min_size="string",
max_size="string",
patterns=pattern
)
print(response)
from falconpy import MalQuery
# Do not hardcode API credentials!
falcon = MalQuery(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
filter_types = ["string", "string"]
filter_metas = ["string", "string"]
pattern = [{
"type": "string",
"value": "string"
}]
response = falcon.PostMalQueryExactSearchV1(filter_filetypes=filter_types,
filter_meta=filter_metas,
limit=integer,
min_date="string",
max_date="string",
min_size="string",
max_size="string",
patterns=pattern
)
print(response)
from falconpy import APIHarnessV2
# Do not hardcode API credentials!
falcon = APIHarnessV2(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
filter_types = ["string", "string"]
filter_metas = ["string", "string"]
pattern = [{
"type": "string",
"value": "string"
}]
BODY = {
"options": {
"filter_filetypes": filter_types,
"filter_meta": filter_metas,
"limit": 0,
"max_date": "string",
"max_size": "string",
"min_date": "string",
"min_size": "string"
},
"patterns": pattern
}
response = falcon.command("PostMalQueryExactSearchV1", body=BODY)
print(response)
Schedule a YARA-based search for execution. Returns a request id which can be used with the /request endpoint
hunt
Method | Route |
---|---|
/malquery/queries/hunt/v1 |
- Consumes: application/json
- Produces: application/json
Name | Service | Uber | Type | Data type | Description |
---|---|---|---|---|---|
body |
|
|
body | dictionary | Full body payload in JSON format. |
filter_filetypes |
|
|
body | list of strings | File types to filter on. |
filter_meta |
|
|
body | list of strings | File metadata to filter on. |
limit |
|
|
body | integer | Maximum number of matches to return. |
min_date |
|
|
body | string | UTC formatted date string representing the earliest date from which to return results. |
max_date |
|
|
body | string | UTC formatted date string representing the latest date from which to return results. |
min_size |
|
|
body | string | Minimum file size for returned results. |
max_size |
|
|
body | string | Maximum file size for returned results. |
yara_rule |
|
|
body | string | Yara rule to use for matching. |
from falconpy import MalQuery
# Do not hardcode API credentials!
falcon = MalQuery(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
filter_types = ["string", "string"]
filter_metas = ["string", "string"]
response = falcon.hunt(filter_filetypes=filter_types,
filter_meta=filter_metas,
limit=integer,
min_date="string",
max_date="string",
min_size="string",
max_size="string",
yara_rule="string"
)
print(response)
from falconpy import MalQuery
# Do not hardcode API credentials!
falcon = MalQuery(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
filter_types = ["string", "string"]
filter_metas = ["string", "string"]
response = falcon.PostMalQueryHuntV1(filter_filetypes=filter_types,
filter_meta=filter_metas,
limit=integer,
min_date="string",
max_date="string",
min_size="string",
max_size="string",
yara_rule="string"
)
print(response)
from falconpy import APIHarnessV2
# Do not hardcode API credentials!
falcon = APIHarnessV2(client_id=CLIENT_ID,
client_secret=CLIENT_SECRET
)
filter_types = ["string", "string"]
filter_metas = ["string", "string"]
BODY = {
"options": {
"filter_filetypes": filter_types,
"filter_meta": filter_metas,
"limit": 0,
"max_date": "string",
"max_size": "string",
"min_date": "string",
"min_size": "string"
},
"yara_rule": "string"
}
response = falcon.command("PostMalQueryHuntV1", body=BODY)
print(response)
- Home
- Discussions Board
- Glossary of Terms
- Installation, Upgrades and Removal
- Samples Collection
- Using FalconPy
- API Operations
-
Service Collections
- Alerts
- API Integrations
- Cloud Connect AWS (deprecated)
- Cloud Snapshots
- Configuration Assessment
- Configuration Assessment Evaluation Logic
- Container Alerts
- Container Detections
- Container Images
- Container Packages
- Container Vulnerabilities
- CSPM Registration
- Custom IOAs
- Custom Storage
- D4C Registration (deprecated)
- Detects
- Device Control Policies
- Discover
- Drift Indicators
- Event Streams
- Exposure Management
- Falcon Complete Dashboard
- Falcon Container
- Falcon Intelligence Sandbox
- FDR
- FileVantage
- Firewall Management
- Firewall Policies
- Foundry LogScale
- Host Group
- Hosts
- Identity Protection
- Image Assessment Policies
- Incidents
- Installation Tokens
- Intel
- IOA Exclusions
- IOC
- IOCs (deprecated)
- Kubernetes Protection
- MalQuery
- Message Center
- ML Exclusions
- Mobile Enrollment
- MSSP (Flight Control)
- OAuth2
- ODS (On Demand Scan)
- Overwatch Dashboard
- Prevention Policy
- Quarantine
- Quick Scan
- Real Time Response
- Real Time Response Admin
- Real Time Response Audit
- Recon
- Report Executions
- Response Policies
- Sample Uploads
- Scheduled Reports
- Sensor Download
- Sensor Update Policy
- Sensor Visibility Exclusions
- Spotlight Evaluation Logic
- Spotlight Vulnerabilities
- Tailored Intelligence
- ThreatGraph
- Unidentified Containers
- User Management
- Workflows
- Zero Trust Assessment
- Documentation Support
-
CrowdStrike SDKs
- Crimson Falcon - Ruby
- FalconPy - Python 3
- FalconJS - Javascript
- goFalcon - Go
- PSFalcon - Powershell
- Rusty Falcon - Rust