AWS Code Sample
Catalog

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above.

list_findings.py

list_findings.py lists Amazon Inspector findings.

# Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompanying this file. This file is # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF # ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. from datetime import datetime import boto3 region_name = 'us-west-2' assessment_run_arn_1 = 'arn:aws:inspector:us-west-2:123456789012:target/0-prsTvjAI/template/0-kXLPD9el/run/0-FhvJqB4l' max_results = 250000 start_date = datetime(2019, 1, 1) end_date = datetime(2019, 12, 1) inspector = boto3.client('inspector', region_name = region_name) paginator = inspector.get_paginator('list_findings') finding_filter = { 'severities': [ 'High', 'Medium', 'Low', 'Informational', ], 'creationTimeRange': { 'beginDate': start_date, 'endDate': end_date, } } for findings in paginator.paginate( maxResults=max_results, assessmentRunArns=[ assessment_run_arn_1, ], filter = finding_filter ): for finding_arn in findings['findingArns']: print(finding_arn)

Sample Details

Service: inspector

Last tested: 2019-05-17

Author: walkerk1980

Type: snippet

On this page: