• Stars
    star
    123
  • Rank 288,518 (Top 6 %)
  • Language
    Python
  • License
    MIT License
  • Created over 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Amazon S3 bucket finder and crawler.

s3recon

PyPi release PyPi versions Downloads Documentation Status

Amazon S3 bucket finder and crawler.


Check out the s3recon docs

Installation

NOTE: s3recon requires python version >=3.6

$ pip install s3recon

Usage


usage: s3recon [-h] [-o file] [-d] [-p] [-t seconds] [-v] [-c num] 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
  -c num, --concurrency num      maximum <num> of concurrent requests (default: # of lcpus)
  

Example 1: Output to a json file

1. Download a word-list.

The SecLists repository has a multitude of word-lists to choose from. For this example, let's download the sample word-list included in this repository.

$ curl -sSfL -o "word-list.txt" "https://raw.githubusercontent.com/clarketm/s3recon/master/data/words.txt"

2. Run s3recon.

Execute s3recon using the word-list.txt file and output the public S3 buckets to a json file named results.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. Inspect the results.

Check the results.json output file to view the S3 buckets you have discovered!

$ 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. Crawl the results.

Enumerate the static files located in each bucket and record the findings.

Coming soon!

Example 2: Output to a MongoDB database

1. Download a word-list.

The SecLists repository has a multitude of word-lists to choose from. For this example, let's download the sample word-list included in this repository.

$ curl -sSfL -o "word-list.txt" "https://raw.githubusercontent.com/clarketm/s3recon/master/data/words.txt"

2. Start an instance of MongoDB

$ docker run --name "mongo" -p 27017:27017 -v "mongodb_data:/data/db" -v "mongodb_config:/data/configdb" -d mongo

3. Run s3recon.

Execute s3recon using the word-list.txt file and output to MongoDB instance.

$ 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. Inspect the results.

Check the MongoDB database: s3recon collection: hits to view the S3 buckets you have discovered!

$ 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. Crawl the results.

Enumerate the static files located in each bucket and record the findings.

Coming soon!

FAQ

Q: How do I configure this utility?

A:

s3recon can be configure using a yaml configuration file located in either the current working directory (e.g. ./s3recon.yml) or your home diretory (e.g. ~/s3recon.yml).

The following is the list of configurable values:

# s3recon.yml

database: { 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: How do I customize the AWS regions used in the recon?

A:

The AWS regions can be altered by setting the regions array in your s3recon.yml configuration file.

# s3recon.yml

regions: [ "us-west-2", ...]

Q: How do I customize the environment values used in the recon?

A:

The environments are modifiers permuted with each item of the word-list (and the separator) to construct the bucket value in request. The value can be altered by setting the environments array in your s3recon.yml configuration file.

For example, to only search lines from the word-list verbatim (i.e. without modification) you can set this value to an empty array.

# s3recon.yml

environments: []

Q: How do I customize the MongoDB host and port?

A:

The database host and port can be configured by altering the database map in your s3recon.yml configuration file.

For example, host and port can be set directly inside the database map

# s3recon.yml

database: {
  host: "0.0.0.0",
  port: 27017
}

Q: How do I use a database other than MongoDB?

A:

Sorry, at the moment only MongoDB is supported.

Going Forward

  • Create crawl command to crawl public/private buckets found in find stage.
  • Separate out find and crawl as subcommands.
  • Store discovered buckets in a NoSQL database.

Disclaimer

This tools is distributed for educational and security purposes. I take no responsibility and assume no liability for the manner in which this tool is used.

License

MIT Β© Travis Clarke

More Repositories

1

proxy-list

A list of free, public, forward proxy servers. UPDATED DAILY!
2,083
star
2

TableExport

The simple, easy-to-implement library to export HTML tables to xlsx, xls, csv, and txt files.
JavaScript
879
star
3

image-map

Responsive, dynamic image maps.
JavaScript
118
star
4

mergedeep

A deep merge function for 🐍.
Python
117
star
5

wait-for-it

Wait for service(s) to be available before executing a command.
Python
63
star
6

zsh-completions

Additional completion definitions for Zsh. UPDATED DAILY!
Shell
50
star
7

json

Drop-in replacement for Golang encoding/json with additional features.
Go
42
star
8

jwt-cli

Command line tool for working with JSON Web Tokens (JWT)
JavaScript
38
star
9

saga-monitor

Simple, elegant, and configurable redux-saga monitor
JavaScript
36
star
10

hugo-elasticsearch

Generate Elasticsearch indexes for Hugo static sites by parsing front matter
JavaScript
27
star
11

java-design-patterns

Catalog of popular object-oriented design patterns in Java
Java
21
star
12

ncalc

Command line utility for quick number base conversions ( ascii / binary / octal / decimal / hexadecimal )
Go
19
star
13

pprintjson

A json pretty printer for Python 🐍
Python
14
star
14

myip

Command line utility for displaying public and private IP addresses
Go
13
star
15

pprintast

An AST pretty printer for Python 🐍
Python
13
star
16

super

Data structures, data types, and algorithms with superpowers! πŸ’ͺ😎
JavaScript
12
star
17

jwt-token-generator

Generate JWT Token using Unix command line tools
Shell
11
star
18

go-bash-wrapper

Run bash scripts with Golang
Go
10
star
19

tableexport_flask_app

TableExport + Flask sample app
Python
9
star
20

highcharts-more

Universal highcharts-more module for the popular JavaScript charting framework Highcharts
JavaScript
8
star
21

hugo-lunr-indexer

Generate Lunr indexes for Hugo static sites by parsing front matter
JavaScript
8
star
22

SortAlgorithms

Sorting algorithm visualization using D3
CSS
8
star
23

React-generators

Generator templates for React using ES6/React best practices
JavaScript
8
star
24

docker-wrapper

Docker command wrapper.
Shell
8
star
25

HackerRank-Python

HackerRank Python Solutions
Python
7
star
26

generator-node-cli-commander

Node command line application generator.
JavaScript
7
star
27

linux-from-scratch

A list of files, scripts, and documentation for Linux From Scratch - Version 8.0
Shell
7
star
28

generator-node-cli

Node command line application generator.
JavaScript
7
star
29

check

Check if a TCP/UDP port is open on a host(s) using UNIX command line tools.
Shell
7
star
30

HackerRank-Java

HackerRank Java Solutions
Java
7
star
31

bitflag

A simple bit flag class for Python 🐍
Python
7
star
32

SearchableList

Extend doubly linked list `list.go` with search methods
Go
7
star
33

csv-2-mongo

Import a CSV to MongoDB
Python
7
star
34

movie-picker

Find something to watch on Netflix when the family is in town!
JavaScript
7
star
35

QueryTag

The simple, easy-to-implement jQuery plugin that allows you to add popular search queries from a Google Custom Search Engine (CSE) to your website as sortable, filterable, and stylable keyword tags.
CSS
7
star
36

i18n-api-node

Internationalization (I18n) API - Node
JavaScript
6
star
37

HackerRank-Bash

HackerRank Bash Solutions
Shell
6
star
38

calculator

React Native calculator
JavaScript
6
star
39

tableexport_angular4_webpack2_app

TableExport + Angular 4 + Webpack 2 sample app
JavaScript
6
star
40

realtime-twitter-feed

Realtime Twitter feed using Angular2, Twitter, Google Maps, Express, and Socket.io
CSS
6
star
41

react-microservice-boilerplate

A scalable React boilerplate with a built-in API layer for modern microservice architectures.
5
star
42

TableExport-docs

TableExport Documentation
CSS
5
star
43

systemstat

Command line utility for displaying process and system information
Go
5
star
44

tableexport_webpack-v1_app

TableExport + Webpack1 sample app
JavaScript
5
star
45

tcp

List open TCP connections
Go
5
star
46

babel-preset-clarketm-react-app

Customized Babel preset for Create React App
JavaScript
5
star
47

public-ip

A simple public IP address API
5
star
48

DeepClone

Light-weight deep clone implementation for JavaScript.
JavaScript
5
star
49

InterviewPracticeProblems

JavaScript
4
star
50

supermap

Map with superpowers!
JavaScript
4
star
51

Jenkins

Jenkins with Docker support
Dockerfile
4
star
52

python-project-skeleton

Python boilerplate and sample project structure.
4
star
53

MenuAnimate

Enhance your website with six stylish menu transformicons using SCSS (or LESS) and CSS.
CSS
4
star
54

chatbot

Go
4
star
55

HackerRank-C

HackerRank C/C++ Solutions
C++
4
star
56

superobject

Object with superpowers!
JavaScript
4
star
57

Rotate

The simple, easy-to-implement animation plugin to rotate icons, images, and elements.
JavaScript
4
star
58

react-lifecycle

Understanding the React Component Lifecycle
JavaScript
4
star
59

tsaleh-vim-tcomment

An easily extensible & universal comment plugin.
Vim Script
4
star
60

blog-api-node

Blog API - Node
JavaScript
4
star
61

HackerRank

HackerRank Solutions
4
star
62

tableexport_requirejs_app

TableExport + RequireJS sample app
HTML
4
star
63

microservice-architecture-node

Scalable microservices system using Loopback and Node.
4
star
64

express-webhook-example

Real-time Express API leveraging Webhooks
JavaScript
4
star
65

express-sse-example

Real-time Express streaming API leveraging Server Sent Events (SSE)
JavaScript
4
star
66

sonos-node

Fork of https://github.com/bencevans/node-sonos optimized for Node v6.10.3 LTS
JavaScript
4
star
67

connect-starhackit-app

JavaScript
3
star
68

connect-dva-app

JavaScript
3
star
69

7DaysOfJavaScript

JavaScript
3
star
70

connect-reactGo-app

JavaScript
3
star
71

connect-react-starter-kit

JavaScript
3
star
72

jzip

JavaScript
3
star
73

HackerRank-JavaScript

HackerRank JavaScript Solutions
JavaScript
3
star
74

ajGingrich.github.io

HTML
3
star
75

i18n-Interpolator

Internationalization (i18n) string interpolator
JavaScript
3
star
76

connect-kyt-app

JavaScript
3
star
77

HungryHokie

Java
3
star
78

connect

JavaScript
3
star
79

connect-reactql-app

JavaScript
3
star
80

UniversalRelayBoilerplate

JavaScript
3
star
81

connect-vulcan-app

JavaScript
3
star
82

create-react-server

JavaScript
3
star
83

aurelia-tutorial

A starter kit for building a standard app with Aurelia.
JavaScript
3
star
84

JavaScript-design-patterns

Catalog of popular object-oriented design patterns using the latest ECMAScript features
3
star
85

pj

Command line tool for working with ProwJobs (PJ)
Go
2
star
86

prow

A Kubernetes based CI/CD system (mirror of kubernetes/test-infra/prow)
Go
2
star
87

Boggle

Boggle
JavaScript
1
star
88

vim

Vim Script
1
star
89

HackerRank-SQL

HackerRank SQL Solutions
1
star
90

gloo-tutorial

Gloo Tutorial
Shell
1
star