-
Notifications
You must be signed in to change notification settings - Fork 162
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_idandclient_secretare 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)Back to Table of Contents
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": integer
},
"patterns": pattern
}
response = falcon.command("PostMalQueryFuzzySearchV1", body=BODY)
print(response)Back to Table of Contents
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. |
| stream |
|
|
query | boolean | Enable streaming download of the returned file. |
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, stream=boolean)
with open(save_file, 'wb') as saved:
saved.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, stream=boolean)
with open(save_file, 'wb') as saved:
saved.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, stream=boolean)
with open(save_file, 'wb') as saved:
saved.write(response)Back to Table of Contents
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)Back to Table of Contents
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)Back to Table of Contents
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. |
| stream |
|
|
query | boolean | Enable streaming download of the returned file. |
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, stream=boolean)
with open(save_file, 'wb') as saved:
saved.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, stream=boolean)
with open(save_file, 'wb') as saved:
saved.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, stream=boolean)
with open(save_file, 'wb') as saved:
saved.write(response)Back to Table of Contents
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)Back to Table of Contents
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": integer,
"max_date": "string",
"max_size": "string",
"min_date": "string",
"min_size": "string"
},
"patterns": pattern
}
response = falcon.command("PostMalQueryExactSearchV1", body=BODY)
print(response)Back to Table of Contents
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": integer,
"max_date": "string",
"max_size": "string",
"min_date": "string",
"min_size": "string"
},
"yara_rule": "string"
}
response = falcon.command("PostMalQueryHuntV1", body=BODY)
print(response)Back to Table of Contents

- Home
- Discussions Board
- Glossary of Terms
- Installation, Upgrades and Removal
- Samples Collection
- Using FalconPy
- API Operations
-
Service Collections
- Admission Control Policies
- Alerts
- API Integrations
- ASPM
- CAO Hunting
- Case Management
- Certificate Based Exclusions
- Cloud AWS Registration
- Cloud Azure Registration
- Cloud GCP Registration
- Cloud OCI Registration
- Cloud Policies
- Cloud Connect AWS (deprecated)
- Cloud Security Assets
- Cloud Security
- Cloud Security Compliance
- Cloud Security Detections
- Cloud Snapshots
- Configuration Assessment
- Configuration Assessment Evaluation Logic
- Container Alerts
- Container Detections
- Container Image Compliance
- Container Images
- Container Packages
- Container Vulnerabilities
- Content Update Policies
- Correlation Rules
- Correlation Rules Admin
- CSPM Registration
- Custom IOAs
- Custom Storage
- D4C Registration (deprecated)
- Data Protection Configuration
- DataScanner (deprecated)
- Delivery Settings
- Deployments
- Detects (deprecated)
- Device Content
- Device Control Policies
- Discover
- Downloads
- Drift Indicators
- Event Streams
- Exposure Management
- FaaS Execution
- Falcon Complete Dashboard
- Falcon Container
- Falcon Intelligence Sandbox
- FDR
- FileVantage
- Firewall Management
- Firewall Policies
- Foundry LogScale
- Host Group
- Host Migration
- Hosts
- Identity Protection
- Image Assessment Policies
- Incidents
- Installation Tokens
- Intel
- Intelligence Feeds
- Intelligence Indicator Graph
- IOA Exclusions
- IOC
- IOCs (deprecated)
- IT Automation
- Kubernetes Container Compliance
- Kubernetes Protection
- MalQuery
- Message Center
- ML Exclusions
- Mobile Enrollment
- MSSP (Flight Control)
- NGSIEM
- OAuth2
- ODS (On Demand Scan)
- Prevention Policy
- Quarantine
- Quick Scan
- Quick Scan Pro
- Real Time Response
- Real Time Response Admin
- Real Time Response Audit
- Recon
- Report Executions
- Response Policies
- Sample Uploads
- SaaS Security
- Scheduled Reports
- Sensor Download
- Sensor Update Policy
- Sensor Usage
- Sensor Visibility Exclusions
- Serverless Exports
- Serverless Vulnerabilities
- Spotlight Evaluation Logic
- Spotlight Vulnerabilities
- Spotlight Vulnerability Metadata
- 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
