Manager
psengine.asi.asi_mgr.AttackSurfaceMgr
¶
Manages requests for Recorded Future SecurityTrails (ASI) API.
| PARAMETER | DESCRIPTION |
|---|---|
api_token
|
ASI API token.
TYPE:
|
Source code in psengine/asi/asi_mgr.py
fetch_projects
¶
fetch_projects(
sort_direction: Optional[
Literal['asc', 'desc']
] = 'asc',
) -> ProjectListOut
Fetch ASI projects.
| PARAMETER | DESCRIPTION |
|---|---|
sort_direction
|
Sort direction for the projects
TYPE:
|
Endpoint
v2/projects
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If any supplied parameter is of incorrect type. |
ASIFetchProjectsError
|
If an API or connection error occurs. |
| RETURNS | DESCRIPTION |
|---|---|
ProjectListOut
|
List of ASI Project models |
Source code in psengine/asi/asi_mgr.py
search_assets
¶
search_assets(
project_id: str,
quick_search: Optional[str] = None,
asset_id: Optional[str] = None,
asset_name: Optional[str] = None,
asset_apex_domain: Optional[
Union[str, list[str]]
] = None,
asset_discovered_date: Optional[
tuple[Optional[str], Optional[str]]
] = None,
asset_type: Optional[AssetType] = None,
custom_tags: Optional[list[str]] = None,
is_static_asset: Optional[bool] = None,
exposure_severity: Optional[
Union[ExposureSeverity, list[ExposureSeverity]]
] = None,
exposure_signature_id: Optional[
Union[str, list[str]]
] = None,
exposure_score: Optional[tuple[int, int]] = None,
exposure_last_scanned: Optional[
tuple[Optional[str], Optional[str]]
] = None,
open_port_number: Optional[
Union[int, list[int]]
] = None,
open_port_service: Optional[
Union[str, list[str]]
] = None,
open_port_protocol: Optional[
Union[str, list[str]]
] = None,
technology_name: Optional[Union[str, list[str]]] = None,
certificate_issuer: Optional[
Union[str, list[str]]
] = None,
is_responsive: Optional[bool] = None,
enrichments: list[EnrichmentType] = None,
sort_by: list[SortByType] = None,
assets_per_page: int = ASSETS_PER_PAGE,
max_results: Optional[int] = DEFAULT_LIMIT,
) -> AssetResponse
Search for assets within an ASI project.
Does pagination requests on batches of assets_per_page up to max_results.
| PARAMETER | DESCRIPTION |
|---|---|
project_id
|
The ID of the ASI project to search assets within
TYPE:
|
quick_search
|
Search term to match against asset name, IP addresses, and technology fields
TYPE:
|
asset_id
|
Filter for the specific asset, which will be either a IP or domain value (examples: 192.88.99.2 or www.example.com).
TYPE:
|
asset_name
|
Filter on the name of the asset(IP address or domain).
TYPE:
|
asset_apex_domain
|
Filter on the apex domain of the asset (example: example.com). Pass a single value or a list.
TYPE:
|
asset_discovered_date
|
Filter on the date (Y-m-d) the asset was discovered by Recorded Future ASI. This may be different than when the asset was added to the project. IPv4 addresses will have a fixed point in the past for their discovery date. Use None for an open-ended bound.
TYPE:
|
asset_type
|
The type of asset, one of: ip, domain and host (where domain and host represent the same asset type).
TYPE:
|
custom_tags
|
Filter for assets tagged with any of the provided custom tags.
TYPE:
|
is_static_asset
|
Filter for assets that are static, meaning they have a consistent IP address or domain name over time.
TYPE:
|
exposure_severity
|
Filter assets by exposure severity. Pass a single value or a list to match any of the provided severities.
TYPE:
|
exposure_signature_id
|
Filter assets by ASI Signature ID. Pass a single ID or a list. Some signatures align with CVEs, e.g. "cve-2024-6387" or "cve-OpenSSH".
TYPE:
|
exposure_score
|
Filter assets by exposure score range (0–100). Provide a (min, max) tuple. The score indicates potential asset risk based on various factors.
TYPE:
|
exposure_last_scanned
|
Filter assets by the date they were last scanned for exposures. Provide a (start, end) tuple of "YYYY-MM-DD" strings. Use None for an open-ended bound.
TYPE:
|
open_port_number
|
Filter for assets which have an open port with the provided number (e.g. 80).
TYPE:
|
open_port_service
|
Filter for assets which have an open port with the provided service (e.g. http, ftp, rdp).
TYPE:
|
open_port_protocol
|
Filter for assets which have an open port with the provided protocol (e.g. tcp, udp).
TYPE:
|
technology_name
|
Filter for the name of a technology found on the asset. Could be directly attached to the port (nginx, etc) or a web technology (e.g. 'jQuery', 'Wordpress')).
TYPE:
|
certificate_issuer
|
Filter where the certificate (or in the chain) issuer's common name or organization matches the provided value
TYPE:
|
is_responsive
|
Filter for assets that are unresponsive over ICMP and no ports are open. This is a boolean filter, so it will return assets that are either responsive or not responsive.
TYPE:
|
enrichments
|
List of enrichments to apply to the assets
TYPE:
|
sort_by
|
List of fields to sort the assets by
TYPE:
|
assets_per_page
|
Number of assets to fetch per page
TYPE:
|
max_results
|
Maximum number of assets to fetch
TYPE:
|
Endpoint
v2/projects/{project_id}/assets/_search
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If any supplied parameter is of incorrect type. |
ValueError
|
If |
ASISearchAssetsError
|
If an API or connection error occurs. |
| RETURNS | DESCRIPTION |
|---|---|
AssetResponse
|
Response model for ASI assets search |
Source code in psengine/asi/asi_mgr.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 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 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | |
search_exposures
¶
search_exposures(
project_id: str,
filter_cve_id: Optional[str] = None,
filter_cvss_score_gte: Optional[float] = None,
filter_cvss_score_lte: Optional[float] = None,
filter_cwe_id: Optional[str] = None,
filter_severity_exact: Optional[SEVERITY_FILTER] = None,
filter_severity_min: Optional[SEVERITY_FILTER] = None,
max_results: Optional[int] = DEFAULT_LIMIT,
exposures_per_page: Optional[int] = DEFAULT_LIMIT,
) -> ExposureSearchOut
Search for exposures within an ASI project.
Does pagination requests on batches of the API default page size up to max_results.
| PARAMETER | DESCRIPTION |
|---|---|
project_id
|
The ID of the ASI project to search assets within
TYPE:
|
filter_cve_id
|
Filter for asset or exposure tied to a vulnerability with the provided CVE. Example CVE-2024-6387.
TYPE:
|
filter_cvss_score_gte
|
Filter for asset or exposure tied to a vulnerability with the provided CVSS score range. Example 7.5.
TYPE:
|
filter_cvss_score_lte
|
Filter for asset or exposure tied to a vulnerability with the provided CVSS score range. Example 7.5.
TYPE:
|
filter_cwe_id
|
Filter for asset or exposure tied to a vulnerability associated with the provided CWE. Example CWE-79.
TYPE:
|
filter_severity_exact
|
Filter for assets which have an exposure severity matching the provided value.
TYPE:
|
filter_severity_min
|
Filter for assets which have an exposure severity matching or higher than the provided value.
TYPE:
|
max_results
|
Maximum number of assets to fetch
TYPE:
|
exposures_per_page
|
Results per page
TYPE:
|
Endpoint
v2/projects/{project_id}/exposures
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If any supplied parameter is of incorrect type. |
ASIExposureSearchError
|
If an API or connection error occurs. |
| RETURNS | DESCRIPTION |
|---|---|
ExposureSearchOut
|
Response model for ASI exposures search |
Source code in psengine/asi/asi_mgr.py
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 | |
fetch_exposures_by_signature
¶
fetch_exposures_by_signature(
project_id: str,
signature_id: str,
max_results: Optional[int] = DEFAULT_LIMIT,
exposures_per_page: Optional[int] = DEFAULT_LIMIT,
) -> AssetWithExposureSearch
Fetch assets by exposure signature within an ASI project.
Does pagination requests on batches of the API default page size up to max_results.
| PARAMETER | DESCRIPTION |
|---|---|
project_id
|
The ID of the ASI project to search assets within
TYPE:
|
signature_id
|
The ID of the signature to search assets within
TYPE:
|
max_results
|
Maximum number of assets to fetch
TYPE:
|
exposures_per_page
|
Results per page
TYPE:
|
Endpoint
v2/projects/{project_id}/exposures/{signature_id}
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If any supplied parameter is of incorrect type. |
ASIFetchExposureError
|
If an API or connection error occurs. |
| RETURNS | DESCRIPTION |
|---|---|
AssetWithExposureSearch
|
ASI asset with exposure details for the requested signature |
Source code in psengine/asi/asi_mgr.py
fetch_assets
¶
fetch_assets(
project_id: str,
sort_by: Literal[
'discovered_at',
'added_to_project_at',
'last_scanned_at',
'exposure_score',
'asset_id',
'apex_domain',
] = 'exposure_score',
sort_direction: Literal['asc', 'desc'] = 'desc',
asset_type: Optional[
Literal['domain', 'host', 'ip']
] = None,
custom_tags: Optional[str] = None,
custom_tags_strict: Optional[str] = None,
has_custom_tags: Optional[bool] = None,
added_to_project_before: Optional[str] = None,
added_to_project_after: Optional[str] = None,
discovered_before: Optional[str] = None,
discovered_after: Optional[str] = None,
apex: Optional[str] = None,
referenced_ip: Optional[str] = None,
referenced_ip_before: Optional[str] = None,
referenced_ip_after: Optional[str] = None,
has_dns_record_type: Optional[str] = None,
dns_resolves: Optional[bool] = None,
asn: Optional[int] = None,
cname_reference: Optional[str] = None,
geo_country_iso: Optional[str] = None,
ip_owner: Optional[str] = None,
whois_email: Optional[str] = None,
whois_email_current: Optional[str] = None,
open_port_number: Optional[int] = None,
open_port_protocol: Optional[str] = None,
open_port_service: Optional[str] = None,
open_port_technology: Optional[str] = None,
technology_name: Optional[str] = None,
web_technology_name: Optional[str] = None,
certificate_issuer: Optional[str] = None,
certificate_expires_before: Optional[str] = None,
certificate_expires_after: Optional[str] = None,
certificate_issued_before: Optional[str] = None,
certificate_issued_after: Optional[str] = None,
certificate_subject: Optional[str] = None,
certificate_subject_alt_name: Optional[str] = None,
certificate_sha256: Optional[str] = None,
certificate_covers_domain: Optional[str] = None,
waf_detected: Optional[bool] = None,
waf_name: Optional[str] = None,
is_responsive: Optional[bool] = None,
exposure_score_gte: Optional[int] = None,
exposure_score_lte: Optional[int] = None,
exposure_severity: Optional[
Literal[
'unknown',
'informational',
'moderate',
'critical',
]
] = None,
exposure_id: Optional[str] = None,
additional_fields: Optional[
list[
Literal[
'custom_tags',
'dns_records',
'whois',
'ip_metadata',
'open_tcp_ports',
'open_udp_ports',
'web_technologies',
'certificates',
'certificate_chain',
'defenses',
'exposures',
'exposure_instance_details',
]
]
] = None,
max_results: Optional[int] = DEFAULT_LIMIT,
assets_per_page: Optional[int] = DEFAULT_LIMIT,
) -> AssetResponse
Fetch assets within an ASI project.
Does pagination requests on batches of the API default page size up to max_results.
| PARAMETER | DESCRIPTION |
|---|---|
project_id
|
The ID of the ASI project to search assets within
TYPE:
|
sort_by
|
The field to sort by.
TYPE:
|
sort_direction
|
The direction to sort by.
TYPE:
|
asset_type
|
The type of asset, one of: ip, domain, or host.
TYPE:
|
custom_tags
|
Filter by custom tags placed on your assets.
TYPE:
|
custom_tags_strict
|
Filter by custom tags placed on your assets. Strict version will return a validation error if any of the tags have not been defined on your project.
TYPE:
|
has_custom_tags
|
Filter for assets that have at least one custom tag applied. Overrides any other custom tag filtering specified.
TYPE:
|
added_to_project_before
|
Filter on the date (YYYY-MM-DD) the asset was added to the project.
TYPE:
|
added_to_project_after
|
Filter on the date (YYYY-MM-DD) the asset was added to the project.
TYPE:
|
discovered_before
|
Filter on the date (YYYY-MM-DD) the asset was discovered.
TYPE:
|
discovered_after
|
Filter on the date (YYYY-MM-DD) the asset was discovered.
TYPE:
|
apex
|
Filter on the apex domain of the assets. Example: example.com.
TYPE:
|
referenced_ip
|
Filter on an A or CNAME record pointing to the IP address. Use eq or in for exact IP matching. Use contains with a trailing . for CIDR range matching, or without for prefix matching.
TYPE:
|
referenced_ip_before
|
If filtering on a referenced_ip, include additional criteria that the record existed during a date range. The reference must have started before this date.
TYPE:
|
referenced_ip_after
|
If filtering on a referenced_ip, include additional criteria that the record existed during a date range. The reference must have existed after this date.
TYPE:
|
has_dns_record_type
|
Filter for assets that have this DNS record type, e.g. A, CNAME, MX.
TYPE:
|
dns_resolves
|
Filter for assets that in the end resolve to a valid IP currently, either via an A or CNAME. IP assets are included when filtering for assets that resolve.
TYPE:
|
asn
|
Filter for assets which either are, or point to, an IP address announced by the provided ASN.
TYPE:
|
cname_reference
|
Filter on a domain that is referenced by a CNAME record. Only makes sense for domain asset types. Treated as a wildcard.
TYPE:
|
geo_country_iso
|
Filter for assets which either are, or point to, an IP address located in the provided ISO country code.
TYPE:
|
ip_owner
|
Filter for assets which either are, or point to, an IP address owned by the provided organization.
TYPE:
|
whois_email
|
Filter for assets where the WHOIS email address matches the provided value.
TYPE:
|
whois_email_current
|
Filter for assets where the WHOIS email address matches the provided value on the current WHOIS record.
TYPE:
|
open_port_number
|
Filter for assets which have an open port with the provided number.
TYPE:
|
open_port_protocol
|
Filter for assets which have an open port on the provided protocol.
TYPE:
|
open_port_service
|
Filter for assets which have an open port that appears to support the provided protocol.
TYPE:
|
open_port_technology
|
Filter for assets which have a specific product listening on an open port.
TYPE:
|
technology_name
|
Filter for the name of a technology found on the asset.
TYPE:
|
web_technology_name
|
Filter for the name of a technology specifically associated with web resources, such as jQuery or Wordpress.
TYPE:
|
certificate_issuer
|
Filter where the certificate issuer's common name or organization matches the provided value.
TYPE:
|
certificate_expires_before
|
Filter where the certificate expiration date is before the provided value.
TYPE:
|
certificate_expires_after
|
Filter where the certificate expiration date is after the provided value.
TYPE:
|
certificate_issued_before
|
Filter where the certificate issuance date is before the provided value.
TYPE:
|
certificate_issued_after
|
Filter where the certificate issuance date is after the provided value.
TYPE:
|
certificate_subject
|
Filter where certificate subject or organizationName matches the value.
TYPE:
|
certificate_subject_alt_name
|
Filter where the certificate Subject Alternative Name matches the value.
TYPE:
|
certificate_sha256
|
Filter where the certificate public key sha256 value matches the value.
TYPE:
|
certificate_covers_domain
|
Filter where the certificate subject common name or SAN exactly matches or wildcard-covers the provided value.
TYPE:
|
waf_detected
|
Filter for assets where a WAF is detected.
TYPE:
|
waf_name
|
Filter for assets where a specific WAF is detected.
TYPE:
|
is_responsive
|
Filter for assets that are either responsive or not responsive over ICMP and port scanning.
TYPE:
|
exposure_score_gte
|
Filter for assets with exposure score greater than or equal to this value.
TYPE:
|
exposure_score_lte
|
Filter for assets with exposure score less than or equal to this value.
TYPE:
|
exposure_severity
|
Filter for assets with an exposure severity matching or higher than the provided value.
TYPE:
|
exposure_id
|
Filter for assets which have an exposure with the provided ASI Signature ID.
TYPE:
|
additional_fields
|
Additional fields to include in the response. May be specified multiple times or as a comma-separated list in the raw API.
TYPE:
|
max_results
|
Maximum number of assets to fetch
TYPE:
|
assets_per_page
|
Results per page
TYPE:
|
Endpoint
v2/projects/{project_id}/assets
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If response data does not match the |
ASIFetchAssetError
|
If an API or connection error occurs. |
| RETURNS | DESCRIPTION |
|---|---|
AssetResponse
|
Response model for ASI assets list |
Source code in psengine/asi/asi_mgr.py
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 573 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 669 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 777 778 779 780 781 782 783 | |
fetch_asset
¶
fetch_asset(
project_id: str,
asset_id: str,
additional_fields: Optional[
list[
Literal[
'custom_tags',
'dns_records',
'whois',
'ip_metadata',
'open_tcp_ports',
'open_udp_ports',
'web_technologies',
'certificates',
'certificate_chain',
'defenses',
'exposures',
'exposure_instance_details',
]
]
] = None,
) -> Asset
Fetch a single asset within an ASI project.
| PARAMETER | DESCRIPTION |
|---|---|
project_id
|
The ID of the ASI project to search assets within
TYPE:
|
asset_id
|
The asset ID to search for.
TYPE:
|
additional_fields
|
Additional fields to include in the response. May be specified multiple times or as a comma-separated list in the raw API.
TYPE:
|
Endpoint
v2/projects/{project_id}/assets/{asset_id}
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If response data does not match the |
ASIFetchAssetError
|
If an API or connection error occurs. |
| RETURNS | DESCRIPTION |
|---|---|
Asset
|
ASI asset model for the requested asset |
Source code in psengine/asi/asi_mgr.py
fetch_asset_exposures
¶
fetch_asset_exposures(
project_id: str, asset_id: str
) -> AssetExposuresOut
Fetch exposures for a single asset within an ASI project.
| PARAMETER | DESCRIPTION |
|---|---|
project_id
|
The ID of the ASI project to search assets within
TYPE:
|
asset_id
|
The asset ID to search for.
TYPE:
|
Endpoint
v2/projects/{project_id}/assets/{asset_id}/exposures
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If response data does not match the |
ASIFetchAssetError
|
If an API or connection error occurs. |
| RETURNS | DESCRIPTION |
|---|---|
AssetExposuresOut
|
ASI asset model including exposures for the requested asset |