Skip to content

Commit

Permalink
some context changes
Browse files Browse the repository at this point in the history
  • Loading branch information
firefart committed Feb 24, 2021
1 parent af43be3 commit 2f636e7
Show file tree
Hide file tree
Showing 27 changed files with 174 additions and 194 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go: ["1.14.13", "1.15.6"]
go: ["1.16.0"]
steps:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v2
Expand Down
51 changes: 0 additions & 51 deletions .golangci.yml

This file was deleted.

4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM golang:latest AS build-env
WORKDIR /src
ENV GO111MODULE=on
ENV CGO_ENABLED=0
COPY go.mod /src/
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -o gobuster -ldflags="-s -w" -gcflags="all=-trimpath=/src" -asmflags="all=-trimpath=/src"
RUN go build -a -o gobuster -ldflags="-s -w" -gcflags="all=-trimpath=/src" -asmflags="all=-trimpath=/src"

FROM alpine:latest

Expand Down
23 changes: 20 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@ TARGET=./build
ARCHS=amd64 386
LDFLAGS="-s -w"

.PHONY: current
current:
@go build -o ./gobuster; \
echo "Done."

.PHONY: fmt
fmt:
@go fmt ./...; \
echo "Done."

.PHONY: update
update:
@go get -u; \
go mod tidy -v; \
echo "Done."

.PHONY: windows
windows:
@for GOARCH in ${ARCHS}; do \
echo "Building for windows $${GOARCH} ..." ; \
Expand All @@ -23,6 +27,7 @@ windows:
done; \
echo "Done."

.PHONY: linux
linux:
@for GOARCH in ${ARCHS}; do \
echo "Building for linux $${GOARCH} ..." ; \
Expand All @@ -31,6 +36,7 @@ linux:
done; \
echo "Done."

.PHONY: darwin
darwin:
@for GOARCH in ${ARCHS}; do \
echo "Building for darwin $${GOARCH} ..." ; \
Expand All @@ -39,19 +45,30 @@ darwin:
done; \
echo "Done."

.PHONY: all
all: clean fmt update test lint darwin linux windows

.PHONY: test
test:
@go test -v -race ./... ; \
echo "Done."

.PHONY: lint
lint:
@if [ ! -f "$$(go env GOPATH)/bin/golangci-lint" ]; then \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin; \
fi
"$$(go env GOPATH)/bin/golangci-lint" run ./...
go mod tidy

.PHONY: lint-update
lint-update:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin
$$(go env GOPATH)/bin/golangci-lint --version

.PHONY: lint-docker
lint-docker:
docker pull golangci/golangci-lint:latest
docker run --rm -v $$(pwd):/app -w /app golangci/golangci-lint:latest golangci-lint run

.PHONY: clean
clean:
@rm -rf ${TARGET}/* ; \
go clean ./... ; \
Expand Down
71 changes: 39 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

Gobuster is a tool used to brute-force:

* URIs (directories and files) in web sites.
* DNS subdomains (with wildcard support).
* Virtual Host names on target web servers.
* Open Amazon S3 buckets
- URIs (directories and files) in web sites.
- DNS subdomains (with wildcard support).
- Virtual Host names on target web servers.
- Open Amazon S3 buckets

## Tags, Statuses, etc

Expand All @@ -29,8 +29,8 @@ Because I wanted:

Yes, you're probably correct. Feel free to:

* Not use it.
* Show me how to do it better.
- Not use it.
- Show me how to do it better.

## Love this tool? Back it!

Expand All @@ -40,34 +40,39 @@ If you're backing us already, you rock. If you're not, that's cool too! Want to

All funds that are donated to this project will be donated to charity. A full log of charity donations will be available in this repository as they are processed.

## Changes in 3.1-dev

- Use go 1.16
- use contexts in the correct way

## Changes in 3.1

* enumerate public AWS S3 buckets
* fuzzing mode
* specify HTTP method
* added support for patterns. You can now specify a file containing patterns that are applied to every word, one by line. Every occurrence of the term `{GOBUSTER}` in it will be replaced with the current wordlist item. Please use with caution as this can cause increase the number of requests issued a lot.
* The shorthand `p` flag which was assigned to proxy is now used by the pattern flag
- enumerate public AWS S3 buckets
- fuzzing mode
- specify HTTP method
- added support for patterns. You can now specify a file containing patterns that are applied to every word, one by line. Every occurrence of the term `{GOBUSTER}` in it will be replaced with the current wordlist item. Please use with caution as this can cause increase the number of requests issued a lot.
- The shorthand `p` flag which was assigned to proxy is now used by the pattern flag

## Changes in 3.0

* New CLI options so modes are strictly separated (`-m` is now gone!)
* Performance Optimizations and better connection handling
* Ability to enumerate vhost names
* Option to supply custom HTTP headers
- New CLI options so modes are strictly separated (`-m` is now gone!)
- Performance Optimizations and better connection handling
- Ability to enumerate vhost names
- Option to supply custom HTTP headers

## Available Modes

* dir - the classic directory brute-forcing mode
* dns - DNS subdomain brute-forcing mode
* s3 - Enumerate open S3 buckets and look for existence and bucket listings
* vhost - virtual host brute-forcing mode (not the same as DNS!)
- dir - the classic directory brute-forcing mode
- dns - DNS subdomain brute-forcing mode
- s3 - Enumerate open S3 buckets and look for existence and bucket listings
- vhost - virtual host brute-forcing mode (not the same as DNS!)

## Built-in Help

Help is built-in!

* `gobuster help` - outputs the top-level help.
* `gobuster help <mode>` - outputs the help specific to that mode.
- `gobuster help` - outputs the top-level help.
- `gobuster help <mode>` - outputs the help specific to that mode.

## `dns` Mode Help

Expand Down Expand Up @@ -177,9 +182,11 @@ If you have a [Go](https://golang.org/) environment ready to go, it's as easy as
go get github.com/OJ/gobuster
```

PS: You need at least go 1.16.0 to compile gobuster.

## Building From Source

Since this tool is written in [Go](https://golang.org/) you need to install the Go language/compiler/etc. Full details of installation and set up can be found [on the Go language website](https://golang.org/doc/install). Once installed you have two options.
Since this tool is written in [Go](https://golang.org/) you need to install the Go language/compiler/etc. Full details of installation and set up can be found [on the Go language website](https://golang.org/doc/install). Once installed you have two options. You need at least go 1.16.0 to compile gobuster.

### Compiling

Expand All @@ -197,13 +204,13 @@ go install

If you have all the dependencies already, you can make use of the build scripts:

* `make` - builds for the current Go configuration (ie. runs `go build`).
* `make windows` - builds 32 and 64 bit binaries for windows, and writes them to the `build` folder.
* `make linux` - builds 32 and 64 bit binaries for linux, and writes them to the `build` folder.
* `make darwin` - builds 32 and 64 bit binaries for darwin, and writes them to the `build` folder.
* `make all` - builds for all platforms and architectures, and writes the resulting binaries to the `build` folder.
* `make clean` - clears out the `build` folder.
* `make test` - runs the tests.
- `make` - builds for the current Go configuration (ie. runs `go build`).
- `make windows` - builds 32 and 64 bit binaries for windows, and writes them to the `build` folder.
- `make linux` - builds 32 and 64 bit binaries for linux, and writes them to the `build` folder.
- `make darwin` - builds 32 and 64 bit binaries for darwin, and writes them to the `build` folder.
- `make all` - builds for all platforms and architectures, and writes the resulting binaries to the `build` folder.
- `make clean` - clears out the `build` folder.
- `make test` - runs the tests.

## Wordlists via STDIN

Expand Down Expand Up @@ -577,14 +584,14 @@ gobuster fuzz -u https://example.com?FUZZ=test -w parameter-names.txt

#### Use case in combination with patterns

* Create a custom wordlist for the target containing company names and so on
* Create a pattern file to use for common bucket names.
- Create a custom wordlist for the target containing company names and so on
- Create a pattern file to use for common bucket names.

```bash
curl -s --output - https://raw.githubusercontent.com/eth0izzle/bucket-stream/master/permutations/extended.txt | sed -s 's/%s/{GOBUSTER}/' > patterns.txt
```

* Run gobuster with the custom input. Be sure to turn verbose mode on to see the bucket details
- Run gobuster with the custom input. Be sure to turn verbose mode on to see the bucket details

```bash
gobuster s3 --wordlist my.custom.wordlist -p patterns.txt -v
Expand Down
4 changes: 3 additions & 1 deletion cli/cmd/dir.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/spf13/cobra"
)

// nolint:gochecknoglobals
var cmdDir *cobra.Command

func runDir(cmd *cobra.Command, args []string) error {
Expand All @@ -20,7 +21,7 @@ func runDir(cmd *cobra.Command, args []string) error {
return fmt.Errorf("error on parsing arguments: %w", err)
}

plugin, err := gobusterdir.NewGobusterDir(mainContext, globalopts, pluginopts)
plugin, err := gobusterdir.NewGobusterDir(globalopts, pluginopts)
if err != nil {
return fmt.Errorf("error on creating gobusterdir: %w", err)
}
Expand Down Expand Up @@ -135,6 +136,7 @@ func parseDirOptions() (*libgobuster.Options, *gobusterdir.OptionsDir, error) {
return globalopts, plugin, nil
}

// nolint:gochecknoinits
func init() {
cmdDir = &cobra.Command{
Use: "dir",
Expand Down
8 changes: 4 additions & 4 deletions cli/cmd/dir_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"context"
"fmt"
"io/ioutil"
"io"
"log"
"net/http"
"net/http/httptest"
Expand Down Expand Up @@ -47,7 +47,7 @@ func BenchmarkDirMode(b *testing.B) {
}
pluginopts.StatusCodesParsed = tmpStat

wordlist, err := ioutil.TempFile("", "")
wordlist, err := os.CreateTemp("", "")
if err != nil {
b.Fatalf("could not create tempfile: %v", err)
}
Expand All @@ -73,13 +73,13 @@ func BenchmarkDirMode(b *testing.B) {
}
defer devnull.Close()
log.SetFlags(0)
log.SetOutput(ioutil.Discard)
log.SetOutput(io.Discard)

// Run the real benchmark
for x := 0; x < b.N; x++ {
os.Stdout = devnull
os.Stderr = devnull
plugin, err := gobusterdir.NewGobusterDir(ctx, &globalopts, pluginopts)
plugin, err := gobusterdir.NewGobusterDir(&globalopts, pluginopts)
if err != nil {
b.Fatalf("error on creating gobusterdir: %v", err)
}
Expand Down
2 changes: 2 additions & 0 deletions cli/cmd/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/spf13/cobra"
)

// nolint:gochecknoglobals
var cmdDNS *cobra.Command

func runDNS(cmd *cobra.Command, args []string) error {
Expand Down Expand Up @@ -80,6 +81,7 @@ func parseDNSOptions() (*libgobuster.Options, *gobusterdns.OptionsDNS, error) {
return globalopts, plugin, nil
}

// nolint:gochecknoinits
func init() {
cmdDNS = &cobra.Command{
Use: "dns",
Expand Down
4 changes: 3 additions & 1 deletion cli/cmd/fuzz.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/spf13/cobra"
)

// nolint:gochecknoglobals
var cmdFuzz *cobra.Command

func runFuzz(cmd *cobra.Command, args []string) error {
Expand All @@ -20,7 +21,7 @@ func runFuzz(cmd *cobra.Command, args []string) error {
return fmt.Errorf("error on parsing arguments: %w", err)
}

plugin, err := gobusterfuzz.NewGobusterFuzz(mainContext, globalopts, pluginopts)
plugin, err := gobusterfuzz.NewGobusterFuzz(globalopts, pluginopts)
if err != nil {
return fmt.Errorf("error on creating gobusterfuzz: %w", err)
}
Expand Down Expand Up @@ -86,6 +87,7 @@ func parseFuzzOptions() (*libgobuster.Options, *gobusterfuzz.OptionsFuzz, error)
return globalopts, plugin, nil
}

// nolint:gochecknoinits
func init() {
cmdFuzz = &cobra.Command{
Use: "fuzz",
Expand Down
Loading

0 comments on commit 2f636e7

Please sign in to comment.