Snapshot
To retrieve a snapshot of the threat intelligence from the ThreatStream cloud.
Snapshot is a point-in-time copy of the threat intelligence on ThreatStream.
ThreatStream provides multiple methods for retrieving threat intelligence. Use the following criteria to determine which method is appropriate for your needs:
| Task | Appropriate Method |
|---|---|
| Downloading small intelligence sets on an ad-hoc basis. | Use the Intelligence API. See Intelligence for more information. |
| Downloading large intelligence sets–those spanning thousands of pages–on an ad-hoc basis. | Use the Snapshot API. |
| Downloading large intelligence sets–those spanning thousands of pages–on a regular basis. | Use ThreatStream Integrator. Contact your Anomali Support representative for more information. |
You can set filters to specify criteria by which intelligence should be retrieved, as described in the table below.
Request
/api/v1/snapshot/
HTTP Methods: GET, POST
Attributes: See the table below
| Attribute | Element | Description | |
|---|---|---|---|
| custom_config |
A map containing the following elements: filter, max_results, whitelist/blacklist, field_whitelist/field_blacklist, chunk_size, format and use_org_whitelist. For example,
|
||
| filter |
Filter string to use as the search criteria for the intelligence. Example: See Intelligence Fields in ThreatStream for a complete list of fields you can specify. |
||
| max_results |
Specify a maximum number of results to return. Example: max_results=50000 |
||
| whitelist |
Only include indicators that match the specified fields and values. Syntax: If multiple fields are specified in a list, then the “AND” boolean operation is assumed among the fields. Examples:
Notes:
|
||
| blacklist |
Exclude indicators that match the specified fields and values. Syntax: If multiple fields are specified in a list, then the “AND” boolean operation is assumed among the fields. Examples:
Notes:
|
||
| field_whitelist |
Include only these fields in the results. Remove all other fields. For example, if "field_whitelist": ["asn", "severity", "domain"], only these fields will be included for each indicator in the snapshot. Notes:
|
||
| field_blacklist |
Exclude these fields from the records that are returned. For example, if "field_blacklist": ["confidence", "severity"], these fields will be excluded for each indicator in the snapshot. Notes:
|
||
| chunk_size |
Specify the size of the snapshot file, in KB or MB. The maximum supported value is 200 MB. To retrieve a successful snapshot, you must specify either chunk_size or chunk_ioc_count. When a value is not specified for this attribute, the API call returns an error. Do not specify values for both attributes. Note: If the chunk_size is small and cannot fit in an entire snapshot, you will need to retrieve multiple chunks until all data has been retrieved. If more data is available, the value of the Status field is "inprogress". Continue to retrieve the data until Status field value is "completed".
|
||
| chunk_ioc_count |
Specify the number of Indicators of Compromise (IOCs) the snapshot can contain. The maximum supported value is 250,000. To retrieve a successful snapshot, you must specify either chunk_size or chunk_ioc_count. Requests fail without values specified for one of these attributes. Do not specify values for both attributes. |
||
| format |
Format of the snapshot. Available formats:
Note: If you specify
csv or json, only domain, email, MD5, IP, and URL observables are included in snapshots. Therefore to ensure complete data is returned Anomali recommends using csv_v2 or json_v2. |
||
| use_org_whitelist |
Specify whether your organization Import Whitelist should be applied to the snapshot. Possible values: When set to If no value is specified, your Import Whitelist is not applied to the snapshot. |
||
| intel_version | integer | A field to specify the intelligence version—v1 or v2. Currently, only v1 is supported. | |
Response
Format: CSV, JSON, or STIX
Attributes: See the table below
Filtering of attributes: See the table below
| Attribute | Type | Filter Operators | Description |
|---|---|---|---|
| id | integer | "lt", "lte", "gt", "gte" | A unique identifier for the snapshot. |
| location | string | Not available for filtering | Location header that specifies the URL to use for checking the status of snapshot creation and downloading the snapshot files. |
| resource_uri | string | Not available for filtering | URI for the snapshot on ThreatStream. |
| sha256sum | string | "exact" |
The sha256sum (to verify the integrity) of the snapshot file that is available for download. Note: This attribute is only available in the response. |
| snapshot_ts | datetime | "lt", "lte", "gt", "gte" | Timestamp when the snapshot was started on ThreatStream. |
| status | string | Not available for filtering |
Status of snapshot creation. Status is "inprogress" when snapshot files are being created. Once all files have been created, the Status is "completed". Status may be "errors" if the snapshot creation failed for any reason. Possible values: inprogress, completed, errors |
Example
To obtain a full snapshot, in JSON format, in 1 MB chunks, that meets the specified criteria:
curl -XPOST 'https://api.threatstream.com/api/v1/snapshot/' -H 'Authorization: apikey <username>:<api_key>' -H 'Content-Type: application/json' -d '{
"intel_version":1,
"custom_config":{
"filter":"state=\"active\"",
"whitelist":{
"itype":[
"mal_ip",
"mal_domain"
]
},
"field_blacklist":[
"asn",
"country"
],
"format":"json_v2",
"use_org_whitelist":true,
"chunk_size":"1MB"
}
}'
A successful response contains a Location header, such as https://api.threatstream.com/api/v1/snapshot/2/.
The Location header contains the ID of the snapshot. In the above example, https://api.threatstream.com/api/v1/snapshot/2/, 2 is the snapshot ID. Use this ID when making HTTP GET requests to retrieve the snapshot. If the snapshot contains multiple files, the HTTP GET response will contain URLs of all the files along with the Status. If all files could not be retrieved with one HTTP GET request, Status will be "inprogress". Continue to make requests until all files have been retrieved. Once all files have been retrieved, the Status will change to "completed".
curl 'https://api.threatstream.com/api/v1/snapshot/2/' -H 'Authorization: apikey <username>:<api_key>'
The above example assumes that the Location header is https://api.threatstream.com/api/v1/snapshot/2/.
Output Sample
The calls to the status URL will return JSON and STIX output similar to the following:
{
"status":"inprogress",
"files":[
{
"download_url":"https://<download_URL_1>",
"sha256":"<SHA-256 sum of the file to be downloaded>",
"total_count":<count>
},
{
"download_url":"https://<download_URL_2>",
"sha256":"<SHA-256 sum of the file to be downloaded>",
"total_count":<count>
}
]
}
{
"status":"inprogress",
"files":[
{
"download_url":"https://<download_URL_1>",
"sha256":"<SHA-256 sum of the file to be downloaded>",
"total_count":<count>
},
{
"download_url":"https://<download_URL_2>",
"sha256":"<SHA-256 sum of the file to be downloaded>",
"total_count":<count>
}
]
}
Error Codes
If the snapshot creation process fails, HTTP status codes reflect the reason for failure.