亚马逊S3 FindBucket。
s3recon的Python项目详细描述
s3recon
亚马逊S3桶查找和爬虫。
安装
$ pip install s3recon
用法
usage: s3recon [-h] [-o file] [-t seconds] word_list [word_list ...] positional arguments: word_list read words from one or more <word-list> files optional arguments: -h, --help show this help message and exit -o file, --output file write output to <file> -d, --db write output to database -p, --public only include 'public' buckets in the output -t seconds, --timeout seconds http request timeout in <seconds> (default: 30) -v, --version show program's version number and exit
示例1:输出到json文件
1.下载单词列表。
SecLists存储库有许多单词列表可供选择。对于本例,让我们下载此存储库中包含的示例单词列表。
$ curl -sSfL -o "word-list.txt""https://raw.githubusercontent.com/clarketm/s3recon/master/data/words.txt"
2.运行s3recon
。
使用word-list.txt
文件执行s3recon
,并将public
s3存储桶输出到名为results.json
的json文件。
$ s3recon "word-list.txt" -o "results.json" --public - PRIVATE https://s3.sa-east-1.amazonaws.com/test-lyft - PRIVATE https://s3.ap-south-1.amazonaws.com/test.amazon + PUBLIC https://walmart-dev.s3.us-east-1.amazonaws.com - PRIVATE https://s3.ap-southeast-1.amazonaws.com/apple-prod - PRIVATE https://walmart.s3.ap-southeast-1.amazonaws.com ...
3.检查结果。
检查results.json
输出文件以查看您发现的s3存储桶!
$ cat "results.json"
{"public":{"total":12,"hits":["https://walmart-dev.s3.us-east-1.amazonaws.com","https://apple-production.s3.ap-southeast-1.amazonaws.com",...]}}
Note: to include
private
buckets in the results omit the-p, --public
flag from the command.
4.抓取结果。
枚举位于每个bucket中的静态文件并记录结果。
Coming soon!
示例2:输出到MongoDB数据库
1.下载单词列表。
SecLists存储库有许多单词列表可供选择。对于本例,让我们下载此存储库中包含的示例单词列表。
$ curl -sSfL -o "word-list.txt""https://raw.githubusercontent.com/clarketm/s3recon/master/data/words.txt"
2.启动MongoDB实例
$ docker run --name "mongo" -p 27017:27017 -v "mongodb_data:/data/db" -v "mongodb_config:/data/configdb" -d mongo
3.运行s3recon
。
使用word-list.txt
文件执行s3recon
,并输出到MongoDB实例。
$ s3recon "word-list.txt" --db
- PRIVATE https://s3.sa-east-1.amazonaws.com/test-lyft
- PRIVATE https://s3.ap-south-1.amazonaws.com/test.amazon
+ PUBLIC https://walmart-dev.s3.us-east-1.amazonaws.com
- PRIVATE https://s3.ap-southeast-1.amazonaws.com/apple-prod
- PRIVATE https://walmart.s3.ap-southeast-1.amazonaws.com
...
3.检查结果。
检查MongoDB数据库:s3recon
集合:hits
以查看您发现的S3存储桶!
$ mongo "s3recon" --quiet --eval 'db.hits.find({}, {"url": 1, "access": 1, "_id": 0}).limit(5)'
{"url":"https://s3.us-east-2.amazonaws.com/apple","access":"private"}{"url":"https://s3.us-west-1.amazonaws.com/microsoft-dev","access":"private"}{"url":"https://s3.us-west-1.amazonaws.com/dev-microsoft","access":"private"}{"url":"https://s3.us-east-2.amazonaws.com/amazon","access":"private"}{"url":"https://s3.us-east-1.amazonaws.com/dev-amazon","access":"private"}
4.抓取结果。
枚举位于每个bucket中的静态文件并记录结果。
Coming soon!
常见问题解答
q:如何配置此实用程序?
答:
s3recon
可以使用位于当前工作目录(例如./s3recon.yml
)或主目录(例如~/s3recon.yml
)中的yaml配置文件进行配置。
以下是可配置值的列表:
# s3recon.ymldatabase:{ host:"0.0.0.0",...}separators:["-","_","."]environments:["","backup","backups",...]regions:["ap-northeast-1","ap-northeast-2",...]
To see the full list of configurable values (and their defaults) please refer to the s3recon.yml file in this repository.
q:如何定制侦察中使用的aws区域?
答:
可以通过在配置文件中设置s3recon.yml
数组来更改awsregions。
# s3recon.ymlregions:["us-west-2",...]
q:如何自定义侦察中使用的环境值?
答:
environments是与word list(和separator)的每个项排列的修饰符,用于在请求中构造bucket值。
可以通过在s3recon.yml
配置文件中设置environments
数组来更改该值。
例如,要仅搜索单词列表verbatim中的行(即不进行修改),可以将此值设置为空数组。
# s3recon.ymlenvironments:[]
q:如何自定义MongoDB主机和端口?
答:
数据库host和port可以通过更改s3recon.yml
配置文件中的database
映射来配置。
例如,host
和port
可以直接在database
映射中设置
# s3recon.ymldatabase:{ host:"0.0.0.0", port:27017}
q:如何使用MongoDB以外的数据库?
答:
对不起,目前只支持MongoDB。
继续
- []创建
crawl
命令,对在find
阶段找到的公共/私有存储桶进行爬网。 - []将
find
和crawl
作为子命令分开。 - [X]将发现的存储桶存储在NoSQL数据库中。
免责声明
此工具是为教育和安全目的而分发的。我对使用此工具的方式不承担任何责任。
许可证
麻省理工学院Travis Clarke