简体   繁体   English

无需 AWS 凭证即可获取可公开访问的 S3 存储桶内容

[英]Get publicly accessible contents of S3 bucket without AWS credentials

Given a bucket with publicly accessible contents, how can I get a listing of all those publicly accessible contents?给定一个包含可公开访问内容的存储桶,我如何获取所有这些可公开访问内容的列表? I know boto can do this, but boto requires AWS credentials.我知道 boto 可以做到这一点,但 boto 需要 AWS 凭证。 Also, boto doesn't work in Python3, which is what I'm working with.此外,boto 在我正在使用的 Python3 中也不起作用。

If the bucket's permissions allow Everyone to list it, you can just do a simple HTTP GET request to http://s3.amazonaws.com/bucketname with no credentials. 如果存储桶的权限允许所有人将其列出,则您可以不使用凭据对http://s3.amazonaws.com/bucketname进行简单的HTTP GET请求。 The response will be XML with everything in it, whether those objects are accessible by Everyone or not. 响应将是包含所有内容的XML,无论这些对象是否可由所有人访问。 I don't know if boto has an option to make this request without credentials. 我不知道boto是否可以选择不使用凭据发出此请求。 If not, you'll have to use lower-level HTTP and XML libraries. 如果没有,则必须使用较低级别的HTTP和XML库。

If the bucket itself does not allow Everyone to list it, there is no way to get a list of its contents, even if some of the objects in it are publicly accessible. 如果存储桶本身不允许所有人列出该存储桶,则即使该存储桶中的某些对象是可公开访问的,也无法获取其内容列表。

使用 AWS CLI,

aws s3 ls s3://*bucketname* --region *bucket-region* --no-sign-request

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM