regscale-cli 6.21.2.0__py3-none-any.whl → 6.28.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- regscale/_version.py +1 -1
- regscale/airflow/hierarchy.py +2 -2
- regscale/core/app/api.py +5 -2
- regscale/core/app/application.py +36 -6
- regscale/core/app/internal/control_editor.py +73 -21
- regscale/core/app/internal/evidence.py +727 -204
- regscale/core/app/internal/login.py +4 -2
- regscale/core/app/internal/model_editor.py +219 -64
- regscale/core/app/utils/app_utils.py +86 -12
- regscale/core/app/utils/catalog_utils/common.py +1 -1
- regscale/core/login.py +21 -4
- regscale/core/utils/async_graphql_client.py +363 -0
- regscale/core/utils/date.py +77 -1
- regscale/dev/cli.py +26 -0
- regscale/dev/code_gen.py +109 -24
- regscale/dev/version.py +72 -0
- regscale/integrations/commercial/__init__.py +30 -2
- regscale/integrations/commercial/aws/audit_manager_compliance.py +3908 -0
- regscale/integrations/commercial/aws/cli.py +3107 -54
- regscale/integrations/commercial/aws/cloudtrail_control_mappings.py +333 -0
- regscale/integrations/commercial/aws/cloudtrail_evidence.py +501 -0
- regscale/integrations/commercial/aws/cloudwatch_control_mappings.py +357 -0
- regscale/integrations/commercial/aws/cloudwatch_evidence.py +490 -0
- regscale/integrations/commercial/{amazon → aws}/common.py +71 -19
- regscale/integrations/commercial/aws/config_compliance.py +914 -0
- regscale/integrations/commercial/aws/conformance_pack_mappings.py +198 -0
- regscale/integrations/commercial/aws/control_compliance_analyzer.py +439 -0
- regscale/integrations/commercial/aws/evidence_generator.py +283 -0
- regscale/integrations/commercial/aws/guardduty_control_mappings.py +340 -0
- regscale/integrations/commercial/aws/guardduty_evidence.py +1053 -0
- regscale/integrations/commercial/aws/iam_control_mappings.py +368 -0
- regscale/integrations/commercial/aws/iam_evidence.py +574 -0
- regscale/integrations/commercial/aws/inventory/__init__.py +338 -22
- regscale/integrations/commercial/aws/inventory/base.py +107 -5
- regscale/integrations/commercial/aws/inventory/resources/analytics.py +390 -0
- regscale/integrations/commercial/aws/inventory/resources/applications.py +234 -0
- regscale/integrations/commercial/aws/inventory/resources/audit_manager.py +513 -0
- regscale/integrations/commercial/aws/inventory/resources/cloudtrail.py +315 -0
- regscale/integrations/commercial/aws/inventory/resources/cloudtrail_logs_metadata.py +476 -0
- regscale/integrations/commercial/aws/inventory/resources/cloudwatch.py +191 -0
- regscale/integrations/commercial/aws/inventory/resources/compute.py +328 -9
- regscale/integrations/commercial/aws/inventory/resources/config.py +464 -0
- regscale/integrations/commercial/aws/inventory/resources/containers.py +74 -9
- regscale/integrations/commercial/aws/inventory/resources/database.py +481 -31
- regscale/integrations/commercial/aws/inventory/resources/developer_tools.py +253 -0
- regscale/integrations/commercial/aws/inventory/resources/guardduty.py +286 -0
- regscale/integrations/commercial/aws/inventory/resources/iam.py +470 -0
- regscale/integrations/commercial/aws/inventory/resources/inspector.py +476 -0
- regscale/integrations/commercial/aws/inventory/resources/integration.py +175 -61
- regscale/integrations/commercial/aws/inventory/resources/kms.py +447 -0
- regscale/integrations/commercial/aws/inventory/resources/machine_learning.py +358 -0
- regscale/integrations/commercial/aws/inventory/resources/networking.py +390 -67
- regscale/integrations/commercial/aws/inventory/resources/s3.py +394 -0
- regscale/integrations/commercial/aws/inventory/resources/security.py +268 -72
- regscale/integrations/commercial/aws/inventory/resources/securityhub.py +473 -0
- regscale/integrations/commercial/aws/inventory/resources/storage.py +288 -29
- regscale/integrations/commercial/aws/inventory/resources/systems_manager.py +657 -0
- regscale/integrations/commercial/aws/inventory/resources/vpc.py +655 -0
- regscale/integrations/commercial/aws/kms_control_mappings.py +288 -0
- regscale/integrations/commercial/aws/kms_evidence.py +879 -0
- regscale/integrations/commercial/aws/ocsf/__init__.py +7 -0
- regscale/integrations/commercial/aws/ocsf/constants.py +115 -0
- regscale/integrations/commercial/aws/ocsf/mapper.py +435 -0
- regscale/integrations/commercial/aws/org_control_mappings.py +286 -0
- regscale/integrations/commercial/aws/org_evidence.py +666 -0
- regscale/integrations/commercial/aws/s3_control_mappings.py +356 -0
- regscale/integrations/commercial/aws/s3_evidence.py +632 -0
- regscale/integrations/commercial/aws/scanner.py +1072 -205
- regscale/integrations/commercial/aws/security_hub.py +319 -0
- regscale/integrations/commercial/aws/session_manager.py +282 -0
- regscale/integrations/commercial/aws/ssm_control_mappings.py +291 -0
- regscale/integrations/commercial/aws/ssm_evidence.py +492 -0
- regscale/integrations/commercial/jira.py +489 -153
- regscale/integrations/commercial/microsoft_defender/defender.py +326 -5
- regscale/integrations/commercial/microsoft_defender/defender_api.py +348 -14
- regscale/integrations/commercial/microsoft_defender/defender_constants.py +157 -0
- regscale/integrations/commercial/qualys/__init__.py +167 -68
- regscale/integrations/commercial/qualys/scanner.py +305 -39
- regscale/integrations/commercial/sarif/sairf_importer.py +432 -0
- regscale/integrations/commercial/sarif/sarif_converter.py +67 -0
- regscale/integrations/commercial/sicura/api.py +79 -42
- regscale/integrations/commercial/sicura/commands.py +8 -2
- regscale/integrations/commercial/sicura/scanner.py +83 -44
- regscale/integrations/commercial/stigv2/ckl_parser.py +5 -5
- regscale/integrations/commercial/synqly/assets.py +133 -16
- regscale/integrations/commercial/synqly/edr.py +2 -8
- regscale/integrations/commercial/synqly/query_builder.py +536 -0
- regscale/integrations/commercial/synqly/ticketing.py +27 -0
- regscale/integrations/commercial/synqly/vulnerabilities.py +165 -28
- regscale/integrations/commercial/tenablev2/cis_parsers.py +453 -0
- regscale/integrations/commercial/tenablev2/cis_scanner.py +447 -0
- regscale/integrations/commercial/tenablev2/commands.py +146 -5
- regscale/integrations/commercial/tenablev2/scanner.py +1 -3
- regscale/integrations/commercial/tenablev2/stig_parsers.py +113 -57
- regscale/integrations/commercial/wizv2/WizDataMixin.py +1 -1
- regscale/integrations/commercial/wizv2/click.py +191 -76
- regscale/integrations/commercial/wizv2/compliance/__init__.py +15 -0
- regscale/integrations/commercial/wizv2/{policy_compliance_helpers.py → compliance/helpers.py} +78 -60
- regscale/integrations/commercial/wizv2/compliance_report.py +1592 -0
- regscale/integrations/commercial/wizv2/core/__init__.py +133 -0
- regscale/integrations/commercial/wizv2/{async_client.py → core/client.py} +7 -3
- regscale/integrations/commercial/wizv2/{constants.py → core/constants.py} +92 -89
- regscale/integrations/commercial/wizv2/core/file_operations.py +237 -0
- regscale/integrations/commercial/wizv2/fetchers/__init__.py +11 -0
- regscale/integrations/commercial/wizv2/{data_fetcher.py → fetchers/policy_assessment.py} +66 -9
- regscale/integrations/commercial/wizv2/file_cleanup.py +104 -0
- regscale/integrations/commercial/wizv2/issue.py +776 -28
- regscale/integrations/commercial/wizv2/models/__init__.py +0 -0
- regscale/integrations/commercial/wizv2/parsers/__init__.py +34 -0
- regscale/integrations/commercial/wizv2/{parsers.py → parsers/main.py} +1 -1
- regscale/integrations/commercial/wizv2/processors/__init__.py +11 -0
- regscale/integrations/commercial/wizv2/{finding_processor.py → processors/finding.py} +1 -1
- regscale/integrations/commercial/wizv2/reports.py +243 -0
- regscale/integrations/commercial/wizv2/sbom.py +1 -1
- regscale/integrations/commercial/wizv2/scanner.py +1031 -441
- regscale/integrations/commercial/wizv2/utils/__init__.py +48 -0
- regscale/integrations/commercial/wizv2/{utils.py → utils/main.py} +116 -61
- regscale/integrations/commercial/wizv2/variables.py +89 -3
- regscale/integrations/compliance_integration.py +1036 -151
- regscale/integrations/control_matcher.py +432 -0
- regscale/integrations/due_date_handler.py +333 -0
- regscale/integrations/milestone_manager.py +291 -0
- regscale/integrations/public/__init__.py +14 -0
- regscale/integrations/public/cci_importer.py +834 -0
- regscale/integrations/public/csam/__init__.py +0 -0
- regscale/integrations/public/csam/csam.py +938 -0
- regscale/integrations/public/csam/csam_agency_defined.py +179 -0
- regscale/integrations/public/csam/csam_common.py +154 -0
- regscale/integrations/public/csam/csam_controls.py +432 -0
- regscale/integrations/public/csam/csam_poam.py +124 -0
- regscale/integrations/public/fedramp/click.py +77 -6
- regscale/integrations/public/fedramp/docx_parser.py +10 -1
- regscale/integrations/public/fedramp/fedramp_cis_crm.py +675 -289
- regscale/integrations/public/fedramp/fedramp_five.py +1 -1
- regscale/integrations/public/fedramp/poam/scanner.py +75 -7
- regscale/integrations/public/fedramp/poam_export_v5.py +888 -0
- regscale/integrations/scanner_integration.py +1961 -430
- regscale/models/integration_models/CCI_List.xml +1 -0
- regscale/models/integration_models/aqua.py +2 -2
- regscale/models/integration_models/cisa_kev_data.json +805 -11
- regscale/models/integration_models/flat_file_importer/__init__.py +5 -8
- regscale/models/integration_models/nexpose.py +36 -10
- regscale/models/integration_models/qualys.py +3 -4
- regscale/models/integration_models/synqly_models/capabilities.json +1 -1
- regscale/models/integration_models/synqly_models/connectors/vulnerabilities.py +87 -18
- regscale/models/integration_models/synqly_models/filter_parser.py +332 -0
- regscale/models/integration_models/synqly_models/ocsf_mapper.py +124 -25
- regscale/models/integration_models/synqly_models/synqly_model.py +89 -16
- regscale/models/locking.py +12 -8
- regscale/models/platform.py +4 -2
- regscale/models/regscale_models/__init__.py +7 -0
- regscale/models/regscale_models/assessment.py +2 -1
- regscale/models/regscale_models/catalog.py +1 -1
- regscale/models/regscale_models/compliance_settings.py +251 -1
- regscale/models/regscale_models/component.py +1 -0
- regscale/models/regscale_models/control_implementation.py +236 -41
- regscale/models/regscale_models/control_objective.py +74 -5
- regscale/models/regscale_models/file.py +2 -0
- regscale/models/regscale_models/form_field_value.py +5 -3
- regscale/models/regscale_models/inheritance.py +44 -0
- regscale/models/regscale_models/issue.py +301 -102
- regscale/models/regscale_models/milestone.py +33 -14
- regscale/models/regscale_models/organization.py +3 -0
- regscale/models/regscale_models/regscale_model.py +310 -73
- regscale/models/regscale_models/security_plan.py +4 -2
- regscale/models/regscale_models/vulnerability.py +3 -3
- regscale/regscale.py +25 -4
- regscale/templates/__init__.py +0 -0
- regscale/utils/threading/threadhandler.py +20 -15
- regscale/validation/record.py +23 -1
- {regscale_cli-6.21.2.0.dist-info → regscale_cli-6.28.2.1.dist-info}/METADATA +17 -33
- {regscale_cli-6.21.2.0.dist-info → regscale_cli-6.28.2.1.dist-info}/RECORD +310 -111
- tests/core/__init__.py +0 -0
- tests/core/utils/__init__.py +0 -0
- tests/core/utils/test_async_graphql_client.py +472 -0
- tests/fixtures/test_fixture.py +13 -8
- tests/regscale/core/test_login.py +171 -4
- tests/regscale/integrations/commercial/__init__.py +0 -0
- tests/regscale/integrations/commercial/aws/__init__.py +0 -0
- tests/regscale/integrations/commercial/aws/test_audit_manager_compliance.py +1304 -0
- tests/regscale/integrations/commercial/aws/test_audit_manager_evidence_aggregation.py +341 -0
- tests/regscale/integrations/commercial/aws/test_aws_analytics_collector.py +260 -0
- tests/regscale/integrations/commercial/aws/test_aws_applications_collector.py +242 -0
- tests/regscale/integrations/commercial/aws/test_aws_audit_manager_collector.py +1155 -0
- tests/regscale/integrations/commercial/aws/test_aws_cloudtrail_collector.py +534 -0
- tests/regscale/integrations/commercial/aws/test_aws_config_collector.py +400 -0
- tests/regscale/integrations/commercial/aws/test_aws_developer_tools_collector.py +203 -0
- tests/regscale/integrations/commercial/aws/test_aws_guardduty_collector.py +315 -0
- tests/regscale/integrations/commercial/aws/test_aws_iam_collector.py +458 -0
- tests/regscale/integrations/commercial/aws/test_aws_inspector_collector.py +353 -0
- tests/regscale/integrations/commercial/aws/test_aws_inventory_integration.py +530 -0
- tests/regscale/integrations/commercial/aws/test_aws_kms_collector.py +919 -0
- tests/regscale/integrations/commercial/aws/test_aws_machine_learning_collector.py +237 -0
- tests/regscale/integrations/commercial/aws/test_aws_s3_collector.py +722 -0
- tests/regscale/integrations/commercial/aws/test_aws_scanner_integration.py +722 -0
- tests/regscale/integrations/commercial/aws/test_aws_securityhub_collector.py +792 -0
- tests/regscale/integrations/commercial/aws/test_aws_systems_manager_collector.py +918 -0
- tests/regscale/integrations/commercial/aws/test_aws_vpc_collector.py +996 -0
- tests/regscale/integrations/commercial/aws/test_cli_evidence.py +431 -0
- tests/regscale/integrations/commercial/aws/test_cloudtrail_control_mappings.py +452 -0
- tests/regscale/integrations/commercial/aws/test_cloudtrail_evidence.py +788 -0
- tests/regscale/integrations/commercial/aws/test_config_compliance.py +298 -0
- tests/regscale/integrations/commercial/aws/test_conformance_pack_mappings.py +200 -0
- tests/regscale/integrations/commercial/aws/test_control_compliance_analyzer.py +375 -0
- tests/regscale/integrations/commercial/aws/test_datetime_parsing.py +223 -0
- tests/regscale/integrations/commercial/aws/test_evidence_generator.py +386 -0
- tests/regscale/integrations/commercial/aws/test_guardduty_control_mappings.py +564 -0
- tests/regscale/integrations/commercial/aws/test_guardduty_evidence.py +1041 -0
- tests/regscale/integrations/commercial/aws/test_iam_control_mappings.py +718 -0
- tests/regscale/integrations/commercial/aws/test_iam_evidence.py +1375 -0
- tests/regscale/integrations/commercial/aws/test_kms_control_mappings.py +656 -0
- tests/regscale/integrations/commercial/aws/test_kms_evidence.py +1163 -0
- tests/regscale/integrations/commercial/aws/test_ocsf_mapper.py +370 -0
- tests/regscale/integrations/commercial/aws/test_org_control_mappings.py +546 -0
- tests/regscale/integrations/commercial/aws/test_org_evidence.py +1240 -0
- tests/regscale/integrations/commercial/aws/test_s3_control_mappings.py +672 -0
- tests/regscale/integrations/commercial/aws/test_s3_evidence.py +987 -0
- tests/regscale/integrations/commercial/aws/test_scanner_evidence.py +373 -0
- tests/regscale/integrations/commercial/aws/test_security_hub_config_filtering.py +539 -0
- tests/regscale/integrations/commercial/aws/test_session_manager.py +516 -0
- tests/regscale/integrations/commercial/aws/test_ssm_control_mappings.py +588 -0
- tests/regscale/integrations/commercial/aws/test_ssm_evidence.py +735 -0
- tests/regscale/integrations/commercial/conftest.py +28 -0
- tests/regscale/integrations/commercial/microsoft_defender/__init__.py +1 -0
- tests/regscale/integrations/commercial/microsoft_defender/test_defender.py +1517 -0
- tests/regscale/integrations/commercial/microsoft_defender/test_defender_api.py +1748 -0
- tests/regscale/integrations/commercial/microsoft_defender/test_defender_constants.py +327 -0
- tests/regscale/integrations/commercial/microsoft_defender/test_defender_scanner.py +487 -0
- tests/regscale/integrations/commercial/test_aws.py +3742 -0
- tests/regscale/integrations/commercial/test_burp.py +48 -0
- tests/regscale/integrations/commercial/test_crowdstrike.py +49 -0
- tests/regscale/integrations/commercial/test_dependabot.py +341 -0
- tests/regscale/integrations/commercial/test_gcp.py +1543 -0
- tests/regscale/integrations/commercial/test_gitlab.py +549 -0
- tests/regscale/integrations/commercial/test_ip_mac_address_length.py +84 -0
- tests/regscale/integrations/commercial/test_jira.py +2204 -0
- tests/regscale/integrations/commercial/test_npm_audit.py +42 -0
- tests/regscale/integrations/commercial/test_okta.py +1228 -0
- tests/regscale/integrations/commercial/test_sarif_converter.py +251 -0
- tests/regscale/integrations/commercial/test_sicura.py +349 -0
- tests/regscale/integrations/commercial/test_snow.py +423 -0
- tests/regscale/integrations/commercial/test_sonarcloud.py +394 -0
- tests/regscale/integrations/commercial/test_sqlserver.py +186 -0
- tests/regscale/integrations/commercial/test_stig.py +33 -0
- tests/regscale/integrations/commercial/test_stig_mapper.py +153 -0
- tests/regscale/integrations/commercial/test_stigv2.py +406 -0
- tests/regscale/integrations/commercial/test_wiz.py +1365 -0
- tests/regscale/integrations/commercial/test_wiz_inventory.py +256 -0
- tests/regscale/integrations/commercial/wizv2/__init__.py +339 -0
- tests/regscale/integrations/commercial/wizv2/compliance/__init__.py +1 -0
- tests/regscale/integrations/commercial/wizv2/compliance/test_helpers.py +903 -0
- tests/regscale/integrations/commercial/wizv2/core/__init__.py +1 -0
- tests/regscale/integrations/commercial/wizv2/core/test_auth.py +701 -0
- tests/regscale/integrations/commercial/wizv2/core/test_client.py +1037 -0
- tests/regscale/integrations/commercial/wizv2/core/test_file_operations.py +989 -0
- tests/regscale/integrations/commercial/wizv2/fetchers/__init__.py +1 -0
- tests/regscale/integrations/commercial/wizv2/fetchers/test_policy_assessment.py +805 -0
- tests/regscale/integrations/commercial/wizv2/parsers/__init__.py +1 -0
- tests/regscale/integrations/commercial/wizv2/parsers/test_main.py +1153 -0
- tests/regscale/integrations/commercial/wizv2/processors/__init__.py +1 -0
- tests/regscale/integrations/commercial/wizv2/processors/test_finding.py +671 -0
- tests/regscale/integrations/commercial/wizv2/test_WizDataMixin.py +537 -0
- tests/regscale/integrations/commercial/wizv2/test_click_comprehensive.py +851 -0
- tests/regscale/integrations/commercial/wizv2/test_compliance_report_comprehensive.py +910 -0
- tests/regscale/integrations/commercial/wizv2/test_compliance_report_normalization.py +138 -0
- tests/regscale/integrations/commercial/wizv2/test_file_cleanup.py +283 -0
- tests/regscale/integrations/commercial/wizv2/test_file_operations.py +260 -0
- tests/regscale/integrations/commercial/wizv2/test_issue.py +343 -0
- tests/regscale/integrations/commercial/wizv2/test_issue_comprehensive.py +1203 -0
- tests/regscale/integrations/commercial/wizv2/test_reports.py +497 -0
- tests/regscale/integrations/commercial/wizv2/test_sbom.py +643 -0
- tests/regscale/integrations/commercial/wizv2/test_scanner_comprehensive.py +805 -0
- tests/regscale/integrations/commercial/wizv2/test_wiz_click_client_id.py +165 -0
- tests/regscale/integrations/commercial/wizv2/test_wiz_compliance_report.py +1394 -0
- tests/regscale/integrations/commercial/wizv2/test_wiz_compliance_unit.py +341 -0
- tests/regscale/integrations/commercial/wizv2/test_wiz_control_normalization.py +138 -0
- tests/regscale/integrations/commercial/wizv2/test_wiz_findings_comprehensive.py +364 -0
- tests/regscale/integrations/commercial/wizv2/test_wiz_inventory_comprehensive.py +644 -0
- tests/regscale/integrations/commercial/wizv2/test_wiz_status_mapping.py +149 -0
- tests/regscale/integrations/commercial/wizv2/test_wizv2.py +1218 -0
- tests/regscale/integrations/commercial/wizv2/test_wizv2_utils.py +519 -0
- tests/regscale/integrations/commercial/wizv2/utils/__init__.py +1 -0
- tests/regscale/integrations/commercial/wizv2/utils/test_main.py +1523 -0
- tests/regscale/integrations/public/__init__.py +0 -0
- tests/regscale/integrations/public/fedramp/__init__.py +1 -0
- tests/regscale/integrations/public/fedramp/test_gen_asset_list.py +150 -0
- tests/regscale/integrations/public/fedramp/test_poam_export_v5.py +1293 -0
- tests/regscale/integrations/public/test_alienvault.py +220 -0
- tests/regscale/integrations/public/test_cci.py +1053 -0
- tests/regscale/integrations/public/test_cisa.py +1021 -0
- tests/regscale/integrations/public/test_emass.py +518 -0
- tests/regscale/integrations/public/test_fedramp.py +1152 -0
- tests/regscale/integrations/public/test_fedramp_cis_crm.py +3661 -0
- tests/regscale/integrations/public/test_file_uploads.py +506 -0
- tests/regscale/integrations/public/test_oscal.py +453 -0
- tests/regscale/integrations/test_compliance_status_mapping.py +406 -0
- tests/regscale/integrations/test_control_matcher.py +1421 -0
- tests/regscale/integrations/test_control_matching.py +155 -0
- tests/regscale/integrations/test_milestone_manager.py +408 -0
- tests/regscale/models/test_control_implementation.py +118 -3
- tests/regscale/models/test_form_field_value_integration.py +304 -0
- tests/regscale/models/test_issue.py +378 -1
- tests/regscale/models/test_module_integration.py +582 -0
- tests/regscale/models/test_tenable_integrations.py +811 -105
- regscale/integrations/commercial/wizv2/policy_compliance.py +0 -3057
- regscale/integrations/public/fedramp/mappings/fedramp_r4_parts.json +0 -7388
- regscale/integrations/public/fedramp/mappings/fedramp_r5_parts.json +0 -9605
- regscale/integrations/public/fedramp/parts_mapper.py +0 -107
- /regscale/integrations/commercial/{amazon → sarif}/__init__.py +0 -0
- /regscale/integrations/commercial/wizv2/{wiz_auth.py → core/auth.py} +0 -0
- {regscale_cli-6.21.2.0.dist-info → regscale_cli-6.28.2.1.dist-info}/LICENSE +0 -0
- {regscale_cli-6.21.2.0.dist-info → regscale_cli-6.28.2.1.dist-info}/WHEEL +0 -0
- {regscale_cli-6.21.2.0.dist-info → regscale_cli-6.28.2.1.dist-info}/entry_points.txt +0 -0
- {regscale_cli-6.21.2.0.dist-info → regscale_cli-6.28.2.1.dist-info}/top_level.txt +0 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"""AWS compute resource collectors."""
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
|
-
from typing import Dict, List, Any, TYPE_CHECKING
|
|
4
|
+
from typing import Dict, List, Any, Optional, TYPE_CHECKING
|
|
5
5
|
|
|
6
6
|
if TYPE_CHECKING:
|
|
7
7
|
import boto3
|
|
8
8
|
|
|
9
|
+
from regscale.integrations.commercial.aws.inventory.resources.systems_manager import SystemsManagerCollector
|
|
9
10
|
from regscale.integrations.commercial.aws.inventory.base import BaseCollector
|
|
10
11
|
|
|
11
12
|
logger = logging.getLogger("regscale")
|
|
@@ -14,14 +15,27 @@ logger = logging.getLogger("regscale")
|
|
|
14
15
|
class ComputeCollector(BaseCollector):
|
|
15
16
|
"""Collector for AWS compute resources."""
|
|
16
17
|
|
|
17
|
-
def __init__(
|
|
18
|
+
def __init__(
|
|
19
|
+
self,
|
|
20
|
+
session: "boto3.Session",
|
|
21
|
+
region: str,
|
|
22
|
+
account_id: Optional[str] = None,
|
|
23
|
+
tags: Optional[Dict[str, str]] = None,
|
|
24
|
+
enabled_services: Optional[Dict[str, bool]] = None,
|
|
25
|
+
):
|
|
18
26
|
"""
|
|
19
27
|
Initialize the compute collector.
|
|
20
28
|
|
|
21
29
|
:param boto3.Session session: AWS session
|
|
22
30
|
:param str region: AWS region
|
|
31
|
+
:param str account_id: Optional AWS account ID to filter resources
|
|
32
|
+
:param dict tags: Optional tags to filter resources (key-value pairs)
|
|
33
|
+
:param dict enabled_services: Optional dict of service names to boolean flags for enabling/disabling collection
|
|
23
34
|
"""
|
|
24
35
|
super().__init__(session, region)
|
|
36
|
+
self.account_id = account_id
|
|
37
|
+
self.tags = tags or {}
|
|
38
|
+
self.enabled_services = enabled_services or {}
|
|
25
39
|
self.ec2_client = self._get_client("ec2")
|
|
26
40
|
self.logger = logging.getLogger("regscale")
|
|
27
41
|
|
|
@@ -124,8 +138,12 @@ class ComputeCollector(BaseCollector):
|
|
|
124
138
|
# Collect instance information
|
|
125
139
|
for page in paginator.paginate():
|
|
126
140
|
for reservation in page.get("Reservations", []):
|
|
141
|
+
# Get account ID from reservation
|
|
142
|
+
owner_id = reservation.get("OwnerId", "")
|
|
127
143
|
for instance in reservation.get("Instances", []):
|
|
128
144
|
instance_data = self._build_instance_data(instance, ami_details)
|
|
145
|
+
# Add owner ID for ARN construction
|
|
146
|
+
instance_data["OwnerId"] = owner_id
|
|
129
147
|
instances.append(instance_data)
|
|
130
148
|
|
|
131
149
|
except Exception as e:
|
|
@@ -152,6 +170,7 @@ class ComputeCollector(BaseCollector):
|
|
|
152
170
|
{
|
|
153
171
|
"Region": self.region,
|
|
154
172
|
"FunctionName": function.get("FunctionName"),
|
|
173
|
+
"FunctionArn": function.get("FunctionArn"),
|
|
155
174
|
"Runtime": function.get("Runtime"),
|
|
156
175
|
"Handler": function.get("Handler"),
|
|
157
176
|
"CodeSize": function.get("CodeSize"),
|
|
@@ -220,15 +239,315 @@ class ComputeCollector(BaseCollector):
|
|
|
220
239
|
self._handle_error(e, "ECS clusters")
|
|
221
240
|
return clusters
|
|
222
241
|
|
|
242
|
+
def get_systems_manager_info(self) -> Dict[str, Any]:
|
|
243
|
+
"""
|
|
244
|
+
Get information about Systems Manager resources.
|
|
245
|
+
|
|
246
|
+
:return: Dictionary containing Systems Manager information
|
|
247
|
+
:rtype: Dict[str, Any]
|
|
248
|
+
"""
|
|
249
|
+
try:
|
|
250
|
+
ssm_collector = SystemsManagerCollector(self.session, self.region, self.account_id, self.tags)
|
|
251
|
+
return ssm_collector.collect()
|
|
252
|
+
except Exception as e:
|
|
253
|
+
self._handle_error(e, "Systems Manager resources")
|
|
254
|
+
return {
|
|
255
|
+
"ManagedInstances": [],
|
|
256
|
+
"Parameters": [],
|
|
257
|
+
"Documents": [],
|
|
258
|
+
"PatchBaselines": [],
|
|
259
|
+
"MaintenanceWindows": [],
|
|
260
|
+
"Associations": [],
|
|
261
|
+
"InventoryEntries": [],
|
|
262
|
+
"ComplianceSummary": {},
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
def get_batch_compute_environments(self) -> List[Dict[str, Any]]:
|
|
266
|
+
"""
|
|
267
|
+
Get information about AWS Batch compute environments.
|
|
268
|
+
|
|
269
|
+
:return: List of Batch compute environment information
|
|
270
|
+
:rtype: List[Dict[str, Any]]
|
|
271
|
+
"""
|
|
272
|
+
environments = []
|
|
273
|
+
try:
|
|
274
|
+
batch_client = self._get_client("batch")
|
|
275
|
+
paginator = batch_client.get_paginator("describe_compute_environments")
|
|
276
|
+
|
|
277
|
+
for page in paginator.paginate():
|
|
278
|
+
for env in page.get("computeEnvironments", []):
|
|
279
|
+
if not self._matches_account(env.get("computeEnvironmentArn", "")):
|
|
280
|
+
continue
|
|
281
|
+
|
|
282
|
+
if not self._matches_tags(env.get("tags", {})):
|
|
283
|
+
continue
|
|
284
|
+
|
|
285
|
+
environments.append(
|
|
286
|
+
{
|
|
287
|
+
"Region": self.region,
|
|
288
|
+
"ComputeEnvironmentName": env.get("computeEnvironmentName"),
|
|
289
|
+
"ComputeEnvironmentArn": env.get("computeEnvironmentArn"),
|
|
290
|
+
"State": env.get("state"),
|
|
291
|
+
"Status": env.get("status"),
|
|
292
|
+
"Type": env.get("type"),
|
|
293
|
+
"ServiceRole": env.get("serviceRole"),
|
|
294
|
+
"Tags": env.get("tags", {}),
|
|
295
|
+
}
|
|
296
|
+
)
|
|
297
|
+
except Exception as e:
|
|
298
|
+
self._handle_error(e, "Batch compute environments")
|
|
299
|
+
return environments
|
|
300
|
+
|
|
301
|
+
def get_batch_job_queues(self) -> List[Dict[str, Any]]:
|
|
302
|
+
"""
|
|
303
|
+
Get information about AWS Batch job queues.
|
|
304
|
+
|
|
305
|
+
:return: List of Batch job queue information
|
|
306
|
+
:rtype: List[Dict[str, Any]]
|
|
307
|
+
"""
|
|
308
|
+
queues = []
|
|
309
|
+
try:
|
|
310
|
+
batch_client = self._get_client("batch")
|
|
311
|
+
paginator = batch_client.get_paginator("describe_job_queues")
|
|
312
|
+
|
|
313
|
+
for page in paginator.paginate():
|
|
314
|
+
for queue in page.get("jobQueues", []):
|
|
315
|
+
if not self._matches_account(queue.get("jobQueueArn", "")):
|
|
316
|
+
continue
|
|
317
|
+
|
|
318
|
+
if not self._matches_tags(queue.get("tags", {})):
|
|
319
|
+
continue
|
|
320
|
+
|
|
321
|
+
queues.append(
|
|
322
|
+
{
|
|
323
|
+
"Region": self.region,
|
|
324
|
+
"JobQueueName": queue.get("jobQueueName"),
|
|
325
|
+
"JobQueueArn": queue.get("jobQueueArn"),
|
|
326
|
+
"State": queue.get("state"),
|
|
327
|
+
"Status": queue.get("status"),
|
|
328
|
+
"Priority": queue.get("priority"),
|
|
329
|
+
"Tags": queue.get("tags", {}),
|
|
330
|
+
}
|
|
331
|
+
)
|
|
332
|
+
except Exception as e:
|
|
333
|
+
self._handle_error(e, "Batch job queues")
|
|
334
|
+
return queues
|
|
335
|
+
|
|
336
|
+
def _process_app_runner_service(self, apprunner_client: Any, service_arn: str) -> Optional[Dict[str, Any]]:
|
|
337
|
+
"""
|
|
338
|
+
Process a single App Runner service.
|
|
339
|
+
|
|
340
|
+
:param apprunner_client: App Runner client
|
|
341
|
+
:param str service_arn: Service ARN
|
|
342
|
+
:return: Service information or None if filtered out
|
|
343
|
+
:rtype: Optional[Dict[str, Any]]
|
|
344
|
+
"""
|
|
345
|
+
if not self._matches_account(service_arn):
|
|
346
|
+
return None
|
|
347
|
+
|
|
348
|
+
try:
|
|
349
|
+
service_detail = apprunner_client.describe_service(ServiceArn=service_arn)
|
|
350
|
+
service = service_detail.get("Service", {})
|
|
351
|
+
|
|
352
|
+
if not self._matches_tags(service.get("Tags", [])):
|
|
353
|
+
return None
|
|
354
|
+
|
|
355
|
+
return {
|
|
356
|
+
"Region": self.region,
|
|
357
|
+
"ServiceName": service.get("ServiceName"),
|
|
358
|
+
"ServiceArn": service.get("ServiceArn"),
|
|
359
|
+
"ServiceId": service.get("ServiceId"),
|
|
360
|
+
"Status": service.get("Status"),
|
|
361
|
+
"ServiceUrl": service.get("ServiceUrl"),
|
|
362
|
+
"CreatedAt": service.get("CreatedAt"),
|
|
363
|
+
"UpdatedAt": service.get("UpdatedAt"),
|
|
364
|
+
"Tags": service.get("Tags", []),
|
|
365
|
+
}
|
|
366
|
+
except Exception as detail_error:
|
|
367
|
+
logger.debug("Error getting App Runner service details for %s: %s", service_arn, detail_error)
|
|
368
|
+
return None
|
|
369
|
+
|
|
370
|
+
def get_app_runner_services(self) -> List[Dict[str, Any]]:
|
|
371
|
+
"""
|
|
372
|
+
Get information about AWS App Runner services.
|
|
373
|
+
|
|
374
|
+
:return: List of App Runner service information
|
|
375
|
+
:rtype: List[Dict[str, Any]]
|
|
376
|
+
"""
|
|
377
|
+
services = []
|
|
378
|
+
try:
|
|
379
|
+
apprunner_client = self._get_client("apprunner")
|
|
380
|
+
next_token = None
|
|
381
|
+
|
|
382
|
+
while True:
|
|
383
|
+
if next_token:
|
|
384
|
+
response = apprunner_client.list_services(NextToken=next_token)
|
|
385
|
+
else:
|
|
386
|
+
response = apprunner_client.list_services()
|
|
387
|
+
|
|
388
|
+
for service_summary in response.get("ServiceSummaryList", []):
|
|
389
|
+
service_arn = service_summary.get("ServiceArn", "")
|
|
390
|
+
service_info = self._process_app_runner_service(apprunner_client, service_arn)
|
|
391
|
+
if service_info:
|
|
392
|
+
services.append(service_info)
|
|
393
|
+
|
|
394
|
+
next_token = response.get("NextToken")
|
|
395
|
+
if not next_token:
|
|
396
|
+
break
|
|
397
|
+
|
|
398
|
+
except Exception as e:
|
|
399
|
+
self._handle_error(e, "App Runner services")
|
|
400
|
+
return services
|
|
401
|
+
|
|
402
|
+
def get_elastic_beanstalk_applications(self) -> List[Dict[str, Any]]:
|
|
403
|
+
"""
|
|
404
|
+
Get information about Elastic Beanstalk applications and environments.
|
|
405
|
+
|
|
406
|
+
:return: List of Elastic Beanstalk application information
|
|
407
|
+
:rtype: List[Dict[str, Any]]
|
|
408
|
+
"""
|
|
409
|
+
applications = []
|
|
410
|
+
try:
|
|
411
|
+
eb_client = self._get_client("elasticbeanstalk")
|
|
412
|
+
|
|
413
|
+
app_response = eb_client.describe_applications()
|
|
414
|
+
for app in app_response.get("Applications", []):
|
|
415
|
+
app_name = app.get("ApplicationName")
|
|
416
|
+
|
|
417
|
+
env_response = eb_client.describe_environments(ApplicationName=app_name)
|
|
418
|
+
environments = []
|
|
419
|
+
|
|
420
|
+
for env in env_response.get("Environments", []):
|
|
421
|
+
env_arn = env.get("EnvironmentArn", "")
|
|
422
|
+
|
|
423
|
+
if not self._matches_account(env_arn):
|
|
424
|
+
continue
|
|
425
|
+
|
|
426
|
+
try:
|
|
427
|
+
tags_response = eb_client.list_tags_for_resource(ResourceArn=env_arn)
|
|
428
|
+
env_tags = tags_response.get("ResourceTags", [])
|
|
429
|
+
|
|
430
|
+
if not self._matches_tags(env_tags):
|
|
431
|
+
continue
|
|
432
|
+
|
|
433
|
+
environments.append(
|
|
434
|
+
{
|
|
435
|
+
"EnvironmentName": env.get("EnvironmentName"),
|
|
436
|
+
"EnvironmentId": env.get("EnvironmentId"),
|
|
437
|
+
"EnvironmentArn": env_arn,
|
|
438
|
+
"Status": env.get("Status"),
|
|
439
|
+
"Health": env.get("Health"),
|
|
440
|
+
"SolutionStackName": env.get("SolutionStackName"),
|
|
441
|
+
"PlatformArn": env.get("PlatformArn"),
|
|
442
|
+
"EndpointURL": env.get("EndpointURL"),
|
|
443
|
+
"CNAME": env.get("CNAME"),
|
|
444
|
+
"Tags": env_tags,
|
|
445
|
+
}
|
|
446
|
+
)
|
|
447
|
+
except Exception as env_error:
|
|
448
|
+
logger.debug("Error getting Elastic Beanstalk environment tags for %s: %s", env_arn, env_error)
|
|
449
|
+
continue
|
|
450
|
+
|
|
451
|
+
if environments:
|
|
452
|
+
applications.append(
|
|
453
|
+
{
|
|
454
|
+
"Region": self.region,
|
|
455
|
+
"ApplicationName": app_name,
|
|
456
|
+
"ApplicationArn": app.get("ApplicationArn"),
|
|
457
|
+
"Description": app.get("Description"),
|
|
458
|
+
"DateCreated": app.get("DateCreated"),
|
|
459
|
+
"DateUpdated": app.get("DateUpdated"),
|
|
460
|
+
"Environments": environments,
|
|
461
|
+
}
|
|
462
|
+
)
|
|
463
|
+
|
|
464
|
+
except Exception as e:
|
|
465
|
+
self._handle_error(e, "Elastic Beanstalk applications")
|
|
466
|
+
return applications
|
|
467
|
+
|
|
468
|
+
def get_lightsail_instances(self) -> List[Dict[str, Any]]:
|
|
469
|
+
"""
|
|
470
|
+
Get information about Amazon Lightsail instances.
|
|
471
|
+
|
|
472
|
+
:return: List of Lightsail instance information
|
|
473
|
+
:rtype: List[Dict[str, Any]]
|
|
474
|
+
"""
|
|
475
|
+
instances = []
|
|
476
|
+
try:
|
|
477
|
+
lightsail_client = self._get_client("lightsail")
|
|
478
|
+
paginator = lightsail_client.get_paginator("get_instances")
|
|
479
|
+
|
|
480
|
+
for page in paginator.paginate():
|
|
481
|
+
for instance in page.get("instances", []):
|
|
482
|
+
instance_arn = instance.get("arn", "")
|
|
483
|
+
|
|
484
|
+
if not self._matches_account(instance_arn):
|
|
485
|
+
continue
|
|
486
|
+
|
|
487
|
+
if not self._matches_tags(instance.get("tags", [])):
|
|
488
|
+
continue
|
|
489
|
+
|
|
490
|
+
instances.append(
|
|
491
|
+
{
|
|
492
|
+
"Region": self.region,
|
|
493
|
+
"InstanceName": instance.get("name"),
|
|
494
|
+
"InstanceArn": instance_arn,
|
|
495
|
+
"BlueprintId": instance.get("blueprintId"),
|
|
496
|
+
"BlueprintName": instance.get("blueprintName"),
|
|
497
|
+
"BundleId": instance.get("bundleId"),
|
|
498
|
+
"State": instance.get("state", {}).get("name"),
|
|
499
|
+
"PrivateIpAddress": instance.get("privateIpAddress"),
|
|
500
|
+
"PublicIpAddress": instance.get("publicIpAddress"),
|
|
501
|
+
"IsStaticIp": instance.get("isStaticIp"),
|
|
502
|
+
"CreatedAt": instance.get("createdAt"),
|
|
503
|
+
"Tags": instance.get("tags", []),
|
|
504
|
+
}
|
|
505
|
+
)
|
|
506
|
+
except Exception as e:
|
|
507
|
+
self._handle_error(e, "Lightsail instances")
|
|
508
|
+
return instances
|
|
509
|
+
|
|
223
510
|
def collect(self) -> Dict[str, Any]:
|
|
224
511
|
"""
|
|
225
|
-
Collect
|
|
512
|
+
Collect compute resources based on enabled_services configuration.
|
|
226
513
|
|
|
227
|
-
:return: Dictionary containing
|
|
514
|
+
:return: Dictionary containing enabled compute resource information
|
|
228
515
|
:rtype: Dict[str, Any]
|
|
229
516
|
"""
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
517
|
+
result = {}
|
|
518
|
+
|
|
519
|
+
# EC2 Instances
|
|
520
|
+
if self.enabled_services.get("ec2", True):
|
|
521
|
+
result["EC2Instances"] = self.get_ec2_instances()
|
|
522
|
+
|
|
523
|
+
# Lambda Functions
|
|
524
|
+
if self.enabled_services.get("lambda", True):
|
|
525
|
+
result["LambdaFunctions"] = self.get_lambda_functions()
|
|
526
|
+
|
|
527
|
+
# ECS Clusters
|
|
528
|
+
if self.enabled_services.get("ecs", True):
|
|
529
|
+
result["ECSClusters"] = self.get_ecs_clusters()
|
|
530
|
+
|
|
531
|
+
# Systems Manager
|
|
532
|
+
if self.enabled_services.get("systems_manager", True):
|
|
533
|
+
ssm_info = self.get_systems_manager_info()
|
|
534
|
+
result.update(ssm_info)
|
|
535
|
+
|
|
536
|
+
# AWS Batch
|
|
537
|
+
if self.enabled_services.get("batch", True):
|
|
538
|
+
result["BatchComputeEnvironments"] = self.get_batch_compute_environments()
|
|
539
|
+
result["BatchJobQueues"] = self.get_batch_job_queues()
|
|
540
|
+
|
|
541
|
+
# App Runner
|
|
542
|
+
if self.enabled_services.get("app_runner", True):
|
|
543
|
+
result["AppRunnerServices"] = self.get_app_runner_services()
|
|
544
|
+
|
|
545
|
+
# Elastic Beanstalk
|
|
546
|
+
if self.enabled_services.get("elastic_beanstalk", True):
|
|
547
|
+
result["ElasticBeanstalkApplications"] = self.get_elastic_beanstalk_applications()
|
|
548
|
+
|
|
549
|
+
# Lightsail
|
|
550
|
+
if self.enabled_services.get("lightsail", True):
|
|
551
|
+
result["LightsailInstances"] = self.get_lightsail_instances()
|
|
552
|
+
|
|
553
|
+
return result
|