Manager
psengine.sandbox.sandbox_mgr.SandboxMgr
¶
Manages requests for Recorded Future sandbox.
| PARAMETER | DESCRIPTION |
|---|---|
api_token
|
The Sandbox API token. Defaults to RF_SANDBOX_TOKEN environment variable.
TYPE:
|
sandbox_choice
|
Sandbox environment to use. Options: eu (default), usa, apj, public, private.
TYPE:
|
Source code in psengine/sandbox/sandbox_mgr.py
submit_sample
¶
submit_sample(
kind: SubmitKind,
file_path: Path | None = None,
url: str | None = None,
source_id: str | None = None,
interactive: bool | None = None,
password: str | None = None,
profiles: list[dict] | None = None,
user_tags: str | list[str] | None = None,
timeout: int | None = None,
network: NetworkMode | None = None,
geolocation: str | None = None,
) -> Sample
Submit a sample for analysis via POST /samples.
Accepts one of four submission kinds: file (upload a local file),
url (detonate a URL in a browser), fetch (sandbox downloads the file
from the URL, then detonates), or import (import a public Triage sample
by id).
| PARAMETER | DESCRIPTION |
|---|---|
kind
|
Submission kind: 'file', 'url', 'fetch' (sandbox downloads), or 'import'.
TYPE:
|
file_path
|
Path to the file to upload. Required when kind='file'.
TYPE:
|
url
|
Target URL. Required when kind in {'url', 'fetch'}.
TYPE:
|
source_id
|
Public Triage sample id to import. Required when kind='import'.
TYPE:
|
interactive
|
Pause at static_analysis for manual profile selection.
TYPE:
|
password
|
Decrypt password for archive submissions.
TYPE:
|
profiles
|
Per-file profile mappings, e.g. [{"pick":"path","profile":"
TYPE:
|
user_tags
|
Custom tags attached to the submission (max 1kB total). A bare string is coerced to a single-item list.
TYPE:
|
timeout
|
Analysis duration in seconds, max 3600. Maps to
TYPE:
|
network
|
Network mode for the analysis VM. Maps to
TYPE:
|
geolocation
|
VPN exit region tag. Requires
TYPE:
|
Example
Submit a URL:
Submit a local file with custom tags:
Note
For kind='fetch' the returned record's kind is 'file' — Triage
materialises the URL into a downloaded file before analysis, so the
submission is filed under 'file' in the API.
Endpoint
POST /samples
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If kind-specific required fields are missing (e.g.
|
SampleSubmitError
|
If API error occurs. |
| RETURNS | DESCRIPTION |
|---|---|
Sample
|
The Sample model. |
Source code in psengine/sandbox/sandbox_mgr.py
778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 | |
search_samples
¶
search_samples(
file_hash: list[str] | str | None = None,
family: list[str] | str | None = None,
tag: list[str] | str | None = None,
botnet: list[str] | str | None = None,
wallet: list[str] | str | None = None,
ip: list[str] | str | None = None,
domain: list[str] | str | None = None,
url: list[str] | str | None = None,
from_date: str | None = None,
to_date: str | None = None,
query: str | None = None,
results_per_page: int = SAMPLES_PER_PAGE,
max_results: int = DEFAULT_PAGE_LIMIT,
) -> list[Sample]
Search available analyses for a range of IoCs or file characteristics.
Structured parameters are translated into Triage search operators and joined with AND
(e.g. family='emotet', tag='ransomware' becomes family:emotet AND tag:ransomware).
Each list-valued parameter may be a single string or a list of strings.
| PARAMETER | DESCRIPTION |
|---|---|
file_hash
|
One or more file hashes (MD5/SHA1/SHA256/SHA512).
TYPE:
|
family
|
Malware family tag(s), e.g. "emotet". Maps to the
TYPE:
|
tag
|
Behaviour tag(s), e.g. "ransomware". Maps to the
TYPE:
|
botnet
|
Botnet tag(s). Maps to the
TYPE:
|
wallet
|
Cryptocurrency wallet address(es). Maps to the
TYPE:
|
ip
|
Extracted C2 IP address(es). Maps to the
TYPE:
|
domain
|
Extracted C2 domain(s). Maps to the
TYPE:
|
url
|
Extracted C2 URL(s). Maps to the
TYPE:
|
from_date
|
Start of the submission-date window (
TYPE:
|
to_date
|
End of the submission-date window (
TYPE:
|
query
|
Raw Triage query string appended to the structured filters with
TYPE:
|
results_per_page
|
Per-request page size (max 200).
TYPE:
|
max_results
|
Total cap on samples returned across all pages.
TYPE:
|
Example
Note
A raw query is combined with the structured filters using AND. Pass query
alone to run an arbitrary Triage query (e.g. query='family:emotet OR family:qakbot').
More information at: https://sandbox.recordedfuture.com/docs/cloud-api/search/
Endpoint
GET /search
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If any supplied parameter is of incorrect type or out of range. |
ValueError
|
If no filter is supplied (no structured parameter and no raw |
SampleSearchError
|
If API error occurs. |
| RETURNS | DESCRIPTION |
|---|---|
list[Sample]
|
List of Sample models matching the search. |
Source code in psengine/sandbox/sandbox_mgr.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | |
fetch_samples
¶
fetch_samples(
subset: SandboxSubset = 'owned',
max_results: int = DEFAULT_PAGE_LIMIT,
samples_per_page: int = SAMPLES_PER_PAGE,
) -> list[Sample]
List the collection of samples submitted to the sandbox.
| PARAMETER | DESCRIPTION |
|---|---|
subset
|
Which samples to list: 'owned' (default, samples the requesting user can access), 'public' (only valid on the public cloud), or 'org' (all organisation samples).
TYPE:
|
max_results
|
Total cap on samples returned across all pages.
TYPE:
|
samples_per_page
|
Per-request page size (max 200).
TYPE:
|
Example
Endpoint
GET /samples
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If any supplied parameter is of incorrect type or out of range. |
SamplesFetchError
|
If API error occurs. |
| RETURNS | DESCRIPTION |
|---|---|
list[Sample]
|
List of Sample models. |
Source code in psengine/sandbox/sandbox_mgr.py
fetch_sample_file
¶
Download the originally submitted file for a sample.
Returns the raw file content exactly as it was submitted.
| PARAMETER | DESCRIPTION |
|---|---|
sample_id
|
Sandbox sample ID, e.g. "260501-h4p7laawme".
TYPE:
|
Warning
This returns live, potentially malicious bytes. Handle them in an isolated environment.
Example
Endpoint
GET /samples/{sample_id}/sample
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If |
SampleFileFetchError
|
If API error occurs. |
| RETURNS | DESCRIPTION |
|---|---|
bytes
|
Raw bytes of the originally submitted file. |
Source code in psengine/sandbox/sandbox_mgr.py
fetch_sample_summary
¶
fetch_sample_summary(sample_id: str) -> SampleSummary
Fetch the short summary for a sample.
The summary is a compact one-object overview: the overall score and status, the
submission target, and a tasks map keyed by task id (e.g. static1, behavioral1,
urlscan1) where each task carries its own kind, status and score.
| PARAMETER | DESCRIPTION |
|---|---|
sample_id
|
Sandbox sample ID, e.g. "260501-h4p7laawme".
TYPE:
|
Example
Note
completed is None until every task has finished, in-progress samples
(e.g. still in static_analysis) return a summary without it.
Endpoint
GET /samples/{sample_id}/summary
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If |
SampleSummaryError
|
If API error occurs. |
| RETURNS | DESCRIPTION |
|---|---|
SampleSummary
|
SampleSummary model, overall score/status plus a per-task breakdown. |
Source code in psengine/sandbox/sandbox_mgr.py
fetch_sample_static_report
¶
fetch_sample_static_report(
sample_id: str,
wait_until_ready: bool = False,
timeout: int = STATIC_REPORT_WAIT_DEFAULT_TIMEOUT_SECONDS,
) -> StaticAnalysisReport
Fetch the static analysis report for a sample.
The static report is the pre-detonation pass: it identifies the submitted
sample, scores it, lists any static signatures, enumerates the files
table, the submitted file plus everything unpacked from it (e.g. members
of a submitted archive), and surfaces any malware configuration recovered
at this stage in extracted.
| PARAMETER | DESCRIPTION |
|---|---|
sample_id
|
Sandbox sample ID, e.g. "260501-h4p7laawme".
TYPE:
|
wait_until_ready
|
When true, keep polling until the static report is available.
TYPE:
|
timeout
|
Max seconds to keep polling when wait_until_ready is true.
TYPE:
|
Example
Block until the report is ready instead of handling the not-available error:
Note
files, signatures and extracted are always lists, the API returns
null for them when empty (e.g. files for a URL submission), which this
method normalises to [].
Endpoint
GET /samples/{sample_id}/reports/static
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If |
SampleReportNotAvailableError
|
If the sample exists but its static report is
not available yet (404 |
SampleReportNotFoundError
|
If the sample does not exist (404 |
SampleStaticReportError
|
If API error occurs. |
| RETURNS | DESCRIPTION |
|---|---|
StaticAnalysisReport
|
StaticAnalysisReport model |
Source code in psengine/sandbox/sandbox_mgr.py
482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 | |
fetch_sample_overview_report
¶
fetch_sample_overview_report(
sample_id: str,
wait_until_ready: bool = False,
timeout: int = OVERVIEW_REPORT_WAIT_DEFAULT_TIMEOUT_SECONDS,
) -> OverviewReport
Fetch the overview report for a sample.
The overview is the a method that combines every task's result: the overall
analysis verdict (score, family, tags), the sample identity, recovered malware
configs in extracted, the sample-level signatures, a per-targets breakdown
(each target with its own IOCs and signature hits) and the tasks map keyed by
task id (e.g. static1, behavioral1, urlscan1).
| PARAMETER | DESCRIPTION |
|---|---|
sample_id
|
Sandbox sample ID, e.g. "260501-h4p7laawme".
TYPE:
|
wait_until_ready
|
When true, keep polling until the overview report is available.
TYPE:
|
timeout
|
Max seconds to keep polling when wait_until_ready is true.
TYPE:
|
Example
Block until the report is ready instead of handling the not-available error:
Note
The overview is only generated once the sample reaches the reported state.
A sample that exists but has not been fully analysed yet (e.g. still in
static_analysis) returns 404 REPORT_NOT_AVAILABLE, which raises
SampleReportNotAvailableError, distinct from a 404 NOT_FOUND for an
unknown sample id.
Endpoint
GET /samples/{sample_id}/overview.json
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If |
SampleReportNotAvailableError
|
If the sample exists but its overview is not
available yet (404 |
SampleReportNotFoundError
|
If the sample does not exist (404 |
SampleOverviewError
|
If API error occurs. |
| RETURNS | DESCRIPTION |
|---|---|
OverviewReport
|
OverviewReport model |
Source code in psengine/sandbox/sandbox_mgr.py
574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | |
fetch_behavioral_reports
¶
fetch_behavioral_reports(
sample_id: str,
max_workers: int = 0,
wait_until_ready: bool = False,
timeout: int = BEHAVIORAL_REPORT_WAIT_DEFAULT_TIMEOUT_SECONDS,
) -> BehavioralReportsResult
Fetch every behavioral report for a sample.
Convenience wrapper: it first fetches the sample to discover its tasks, then fetches
the report_triage.json for each behavioral task. Per-task outcomes are returned in
a BehavioralReportsResult envelope, so one unfinished or broken task does not hide
the reports that are ready: finished reports land in reports, tasks whose report is
not available yet (still queued/running) in not_ready, and tasks whose fetch failed
for any other HTTP reason in failed.
Every finished behavioral task lands in reports, whether its analysis succeeded
or failed; a failed analysis' report carries an errors list and omits
processes/dumped/extracted. Each report's task_id (e.g. behavioral1)
identifies which task it belongs to. Non-behavioral tasks (static*, urlscan*)
have no triage report and are skipped.
| PARAMETER | DESCRIPTION |
|---|---|
sample_id
|
Sandbox sample ID, e.g. "260501-h4p7laawme".
TYPE:
|
max_workers
|
Threads for fetching the per-task reports concurrently. 0 (default) = sequential.
TYPE:
|
wait_until_ready
|
When true, keep polling until the result is complete, or timeout seconds elapse.
TYPE:
|
timeout
|
Max seconds to keep polling when wait_until_ready is true.
TYPE:
|
Example
Block until every task has a report or a failure, instead of polling
result.complete yourself:
Note
result.complete is True when no report is still pending, including when
the sample has no behavioral tasks at all (reports is empty then). For samples
with many behavioral tasks (e.g. multi-architecture Linux submissions), pass
max_workers to fetch the per-task reports concurrently.
Endpoint
GET /samples/{sample_id} then GET /samples/{sample_id}/{task_id}/report_triage.json
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If |
SampleReportNotFoundError
|
If the sample does not exist (404 |
SampleBehavioralReportError
|
If API error occurs. Per-task HTTP failures do not
raise, they land in the |
| RETURNS | DESCRIPTION |
|---|---|
BehavioralReportsResult
|
Envelope with the finished |
Source code in psengine/sandbox/sandbox_mgr.py
670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 | |
set_sample_profile
¶
set_sample_profile(
sample_id: str,
auto: bool = False,
profiles: list[dict] | None = None,
pick: list[str] | None = None,
) -> SampleProfileOut
Set the analysis profile for an interactive sample.
Only valid while the sample is paused in static_analysis, i.e. it was
submitted with interactive=True. Setting the profile advances the sample
into the analysis queue.
| PARAMETER | DESCRIPTION |
|---|---|
sample_id
|
Sandbox sample ID, e.g. "260501-h4p7laawme".
TYPE:
|
auto
|
Let the sandbox pick profiles itself. When False (default) you must supply
TYPE:
|
profiles
|
Manual per-target profile mappings (required when
TYPE:
|
pick
|
Target filenames to advance when
TYPE:
|
Example
Manual selection (one mapping per target):
Let the sandbox pick profiles automatically:
Endpoint
POST /samples/{sample_id}/profile
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If |
SampleProfileError
|
If API error occurs. |
| RETURNS | DESCRIPTION |
|---|---|
SampleProfileOut
|
SampleProfileOut model |
Source code in psengine/sandbox/sandbox_mgr.py
delete_sample
¶
delete_sample(sample_id: str) -> SampleDeleteOut
Delete a sample by id.
Returns SampleDeleteOut(deleted=True) only on a successful 2xx response.
Any HTTP failure raises SampleDeleteError; this method never returns
deleted=False.
| PARAMETER | DESCRIPTION |
|---|---|
sample_id
|
Sandbox sample ID to delete.
TYPE:
|
Example
Note
The Triage API returns 401 Unauthorized for every non-success outcome
— already deleted, never existed, no permission to delete, or expired
token. Status alone cannot distinguish these cases; SampleDeleteError
carries the raw API message verbatim for inspection.
Endpoint
DELETE /samples/{sample_id}
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If |
SampleDeleteError
|
If API error occurs. |
| RETURNS | DESCRIPTION |
|---|---|
SampleDeleteOut
|
SampleDeleteOut model |
Source code in psengine/sandbox/sandbox_mgr.py
create_profile
¶
create_profile(
name: str,
tags: str | list[str],
timeout: int,
network: NetworkMode | None = None,
geolocation: str | list[str] | None = None,
browser: Browser | None = None,
) -> Profile
Create a new analysis profile.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
Profile name. Must be unique within the company.
TYPE:
|
tags
|
Resource tags, e.g.
TYPE:
|
timeout
|
Analysis duration in seconds (1–3600).
TYPE:
|
network
|
Network mode applied to analysis VMs using this profile.
TYPE:
|
geolocation
|
Region tag(s). The API rejects this unless
TYPE:
|
browser
|
Browser used by analyses. One of 'chrome', 'firefox', 'ie11', 'microsoft-edge'.
TYPE:
|
Example
Endpoint
POST /profiles
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If |
ProfileCreateError
|
If API error occurs. |
| RETURNS | DESCRIPTION |
|---|---|
Profile
|
The newly-created profile. |
Source code in psengine/sandbox/sandbox_mgr.py
1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 | |
fetch_profiles
¶
fetch_profiles() -> list[Profile]
List analysis profiles.
Profiles are company-scoped analysis configurations (OS tags, network mode, timeout, geolocation, browser).
Example
Endpoint
GET /profiles
| RAISES | DESCRIPTION |
|---|---|
ProfileFetchError
|
If API error occurs. |
| RETURNS | DESCRIPTION |
|---|---|
list[Profile]
|
List of Profile models. |
Source code in psengine/sandbox/sandbox_mgr.py
fetch_profile
¶
fetch_profile(profile_id: str) -> Profile
Fetch a single analysis profile by ID or name.
The API accepts either the ID assigned at create time or the profile name.
| PARAMETER | DESCRIPTION |
|---|---|
profile_id
|
Profile ID or name.
TYPE:
|
Example
Endpoint
GET /profiles/{profile_id}
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If |
ProfileNotFoundError
|
If API error occurs. |
| RETURNS | DESCRIPTION |
|---|---|
Profile
|
Profile model |
Source code in psengine/sandbox/sandbox_mgr.py
update_profile
¶
update_profile(
profile_id: str,
name: str,
tags: str | list[str],
timeout: int,
network: NetworkMode | None = None,
geolocation: str | list[str] | None = None,
browser: Browser | None = None,
) -> ProfileUpdateOut
Update an existing analysis profile.
This method is a full replace: all fields except id must be submitted.
Any optional field omitted from this call is cleared on the server,
e.g. calling without browser removes any browser previously set on
the profile.
Idempotent on 404: updating a profile that doesn't exist (already
deleted, wrong id/name) returns UpdateOut(updated=False) rather than
raising, so callers can check result.updated to know whether the
target existed. Every other failure mode (401/403 auth, 409 name
collision, 5xx, connection errors) still raises ProfileUpdateError.
The API returns 200 with an empty body on success (it does not echo
the updated profile), so this method returns UpdateOut(updated=True)
rather than a Profile. Call fetch_profile() afterwards if you need
the echoed record.
| PARAMETER | DESCRIPTION |
|---|---|
profile_id
|
Profile ID or name. Renaming via
TYPE:
|
name
|
Profile name. May differ from the existing name (rename).
TYPE:
|
tags
|
Resource tags, e.g.
TYPE:
|
timeout
|
Analysis duration in seconds (1–3600).
TYPE:
|
network
|
Network mode applied to analysis VMs using this profile.
TYPE:
|
geolocation
|
Region tag(s). The API rejects this unless
TYPE:
|
browser
|
Browser used by analyses. One of 'chrome', 'firefox', 'ie11', 'microsoft-edge'.
TYPE:
|
Example
Endpoint
PUT /profiles/{profile_id}
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If |
ProfileUpdateError
|
If API error occurs. |
| RETURNS | DESCRIPTION |
|---|---|
ProfileUpdateOut
|
ProfileUpdateOut model |
Source code in psengine/sandbox/sandbox_mgr.py
1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 | |
delete_profile
¶
delete_profile(profile_id: str) -> ProfileDeleteOut
Delete an analysis profile.
Idempotent on 404: deleting a profile that doesn't exist (already deleted,
wrong id/name, etc.) returns ProfileDeleteOut(deleted=False) rather than
raising, so callers can do best-effort cleanup without try/except. Every
other failure mode (401/403 auth, 5xx, connection errors) still raises
ProfileDeleteError.
| PARAMETER | DESCRIPTION |
|---|---|
profile_id
|
Profile ID or name.
TYPE:
|
Example
Endpoint
DELETE /profiles/{profile_id}
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If |
ProfileDeleteError
|
If API error occurs. |
| RETURNS | DESCRIPTION |
|---|---|
ProfileDeleteOut
|
ProfileDeleteOut model |