Created
October 24, 2018 21:39
-
-
Save ScriptAutomate/f5bc2b5d9bbfd11a3e76e90ef53ac53a to your computer and use it in GitHub Desktop.
[Python 3 / boto3 / AWS] List all S3 buckets, in the default region config, that have 'Public' permissions listed anywhere in the ACL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
s3 = boto3.resource('s3') | |
for bucket in s3.buckets.all(): | |
for oh_noes in s3.BucketAcl(bucket.name).grants: | |
if oh_noes['Grantee']['Type'] == 'Group' and oh_noes['Grantee']['URI'] == 'http://acs.amazonaws.com/groups/global/AllUsers': | |
print(bucket) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I made a repo that includes each of the example gists: https://github.com/ScriptAutomate/s3nakedinpublic